@oneie/sdk 0.17.3 → 0.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/.build-fingerprint +1 -0
- package/dist/age.d.ts +96 -0
- package/dist/age.d.ts.map +1 -0
- package/dist/age.js +487 -0
- package/dist/age.js.map +1 -0
- package/dist/blocks.d.ts +8 -4
- package/dist/blocks.d.ts.map +1 -1
- package/dist/blocks.js +17 -5
- package/dist/blocks.js.map +1 -1
- package/dist/edge/solve.d.ts +38 -0
- package/dist/edge/solve.d.ts.map +1 -0
- package/dist/edge/solve.js +334 -0
- package/dist/edge/solve.js.map +1 -0
- package/dist/edge/types.d.ts +216 -0
- package/dist/edge/types.d.ts.map +1 -0
- package/dist/edge/types.js +21 -0
- package/dist/edge/types.js.map +1 -0
- package/dist/edge/validate.d.ts +19 -0
- package/dist/edge/validate.d.ts.map +1 -0
- package/dist/edge/validate.js +89 -0
- package/dist/edge/validate.js.map +1 -0
- package/dist/edge.d.ts +9 -0
- package/dist/edge.d.ts.map +1 -0
- package/dist/edge.js +8 -0
- package/dist/edge.js.map +1 -0
- package/dist/fn-allowlist.d.ts +1 -1
- package/dist/fn-allowlist.d.ts.map +1 -1
- package/dist/fn-allowlist.js +14 -0
- package/dist/fn-allowlist.js.map +1 -1
- package/dist/gateway.d.ts +18 -1
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +77 -3
- package/dist/gateway.js.map +1 -1
- package/dist/generated/fn-map.d.ts +2 -2
- package/dist/generated/fn-map.d.ts.map +1 -1
- package/dist/generated/fn-map.js +114 -13
- package/dist/generated/fn-map.js.map +1 -1
- package/dist/generated/schemas.d.ts +56 -14
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +32 -1
- package/dist/generated/schemas.js.map +1 -1
- package/dist/market.d.ts.map +1 -1
- package/dist/market.js +6 -0
- package/dist/market.js.map +1 -1
- package/dist/message-key.d.ts +20 -0
- package/dist/message-key.d.ts.map +1 -0
- package/dist/message-key.js +46 -0
- package/dist/message-key.js.map +1 -0
- package/dist/message-lock.d.ts +56 -0
- package/dist/message-lock.d.ts.map +1 -0
- package/dist/message-lock.js +157 -0
- package/dist/message-lock.js.map +1 -0
- package/dist/receiver-layers.d.ts +1 -1
- package/dist/receiver-layers.d.ts.map +1 -1
- package/dist/receiver-layers.js +36 -0
- package/dist/receiver-layers.js.map +1 -1
- package/dist/receivers.d.ts +1397 -50
- package/dist/receivers.d.ts.map +1 -1
- package/dist/receivers.js +1423 -62
- package/dist/receivers.js.map +1 -1
- package/dist/secrets-give.d.ts +120 -0
- package/dist/secrets-give.d.ts.map +1 -0
- package/dist/secrets-give.js +160 -0
- package/dist/secrets-give.js.map +1 -0
- package/dist/secrets-grant.d.ts +52 -0
- package/dist/secrets-grant.d.ts.map +1 -0
- package/dist/secrets-grant.js +55 -0
- package/dist/secrets-grant.js.map +1 -0
- package/dist/secrets-key.d.ts +20 -0
- package/dist/secrets-key.d.ts.map +1 -0
- package/dist/secrets-key.js +47 -0
- package/dist/secrets-key.js.map +1 -0
- package/dist/secrets-one-vault.d.ts +21 -0
- package/dist/secrets-one-vault.d.ts.map +1 -0
- package/dist/secrets-one-vault.js +38 -0
- package/dist/secrets-one-vault.js.map +1 -0
- package/dist/secrets.d.ts +195 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +377 -0
- package/dist/secrets.js.map +1 -0
- package/dist/templates.js +6 -6
- package/dist/templates.js.map +1 -1
- package/dist/work-contract-grammar.json +41 -0
- package/package.json +37 -2
- package/src/generated/funs.json +1 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { type OneVaultReader } from './secrets-one-vault.js';
|
|
2
|
+
export { fixtureReader, lockToReader, readerToLock, ONE_VAULT_FIXTURE, type OneVault, type OneVaultFixture, type OneVaultReader } from './secrets-one-vault.js';
|
|
3
|
+
/** Every refusal the opener's give door answers (secrets/src/give.ts keeps the same list). */
|
|
4
|
+
export declare const GIVE_REFUSALS: readonly ["malformed", "unknown_provider", "bad_signature", "cannot_verify", "busy", "not_sealed_to_one", "bad_key", "check_failed", "flagged", "seal_mismatch", "stale", "subject_mismatch"];
|
|
5
|
+
export type GiveRefusal = (typeof GIVE_REFUSALS)[number];
|
|
6
|
+
export interface GiveBody {
|
|
7
|
+
name: string;
|
|
8
|
+
provider: string;
|
|
9
|
+
sealed: string;
|
|
10
|
+
mode: 'give' | 'check';
|
|
11
|
+
allowFlagged?: boolean;
|
|
12
|
+
/** The `sigHash` of the record this give replaces (`<vault>/<name>`), or null for a first give. */
|
|
13
|
+
replaces: string | null;
|
|
14
|
+
/** The giver's own actor — signed, and held by the opener to the caller the web side attests. */
|
|
15
|
+
subject: {
|
|
16
|
+
kind: 'actor';
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** What `secrets:give` takes. The web resolver adds the subject from the session — never the caller. */
|
|
21
|
+
export interface GiveData {
|
|
22
|
+
signer: {
|
|
23
|
+
kind: 'agent';
|
|
24
|
+
sig: string;
|
|
25
|
+
signer: string;
|
|
26
|
+
};
|
|
27
|
+
payload: {
|
|
28
|
+
type: 'give';
|
|
29
|
+
vault: string;
|
|
30
|
+
body: GiveBody;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface Given {
|
|
34
|
+
vault: string;
|
|
35
|
+
name: string;
|
|
36
|
+
provider: string;
|
|
37
|
+
last4: string;
|
|
38
|
+
flagged: string | null;
|
|
39
|
+
check: {
|
|
40
|
+
ok: true;
|
|
41
|
+
status: number;
|
|
42
|
+
};
|
|
43
|
+
/** sha256 of this give's signed bytes — what a later rotate names as `replaces`. */
|
|
44
|
+
sigHash: string;
|
|
45
|
+
}
|
|
46
|
+
export type GiveResult = {
|
|
47
|
+
ok: true;
|
|
48
|
+
stored: boolean;
|
|
49
|
+
given: Given;
|
|
50
|
+
} | {
|
|
51
|
+
ok: false;
|
|
52
|
+
refused?: GiveRefusal;
|
|
53
|
+
detail?: string;
|
|
54
|
+
error?: string;
|
|
55
|
+
};
|
|
56
|
+
export type OneLock = {
|
|
57
|
+
ok: true;
|
|
58
|
+
lock: string;
|
|
59
|
+
} | {
|
|
60
|
+
ok: false;
|
|
61
|
+
error: 'no_one_lock';
|
|
62
|
+
detail: string;
|
|
63
|
+
};
|
|
64
|
+
/** ONE's lock from ONE's vault: exactly one `readers` entry, `0x` + 64 hex. Anything else is `no_one_lock`. */
|
|
65
|
+
export declare function readOneLock(reader: OneVaultReader): Promise<OneLock>;
|
|
66
|
+
/**
|
|
67
|
+
* The plaintext a giver seals: canonical JSON `{"name","provider","v":1,"value","vault"}` — keys
|
|
68
|
+
* sorted, no whitespace. The opener re-serialises what it opens and refuses anything that is not
|
|
69
|
+
* exactly this, for exactly the give's vault, name and provider (`seal_mismatch`).
|
|
70
|
+
*/
|
|
71
|
+
export declare function sealedPlaintext(b: {
|
|
72
|
+
vault: string;
|
|
73
|
+
name: string;
|
|
74
|
+
provider: string;
|
|
75
|
+
value: string;
|
|
76
|
+
}): string;
|
|
77
|
+
export type SealedForOne = {
|
|
78
|
+
ok: true;
|
|
79
|
+
sealed: string;
|
|
80
|
+
} | {
|
|
81
|
+
ok: false;
|
|
82
|
+
error: 'no_one_lock' | 'lock_mismatch';
|
|
83
|
+
detail: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* `value`, bound to `{ vault, name, provider }` and sealed to the lock ONE's vault names — and nothing else —
|
|
87
|
+
* in the `.env.sealed` form `age:<base64>`. `reader` is the only source of that lock; `lock`, when
|
|
88
|
+
* given, is what the caller expects and must be the same (`lock_mismatch` otherwise). A reader
|
|
89
|
+
* that gives no lock is `no_one_lock`. There is no path here that seals to a lock it was handed.
|
|
90
|
+
*/
|
|
91
|
+
export declare function sealForOne(value: string, bind: {
|
|
92
|
+
vault: string;
|
|
93
|
+
name: string;
|
|
94
|
+
provider: string;
|
|
95
|
+
}, reader: OneVaultReader, lock?: string): Promise<SealedForOne>;
|
|
96
|
+
/** The bytes a give is signed over — the one canonical function the opener verifies with. */
|
|
97
|
+
export declare function giveBytes(payload: GiveData['payload']): string;
|
|
98
|
+
/**
|
|
99
|
+
* The `secrets:give` data for an agent: the payload and its own ed25519 signature over
|
|
100
|
+
* `canonicalSigned(payload)`. `subject` is the agent's own actor id — the caller the web side
|
|
101
|
+
* will attest for this request; any other is refused `subject_mismatch`. `secret` is the agent's 32-byte ed25519 secret; it is read,
|
|
102
|
+
* never kept, and the caller zeroes it.
|
|
103
|
+
*/
|
|
104
|
+
export declare function giveData(input: {
|
|
105
|
+
vault: string;
|
|
106
|
+
name: string;
|
|
107
|
+
provider: string;
|
|
108
|
+
sealed: string;
|
|
109
|
+
mode?: 'give' | 'check';
|
|
110
|
+
allowFlagged?: boolean;
|
|
111
|
+
replaces?: string | null;
|
|
112
|
+
subject: string;
|
|
113
|
+
}, secret: Uint8Array): GiveData;
|
|
114
|
+
/**
|
|
115
|
+
* An agent's ed25519 secret from the text of its key file: `suiprivkey1…` (Sui's bech32 export,
|
|
116
|
+
* scheme flag 0x00 — any other scheme is refused) or 64 hex characters. Anything else — a
|
|
117
|
+
* mnemonic, a JSON key file, a passkey — is null: the master never signs here.
|
|
118
|
+
*/
|
|
119
|
+
export declare function decodeSignerKey(text: string): Uint8Array | null;
|
|
120
|
+
//# sourceMappingURL=secrets-give.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-give.d.ts","sourceRoot":"","sources":["../src/secrets-give.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE1E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE/J,8FAA8F;AAC9F,eAAO,MAAM,aAAa,+LAahB,CAAA;A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K,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACpK,MAAM,EAAE,UAAU,GACjB,QAAQ,CAMV;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAiB/D"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// secrets-give.ts — the giver's half of the give door (text/secrets.md deliverable 6; C8).
|
|
2
|
+
// Import via the `@oneie/sdk/secrets-give` subpath (never the bare barrel).
|
|
3
|
+
//
|
|
4
|
+
// A terminal or an agent gives a key to ONE in three steps, all on the giver's side:
|
|
5
|
+
//
|
|
6
|
+
// 1 readOneLock(reader) ONE's lock, from ONE's vault — the single entry of its `readers`.
|
|
7
|
+
// No answer, or anything but exactly one entry, is `no_one_lock`.
|
|
8
|
+
// There is no constant to fall back to (plan D5).
|
|
9
|
+
// 2 sealForOne(value, { vault, name, provider }, reader, lock?)
|
|
10
|
+
// reads ONE's lock through `reader` (step 1) and seals ONLY to it —
|
|
11
|
+
// a caller's `lock` that differs is `lock_mismatch`, no answer is
|
|
12
|
+
// `no_one_lock`; no export here seals to a lock it was merely handed.
|
|
13
|
+
// What is sealed is `sealedPlaintext({ vault, name, provider, value })`,
|
|
14
|
+
// the canonical JSON `{"name","provider","v":1,"value","vault"}`
|
|
15
|
+
// (sorted keys, no whitespace): the opener refuses a blob whose vault,
|
|
16
|
+
// name or provider is not the give's (`seal_mismatch`), so a sealed
|
|
17
|
+
// key re-signed under another vault or name, or re-given as another
|
|
18
|
+
// provider (an OpenAI key sent to api.github.com), is never ONE's to
|
|
19
|
+
// keep or send (C8 repairs 2–3). The
|
|
20
|
+
// file is `age:<base64>`, wrapped to that one lock alone — the opener
|
|
21
|
+
// refuses a file wrapped to any second reader
|
|
22
|
+
// 3 giveData(input, key) the `secrets:give` data: the payload, and the signer's ed25519
|
|
23
|
+
// Sui personal-message signature over `canonicalSigned(payload)`
|
|
24
|
+
// (plan D15 — the vault and the kind `give` are in the bytes). The
|
|
25
|
+
// body always carries `replaces`: null on a first give, the stored
|
|
26
|
+
// record's `sigHash` on a rotate — a compare-and-set, so a captured
|
|
27
|
+
// give re-sent after a rotate is `stale`, never a rollback. And it
|
|
28
|
+
// carries `subject`, the giver's own actor: the opener refuses
|
|
29
|
+
// `subject_mismatch` unless it is the caller the web side attests, so
|
|
30
|
+
// a captured give resent under another session is never theirs
|
|
31
|
+
//
|
|
32
|
+
// Only an AGENT signs here, with its own ed25519 key. A person's give is a passkey touch on the
|
|
33
|
+
// seal page (C9, plan D11) — the master-derived key never signs a give, a grant or a stop.
|
|
34
|
+
//
|
|
35
|
+
// The value is a string the caller holds; nothing here keeps, logs or returns it.
|
|
36
|
+
import { encrypt } from './age.js';
|
|
37
|
+
import { bech32 } from '@scure/base';
|
|
38
|
+
import { signSuiPersonalMessage } from './message-lock.js';
|
|
39
|
+
import { canonicalSigned } from './secrets.js';
|
|
40
|
+
import { readerToLock } from './secrets-one-vault.js';
|
|
41
|
+
export { fixtureReader, lockToReader, readerToLock, ONE_VAULT_FIXTURE } from './secrets-one-vault.js';
|
|
42
|
+
/** Every refusal the opener's give door answers (secrets/src/give.ts keeps the same list). */
|
|
43
|
+
export const GIVE_REFUSALS = [
|
|
44
|
+
'malformed',
|
|
45
|
+
'unknown_provider',
|
|
46
|
+
'bad_signature',
|
|
47
|
+
'cannot_verify',
|
|
48
|
+
'busy',
|
|
49
|
+
'not_sealed_to_one',
|
|
50
|
+
'bad_key',
|
|
51
|
+
'check_failed',
|
|
52
|
+
'flagged',
|
|
53
|
+
'seal_mismatch',
|
|
54
|
+
'stale',
|
|
55
|
+
'subject_mismatch',
|
|
56
|
+
];
|
|
57
|
+
/** ONE's lock from ONE's vault: exactly one `readers` entry, `0x` + 64 hex. Anything else is `no_one_lock`. */
|
|
58
|
+
export async function readOneLock(reader) {
|
|
59
|
+
let readers;
|
|
60
|
+
try {
|
|
61
|
+
readers = (await reader())?.readers;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return { ok: false, error: 'no_one_lock', detail: 'ONE’s vault could not be read' };
|
|
65
|
+
}
|
|
66
|
+
if (!Array.isArray(readers) || readers.length === 0)
|
|
67
|
+
return { ok: false, error: 'no_one_lock', detail: 'ONE’s vault lists no lock' };
|
|
68
|
+
if (readers.length !== 1)
|
|
69
|
+
return { ok: false, error: 'no_one_lock', detail: 'ONE’s vault lists more than one reader' };
|
|
70
|
+
const entry = readers[0];
|
|
71
|
+
if (typeof entry !== 'string')
|
|
72
|
+
return { ok: false, error: 'no_one_lock', detail: 'ONE’s lock is not a readers entry' };
|
|
73
|
+
try {
|
|
74
|
+
return { ok: true, lock: readerToLock(entry) };
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return { ok: false, error: 'no_one_lock', detail: 'ONE’s lock is not a readers entry' };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The plaintext a giver seals: canonical JSON `{"name","provider","v":1,"value","vault"}` — keys
|
|
82
|
+
* sorted, no whitespace. The opener re-serialises what it opens and refuses anything that is not
|
|
83
|
+
* exactly this, for exactly the give's vault, name and provider (`seal_mismatch`).
|
|
84
|
+
*/
|
|
85
|
+
export function sealedPlaintext(b) {
|
|
86
|
+
return JSON.stringify({ name: b.name, provider: b.provider, v: 1, value: b.value, vault: b.vault });
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* `value`, bound to `{ vault, name, provider }` and sealed to the lock ONE's vault names — and nothing else —
|
|
90
|
+
* in the `.env.sealed` form `age:<base64>`. `reader` is the only source of that lock; `lock`, when
|
|
91
|
+
* given, is what the caller expects and must be the same (`lock_mismatch` otherwise). A reader
|
|
92
|
+
* that gives no lock is `no_one_lock`. There is no path here that seals to a lock it was handed.
|
|
93
|
+
*/
|
|
94
|
+
export async function sealForOne(value, bind, reader, lock) {
|
|
95
|
+
if (typeof reader !== 'function')
|
|
96
|
+
return { ok: false, error: 'no_one_lock', detail: 'no reader of ONE’s vault' };
|
|
97
|
+
const one = await readOneLock(reader);
|
|
98
|
+
if (!one.ok)
|
|
99
|
+
return one;
|
|
100
|
+
if (lock !== undefined && lock.trim() !== one.lock)
|
|
101
|
+
return { ok: false, error: 'lock_mismatch', detail: 'that is not the lock ONE’s vault names' };
|
|
102
|
+
const bytes = new TextEncoder().encode(sealedPlaintext({ vault: bind.vault, name: bind.name, provider: bind.provider, value }));
|
|
103
|
+
try {
|
|
104
|
+
const file = encrypt(bytes, [one.lock]);
|
|
105
|
+
let bin = '';
|
|
106
|
+
for (const b of file)
|
|
107
|
+
bin += String.fromCharCode(b);
|
|
108
|
+
return { ok: true, sealed: 'age:' + btoa(bin) };
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
bytes.fill(0);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/** The bytes a give is signed over — the one canonical function the opener verifies with. */
|
|
115
|
+
export function giveBytes(payload) {
|
|
116
|
+
return canonicalSigned(payload);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The `secrets:give` data for an agent: the payload and its own ed25519 signature over
|
|
120
|
+
* `canonicalSigned(payload)`. `subject` is the agent's own actor id — the caller the web side
|
|
121
|
+
* will attest for this request; any other is refused `subject_mismatch`. `secret` is the agent's 32-byte ed25519 secret; it is read,
|
|
122
|
+
* never kept, and the caller zeroes it.
|
|
123
|
+
*/
|
|
124
|
+
export function giveData(input, secret) {
|
|
125
|
+
const body = { name: input.name, provider: input.provider, sealed: input.sealed, mode: input.mode ?? 'give', replaces: input.replaces ?? null, subject: { kind: 'actor', id: input.subject } };
|
|
126
|
+
if (input.allowFlagged === true)
|
|
127
|
+
body.allowFlagged = true;
|
|
128
|
+
const payload = { type: 'give', vault: input.vault, body };
|
|
129
|
+
const { address, signature } = signSuiPersonalMessage(secret, giveBytes(payload));
|
|
130
|
+
return { signer: { kind: 'agent', sig: signature, signer: address }, payload };
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* An agent's ed25519 secret from the text of its key file: `suiprivkey1…` (Sui's bech32 export,
|
|
134
|
+
* scheme flag 0x00 — any other scheme is refused) or 64 hex characters. Anything else — a
|
|
135
|
+
* mnemonic, a JSON key file, a passkey — is null: the master never signs here.
|
|
136
|
+
*/
|
|
137
|
+
export function decodeSignerKey(text) {
|
|
138
|
+
const t = text.trim();
|
|
139
|
+
if (/^[0-9a-fA-F]{64}$/.test(t)) {
|
|
140
|
+
const out = new Uint8Array(32);
|
|
141
|
+
for (let i = 0; i < 32; i++)
|
|
142
|
+
out[i] = parseInt(t.slice(i * 2, i * 2 + 2), 16);
|
|
143
|
+
return out;
|
|
144
|
+
}
|
|
145
|
+
if (!t.startsWith('suiprivkey1'))
|
|
146
|
+
return null;
|
|
147
|
+
try {
|
|
148
|
+
const d = bech32.decode(t, 90);
|
|
149
|
+
if (d.prefix !== 'suiprivkey')
|
|
150
|
+
return null;
|
|
151
|
+
const bytes = bech32.fromWords(d.words);
|
|
152
|
+
if (bytes.length !== 33 || bytes[0] !== 0x00)
|
|
153
|
+
return null;
|
|
154
|
+
return bytes.slice(1);
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=secrets-give.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-give.js","sourceRoot":"","sources":["../src/secrets-give.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,4EAA4E;AAC5E,EAAE;AACF,qFAAqF;AACrF,EAAE;AAC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G,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAC7E,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO,IAAI,CAAA;IAC7C,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAA0B,EAAE,EAAE,CAAC,CAAA;QACvD,IAAI,CAAC,CAAC,MAAM,KAAK,YAAY;YAAE,OAAO,IAAI,CAAA;QAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,OAAO,IAAI,CAAA;QACzD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type Grant } from './secrets.js';
|
|
2
|
+
export type GrantBody = Omit<Grant, 'sig'>;
|
|
3
|
+
export interface GrantData {
|
|
4
|
+
signer: {
|
|
5
|
+
kind: 'agent';
|
|
6
|
+
sig: string;
|
|
7
|
+
signer: string;
|
|
8
|
+
};
|
|
9
|
+
payload: {
|
|
10
|
+
type: 'grant';
|
|
11
|
+
vault: string;
|
|
12
|
+
body: GrantBody;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface StopData {
|
|
16
|
+
signer: {
|
|
17
|
+
kind: 'agent';
|
|
18
|
+
sig: string;
|
|
19
|
+
signer: string;
|
|
20
|
+
};
|
|
21
|
+
payload: {
|
|
22
|
+
type: 'stop';
|
|
23
|
+
vault: string;
|
|
24
|
+
body: {
|
|
25
|
+
grantId: string;
|
|
26
|
+
at: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** 16 random bytes as 32 lower-case hex — the id the seal page can show (its ids start alphanumeric). */
|
|
31
|
+
export declare function newGrantId(): string;
|
|
32
|
+
/** The grant body, `for` built exactly: absent stays absent, `[]` stays `[]`. */
|
|
33
|
+
export declare function grantBody(input: {
|
|
34
|
+
vault: string;
|
|
35
|
+
secret: string;
|
|
36
|
+
to: Grant['to'];
|
|
37
|
+
perDay: number;
|
|
38
|
+
until: string;
|
|
39
|
+
id?: string;
|
|
40
|
+
paths?: string[];
|
|
41
|
+
models?: string[];
|
|
42
|
+
tools?: string[];
|
|
43
|
+
}): GrantBody;
|
|
44
|
+
/** The `secrets:grant` data for an agent lender. `secret` is its 32-byte ed25519 secret. */
|
|
45
|
+
export declare function grantData(input: Parameters<typeof grantBody>[0], secret: Uint8Array): GrantData;
|
|
46
|
+
/** The `secrets:revoke` data for an agent lender: a Stop for `grantId` on `vault`, at `at` (ISO-8601 UTC, default now). */
|
|
47
|
+
export declare function stopData(input: {
|
|
48
|
+
vault: string;
|
|
49
|
+
grantId: string;
|
|
50
|
+
at?: string;
|
|
51
|
+
}, secret: Uint8Array): StopData;
|
|
52
|
+
//# sourceMappingURL=secrets-grant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-grant.d.ts","sourceRoot":"","sources":["../src/secrets-grant.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAmB,KAAK,KAAK,EAAe,MAAM,cAAc,CAAA;AAEvE,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAE1C,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IACtD,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,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ant and revoke doors (text/secrets.md deliverable 11;
|
|
2
|
+
// C12). Import via the `@oneie/sdk/secrets-grant` subpath (never the bare barrel).
|
|
3
|
+
//
|
|
4
|
+
// An AGENT lends a key, or stops a lend, with its own ed25519 key (C16's `one secrets lend` builds on
|
|
5
|
+
// these): the payload, and its Sui personal-message signature over `canonicalSigned(payload)` (plan
|
|
6
|
+
// D15 — the kind and the vault are in the bytes, so a grant never reads as a Stop or as another
|
|
7
|
+
// vault's). The signer must be on the vault's grant-signers (D14); the opener checks it against the
|
|
8
|
+
// chain, against the vault the KEY was given under — never the document's word.
|
|
9
|
+
//
|
|
10
|
+
// A PERSON never signs here: a person's grant or Stop is a passkey touch on the seal page, in a
|
|
11
|
+
// window of its own (C9 — the opener refuses a framed grant or Stop, `framed_grant`). The
|
|
12
|
+
// master-derived key never signs a give, a grant or a Stop.
|
|
13
|
+
//
|
|
14
|
+
// `for` is built exactly: a field the caller did not pass is ABSENT, never `[]` (D17 — absent means
|
|
15
|
+
// the provider row's defaults, `[]` means nothing). The id is 16 random bytes as hex unless the
|
|
16
|
+
// caller names one — and an id is never reused on a vault: the opener refuses `id_used`, so a Stop
|
|
17
|
+
// is permanent. The secret key is read, never kept; the caller zeroes it.
|
|
18
|
+
import { signSuiPersonalMessage } from './message-lock.js';
|
|
19
|
+
import { canonicalSigned } from './secrets.js';
|
|
20
|
+
/** 16 random bytes as 32 lower-case hex — the id the seal page can show (its ids start alphanumeric). */
|
|
21
|
+
export function newGrantId() {
|
|
22
|
+
const b = crypto.getRandomValues(new Uint8Array(16));
|
|
23
|
+
let s = '';
|
|
24
|
+
for (const x of b)
|
|
25
|
+
s += x.toString(16).padStart(2, '0');
|
|
26
|
+
return s;
|
|
27
|
+
}
|
|
28
|
+
/** The grant body, `for` built exactly: absent stays absent, `[]` stays `[]`. */
|
|
29
|
+
export function grantBody(input) {
|
|
30
|
+
const f = {};
|
|
31
|
+
if (input.paths !== undefined)
|
|
32
|
+
f.paths = [...input.paths];
|
|
33
|
+
if (input.models !== undefined)
|
|
34
|
+
f.models = [...input.models];
|
|
35
|
+
if (input.tools !== undefined)
|
|
36
|
+
f.tools = [...input.tools];
|
|
37
|
+
const to = { kind: input.to.kind, id: input.to.id };
|
|
38
|
+
if (input.to.agents !== undefined)
|
|
39
|
+
to.agents = [...input.to.agents];
|
|
40
|
+
return { id: input.id ?? newGrantId(), secret: input.secret, vault: input.vault, to, for: f, perDay: input.perDay, until: input.until };
|
|
41
|
+
}
|
|
42
|
+
/** The `secrets:grant` data for an agent lender. `secret` is its 32-byte ed25519 secret. */
|
|
43
|
+
export function grantData(input, secret) {
|
|
44
|
+
const payload = { type: 'grant', vault: input.vault, body: grantBody(input) };
|
|
45
|
+
const { address, signature } = signSuiPersonalMessage(secret, canonicalSigned(payload));
|
|
46
|
+
return { signer: { kind: 'agent', sig: signature, signer: address }, payload };
|
|
47
|
+
}
|
|
48
|
+
/** The `secrets:revoke` data for an agent lender: a Stop for `grantId` on `vault`, at `at` (ISO-8601 UTC, default now). */
|
|
49
|
+
export function stopData(input, secret) {
|
|
50
|
+
const at = input.at ?? new Date().toISOString();
|
|
51
|
+
const payload = { type: 'stop', vault: input.vault, body: { grantId: input.grantId, at } };
|
|
52
|
+
const { address, signature } = signSuiPersonalMessage(secret, canonicalSigned(payload));
|
|
53
|
+
return { signer: { kind: 'agent', sig: signature, signer: address }, payload };
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=secrets-grant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-grant.js","sourceRoot":"","sources":["../src/secrets-grant.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,mFAAmF;AACnF,EAAE;AACF,sGAAsG;AACtG,oGAAoG;AACpG,gGAAgG;AAChG,oGAAoG;AACpG,gFAAgF;AAChF,EAAE;AACF,gGAAgG;AAChG,0FAA0F;AAC1F,4DAA4D;AAC5D,EAAE;AACF,oGAAoG;AACpG,gGAAgG;AAChG,mGAAmG;AACn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AAChF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** HKDF info — the secrets key. Locked. */
|
|
2
|
+
export declare const SECRETS_KEY_INFO = "secrets-x25519-v1";
|
|
3
|
+
export interface SecretsKey {
|
|
4
|
+
/** `age1…` — the lock a secret is sealed to. */
|
|
5
|
+
recipient: string;
|
|
6
|
+
/** 32 public bytes behind the recipient. */
|
|
7
|
+
publicKey: Uint8Array;
|
|
8
|
+
/** 32 secret bytes. Zero them when done. */
|
|
9
|
+
secret: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
/** Derive the secrets key from the master. The caller zeroes `secret`. */
|
|
12
|
+
export declare function deriveSecretsKey(master: Uint8Array): SecretsKey;
|
|
13
|
+
/**
|
|
14
|
+
* The secrets key for a 24-word phrase. The error never repeats the input — it may BE
|
|
15
|
+
* the phrase. The caller zeroes `secret`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function secretsKeyFromPhrase(mnemonic: string): SecretsKey;
|
|
18
|
+
/** The `AGE-SECRET-KEY-1…` form, for export to the age CLI or another tool. */
|
|
19
|
+
export declare function secretsIdentityText(k: SecretsKey): string;
|
|
20
|
+
//# sourceMappingURL=secrets-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-key.d.ts","sourceRoot":"","sources":["../src/secrets-key.ts"],"names":[],"mappings":"AAgBA,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,sBAAsB,CAAA;AAEnD,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAA;IACjB,4CAA4C;IAC5C,SAAS,EAAE,UAAU,CAAA;IACrB,4CAA4C;IAC5C,MAAM,EAAE,UAAU,CAAA;CACnB;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAK/D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAUjE;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAEzD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// secrets-key.ts — the paper lock: the 24 words derive the lock a sealed .env opens with.
|
|
2
|
+
// Import via the `@oneie/sdk/secrets-key` subpath (never the bare barrel).
|
|
3
|
+
//
|
|
4
|
+
// HKDF-SHA256(master 32 bytes, salt empty, info 'secrets-x25519-v1') → X25519 → age1…
|
|
5
|
+
// The master IS the 24 words' 32-byte entropy, so a fresh machine holding only the words
|
|
6
|
+
// reaches the same lock. A different label from the message key, so the two locks are
|
|
7
|
+
// different keys from one master. The label is LOCKED: changing it changes everyone's
|
|
8
|
+
// lock and makes every secret already sealed unreadable (text/secrets.md deliverable 4).
|
|
9
|
+
import { x25519 } from '@noble/curves/ed25519.js';
|
|
10
|
+
import { hkdf } from '@noble/hashes/hkdf.js';
|
|
11
|
+
import { sha256 } from '@noble/hashes/sha2.js';
|
|
12
|
+
import { mnemonicToEntropy, validateMnemonic } from '@scure/bip39';
|
|
13
|
+
import { wordlist } from '@scure/bip39/wordlists/english.js';
|
|
14
|
+
import { encodeIdentity, encodeRecipient } from './age.js';
|
|
15
|
+
/** HKDF info — the secrets key. Locked. */
|
|
16
|
+
export const SECRETS_KEY_INFO = 'secrets-x25519-v1';
|
|
17
|
+
/** Derive the secrets key from the master. The caller zeroes `secret`. */
|
|
18
|
+
export function deriveSecretsKey(master) {
|
|
19
|
+
if (master.length !== 32)
|
|
20
|
+
throw new Error('the master is 32 bytes');
|
|
21
|
+
const secret = hkdf(sha256, master, new Uint8Array(0), new TextEncoder().encode(SECRETS_KEY_INFO), 32);
|
|
22
|
+
const publicKey = x25519.getPublicKey(secret);
|
|
23
|
+
return { recipient: encodeRecipient(publicKey), publicKey, secret };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The secrets key for a 24-word phrase. The error never repeats the input — it may BE
|
|
27
|
+
* the phrase. The caller zeroes `secret`.
|
|
28
|
+
*/
|
|
29
|
+
export function secretsKeyFromPhrase(mnemonic) {
|
|
30
|
+
const words = mnemonic.trim().toLowerCase().split(/\s+/).join(' ');
|
|
31
|
+
if (!validateMnemonic(words, wordlist))
|
|
32
|
+
throw new Error('that is not a valid 24-word BIP-39 recovery phrase');
|
|
33
|
+
const master = mnemonicToEntropy(words, wordlist);
|
|
34
|
+
if (master.length !== 32)
|
|
35
|
+
throw new Error('that is not a 24-word BIP-39 recovery phrase');
|
|
36
|
+
try {
|
|
37
|
+
return deriveSecretsKey(master);
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
master.fill(0);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** The `AGE-SECRET-KEY-1…` form, for export to the age CLI or another tool. */
|
|
44
|
+
export function secretsIdentityText(k) {
|
|
45
|
+
return encodeIdentity(k.secret);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=secrets-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-key.js","sourceRoot":"","sources":["../src/secrets-key.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,2EAA2E;AAC3E,EAAE;AACF,sFAAsF;AACtF,yFAAyF;AACzF,sFAAsF;AACtF,sFAAsF;AACtF,yFAAyF;AAEzF,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1D,2CAA2C;AAC3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAA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@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** ONE's vault as a giver reads it: `readers` (`0x` + 64 hex each) and `sealedHash` (64 hex, or null). */
|
|
2
|
+
export interface OneVault {
|
|
3
|
+
readers: string[];
|
|
4
|
+
sealedHash: string | null;
|
|
5
|
+
}
|
|
6
|
+
/** Reads ONE's vault. Throws (or rejects) when it cannot be reached — a caller refuses, it never guesses. */
|
|
7
|
+
export type OneVaultReader = () => Promise<OneVault>;
|
|
8
|
+
/** The Interface Contract #7 fixture: ONE's lock (`age1…`) and the seal page's sha256. */
|
|
9
|
+
export interface OneVaultFixture {
|
|
10
|
+
oneLock: string | null;
|
|
11
|
+
sealPageHash: string | null;
|
|
12
|
+
}
|
|
13
|
+
/** Until C14: nothing published. A give reads `no_one_lock` from this, by design. */
|
|
14
|
+
export declare const ONE_VAULT_FIXTURE: Readonly<OneVaultFixture>;
|
|
15
|
+
/** An `age1…` lock as the vault stores it: its 32 public bytes as an address (`0x` + 64 hex). */
|
|
16
|
+
export declare function lockToReader(lock: string): string;
|
|
17
|
+
/** A `readers` entry back to the `age1…` lock it is. Throws on anything but `0x` + 64 hex. */
|
|
18
|
+
export declare function readerToLock(entry: string): string;
|
|
19
|
+
/** The fixture as a reader of ONE's vault — `readers` holds the lock (or nothing), `sealedHash` the page hash. */
|
|
20
|
+
export declare function fixtureReader(f?: OneVaultFixture): OneVaultReader;
|
|
21
|
+
//# sourceMappingURL=secrets-one-vault.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-one-vault.d.ts","sourceRoot":"","sources":["../src/secrets-one-vault.ts"],"names":[],"mappings":"AAgBA,0GAA0G;AAC1G,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,6GAA6G;AAC7G,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEpD,0FAA0F;AAC1F,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,eAAe,CAAsH,CAAA;AAI9K,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,kHAAkH;AAClH,wBAAgB,aAAa,CAAC,CAAC,GAAE,eAAmC,GAAG,cAAc,CAEpF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// secrets-one-vault.ts — what ONE's own vault says, read by every giver (text/secrets-plan.md D5;
|
|
2
|
+
// text/secrets-todo.md Interface Contract #7). Import via `@oneie/sdk/secrets-give`, which
|
|
3
|
+
// re-exports it.
|
|
4
|
+
//
|
|
5
|
+
// Ruled 2026-10-26 (C8 card): ONE's lock is the SINGLE entry in ONE's vault `readers`
|
|
6
|
+
// (schema/sui.tql — readers are "the keys a sealed file is wrapped to"; Move `vector<address>`,
|
|
7
|
+
// so ONE's 32-byte X25519 public key is one address-sized entry), and ONE's `sealed_hash` is
|
|
8
|
+
// the seal page's fingerprint. No new Move field.
|
|
9
|
+
//
|
|
10
|
+
// Until C14 publishes the vault package on testnet, the reader is a FIXTURE of the same shape —
|
|
11
|
+
// `{ oneLock, sealPageHash }` — behind the injectable `OneVaultReader`, so the day the chain
|
|
12
|
+
// answers, only the reader changes. The fixture's lock is null until ONE's lock is published:
|
|
13
|
+
// a reader with no lock gives `no_one_lock`, and no caller ever falls back to a constant.
|
|
14
|
+
import { decodeRecipient, encodeRecipient } from './age.js';
|
|
15
|
+
/** Until C14: nothing published. A give reads `no_one_lock` from this, by design. */
|
|
16
|
+
export const ONE_VAULT_FIXTURE = Object.freeze({ oneLock: null, sealPageHash: '53ae3750a1ed478212fd17cd4d0cdbf0ab6c10f4b73f1c2e0d84850c455a6a26' });
|
|
17
|
+
const READER_RE = /^0x[0-9a-f]{64}$/i;
|
|
18
|
+
/** An `age1…` lock as the vault stores it: its 32 public bytes as an address (`0x` + 64 hex). */
|
|
19
|
+
export function lockToReader(lock) {
|
|
20
|
+
let hex = '0x';
|
|
21
|
+
for (const b of decodeRecipient(lock))
|
|
22
|
+
hex += b.toString(16).padStart(2, '0');
|
|
23
|
+
return hex;
|
|
24
|
+
}
|
|
25
|
+
/** A `readers` entry back to the `age1…` lock it is. Throws on anything but `0x` + 64 hex. */
|
|
26
|
+
export function readerToLock(entry) {
|
|
27
|
+
if (!READER_RE.test(entry))
|
|
28
|
+
throw new Error('a readers entry is 0x and 64 hex characters');
|
|
29
|
+
const bytes = new Uint8Array(32);
|
|
30
|
+
for (let i = 0; i < 32; i++)
|
|
31
|
+
bytes[i] = parseInt(entry.slice(2 + i * 2, 4 + i * 2), 16);
|
|
32
|
+
return encodeRecipient(bytes);
|
|
33
|
+
}
|
|
34
|
+
/** The fixture as a reader of ONE's vault — `readers` holds the lock (or nothing), `sealedHash` the page hash. */
|
|
35
|
+
export function fixtureReader(f = ONE_VAULT_FIXTURE) {
|
|
36
|
+
return async () => ({ readers: f.oneLock ? [lockToReader(f.oneLock)] : [], sealedHash: f.sealPageHash });
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=secrets-one-vault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-one-vault.js","sourceRoot":"","sources":["../src/secrets-one-vault.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,2FAA2F;AAC3F,iBAAiB;AACjB,EAAE;AACF,sFAAsF;AACtF,gGAAgG;AAChG,6FAA6F;AAC7F,kDAAkD;AAClD,EAAE;AACF,gGAAgG;AAChG,6FAA6F;AAC7F,8FAA8F;AAC9F,0FAA0F;AAE1F,OAAO,EAAE,eAAe,EAA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