@tinycloud/share-sdk 1.1.1 → 1.2.0-beta.1
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/dist/addressed-publish-CsUS7-SI.d.cts +535 -0
- package/dist/addressed-publish-CsUS7-SI.d.ts +535 -0
- package/dist/artifact.cjs +5665 -0
- package/dist/artifact.cjs.map +1 -0
- package/dist/artifact.d.cts +104 -0
- package/dist/artifact.d.ts +104 -0
- package/dist/artifact.js +5631 -0
- package/dist/artifact.js.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -523
- package/dist/index.d.ts +4 -523
- package/dist/index.js.map +1 -1
- package/dist/share-root.cjs +7068 -0
- package/dist/share-root.cjs.map +1 -0
- package/dist/share-root.d.cts +342 -0
- package/dist/share-root.d.ts +342 -0
- package/dist/share-root.js +7030 -0
- package/dist/share-root.js.map +1 -0
- package/package.json +14 -1
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { CompactUcanAuthorization } from '@tinycloud/share-envelope';
|
|
2
|
+
import { C as CreateOwnerDelegationParams, r as OwnerDelegationReceipt, D as DelegatedShareKey, A as AddressedOwnerRootInput, i as AddressedOwnerRootReceipt } from './addressed-publish-CsUS7-SI.cjs';
|
|
3
|
+
|
|
4
|
+
/** KV prefix every share lives under; the root never reaches outside it. */
|
|
5
|
+
declare const SHARE_ROOT_PREFIX = "xyz.tinycloud.share/shares/";
|
|
6
|
+
/** Longest lifetime of a Share (browser device or CLI profile) root. */
|
|
7
|
+
declare const SHARE_ROOT_MAX_LIFETIME_MS: number;
|
|
8
|
+
/** Longest lifetime of an agent root (the OpenKey device-grant cap). */
|
|
9
|
+
declare const AGENT_SHARE_ROOT_MAX_LIFETIME_MS: number;
|
|
10
|
+
/** Product cap on a bearer link or policy root signed under a root. */
|
|
11
|
+
declare const SHARE_ROOT_LINK_MAX_LIFETIME_MS: number;
|
|
12
|
+
/**
|
|
13
|
+
* Signer clock skew tolerated on a signed root's `exp - iat` (only there:
|
|
14
|
+
* `exp - now` stays strict), so an approval is not wasted when the signer
|
|
15
|
+
* sets its own issue time.
|
|
16
|
+
*/
|
|
17
|
+
declare const SHARE_ROOT_CLOCK_SKEW_MS: number;
|
|
18
|
+
/** `ensureShareRoot` asks for the cap minus this margin, so a clamping or slow signer stays inside the cap. */
|
|
19
|
+
declare const SHARE_ROOT_REQUEST_MARGIN_MS: number;
|
|
20
|
+
/**
|
|
21
|
+
* NODE-B2 (§9 "Advertised mode"): a Node lists these in the `features` of
|
|
22
|
+
* its public `GET /info` (sdk-core `checkNodeInfo` → `NodeInfo.features`):
|
|
23
|
+
* the capability marker plus exactly one active mode. Read in one place,
|
|
24
|
+
* {@link readPolicyOwnerAuthorityMode}; the Node version is never consulted.
|
|
25
|
+
*/
|
|
26
|
+
declare const POLICY_OWNER_AUTHORITY_FEATURES: {
|
|
27
|
+
readonly marker: "policy-owner-authority-v1";
|
|
28
|
+
readonly record: "policy-owner-authority-record";
|
|
29
|
+
readonly enforce: "policy-owner-authority-enforce";
|
|
30
|
+
};
|
|
31
|
+
/** How long a known mode is trusted before the Node is asked again (NODE-B2: at most 5 minutes). */
|
|
32
|
+
declare const POLICY_OWNER_AUTHORITY_PROBE_TTL_MS: number;
|
|
33
|
+
/** `share`: Share/CLI root in `applications`. `agent`: `default` space, bearer only. */
|
|
34
|
+
type ShareRootKind = "share" | "agent";
|
|
35
|
+
/**
|
|
36
|
+
* What the owner signed. `kv`: get + metadata on the share prefix only.
|
|
37
|
+
* `kv+share-decrypt`: also decrypt on the owner's `:share` network, which a
|
|
38
|
+
* policy owner needs; minted only while the Node advertises `enforce` and
|
|
39
|
+
* `shareRootPolicyRoots` is on.
|
|
40
|
+
*/
|
|
41
|
+
type ShareRootScope = "kv" | "kv+share-decrypt";
|
|
42
|
+
type ShareRootErrorCode = "invalid-request" | "invalid-key" | "key-cleared" | "lifetime-exceeds-cap" | "expired" | "malformed-root" | "issuer-mismatch" | "audience-mismatch" | "resource-mismatch" | "ability-mismatch" | "expiry-mismatch" | "reroot-same-key" | "link-out-of-scope" | "policy-roots-disabled" | "policy-roots-not-enforced-by-node" | "root-not-policy-capable";
|
|
43
|
+
interface ShareRootErrorDetails {
|
|
44
|
+
/** The delegation CID the Node imported (the receipt's), when the owner already signed. */
|
|
45
|
+
readonly rootCid?: string;
|
|
46
|
+
/** CID of the signed bytes, when it differs from `rootCid`. */
|
|
47
|
+
readonly signedCid?: string;
|
|
48
|
+
/** The imported root may grant more, or longer, than requested: the owner must revoke `rootCid`. */
|
|
49
|
+
readonly mustRevoke?: boolean;
|
|
50
|
+
}
|
|
51
|
+
declare class ShareRootError extends Error {
|
|
52
|
+
readonly code: ShareRootErrorCode;
|
|
53
|
+
readonly rootCid?: string;
|
|
54
|
+
readonly signedCid?: string;
|
|
55
|
+
readonly mustRevoke: boolean;
|
|
56
|
+
constructor(code: ShareRootErrorCode, message: string, details?: ShareRootErrorDetails);
|
|
57
|
+
}
|
|
58
|
+
/** What a signed-in owner session provides: TinyCloudNode / web-sdk `createOwnerDelegation`. */
|
|
59
|
+
interface ShareRootOwnerAuthority {
|
|
60
|
+
/** `did:pkh:eip155:<chain>:<address>` of the owner wallet. */
|
|
61
|
+
readonly ownerDid: string;
|
|
62
|
+
/** Sign one CACAO with exactly `permissions` (one wallet approval) and import it into the Node. */
|
|
63
|
+
createOwnerDelegation(params: CreateOwnerDelegationParams): Promise<OwnerDelegationReceipt>;
|
|
64
|
+
}
|
|
65
|
+
interface ShareRootOptions {
|
|
66
|
+
readonly kind?: ShareRootKind;
|
|
67
|
+
/**
|
|
68
|
+
* Feature flag `shareRootPolicyRoots`, off by default. A root gains `:share`
|
|
69
|
+
* decrypt, and can sign policy roots through {@link ShareRoot.policyRootSigner},
|
|
70
|
+
* only while this is on and the root's Node advertises owner-authority
|
|
71
|
+
* mode `enforce`.
|
|
72
|
+
*/
|
|
73
|
+
readonly shareRootPolicyRoots?: boolean;
|
|
74
|
+
/** Defaults to {@link defaultPolicyOwnerModeProbe}. */
|
|
75
|
+
readonly policyOwnerModeProbe?: PolicyOwnerModeProbe;
|
|
76
|
+
readonly now?: () => number;
|
|
77
|
+
}
|
|
78
|
+
/** Persistable root metadata. Holds no key material: the key lives in its own store. */
|
|
79
|
+
interface ShareRootRecord {
|
|
80
|
+
readonly version: 1;
|
|
81
|
+
readonly kind: ShareRootKind;
|
|
82
|
+
readonly scope: ShareRootScope;
|
|
83
|
+
/** The Node the root was created against; its advertised mode gates policy signing. */
|
|
84
|
+
readonly nodeOrigin: string;
|
|
85
|
+
readonly cid: string;
|
|
86
|
+
/** Base64url of the exact owner-signed CACAO bytes. */
|
|
87
|
+
readonly authorization: string;
|
|
88
|
+
readonly spaceId: string;
|
|
89
|
+
readonly ownerDid: string;
|
|
90
|
+
readonly keyDid: string;
|
|
91
|
+
readonly expiresAt: string;
|
|
92
|
+
}
|
|
93
|
+
interface ShareRootLink {
|
|
94
|
+
readonly rootCid: string;
|
|
95
|
+
readonly linkDid: string;
|
|
96
|
+
readonly path: string;
|
|
97
|
+
readonly expiresAt: Date;
|
|
98
|
+
/** Compact UCAN for `POST /delegate`, then the link's bearer token. */
|
|
99
|
+
readonly delegation: CompactUcanAuthorization;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Policy/v3 owner signing for a `kv+share-decrypt` root. Shaped like
|
|
103
|
+
* `AddressedPublishAuthority` without `registerPolicy`. Every call re-checks
|
|
104
|
+
* the whole gate (flag, the Node's advertised mode within the probe TTL, root
|
|
105
|
+
* live, key present), so a signer kept past a mode change stops working.
|
|
106
|
+
*/
|
|
107
|
+
interface ShareRootPolicySigner {
|
|
108
|
+
/** The share key DID: the `ownerDid` of the policy roots. */
|
|
109
|
+
readonly ownerDid: string;
|
|
110
|
+
readonly rootCid: string;
|
|
111
|
+
/** Interim rule: no policy root may outlive the share root. */
|
|
112
|
+
readonly notAfter: Date;
|
|
113
|
+
/** Build and sign one proofless policy root; its expiry must be within `notAfter` and 31 days. */
|
|
114
|
+
createOwnerRoot(input: AddressedOwnerRootInput): Promise<AddressedOwnerRootReceipt>;
|
|
115
|
+
/** Sign a 32-byte digest (policy or envelope); nothing else. */
|
|
116
|
+
sign(digest: Uint8Array): Promise<Uint8Array>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The single adapter over the Node's advertisement. Takes the `features`
|
|
120
|
+
* list of `GET /info` and returns `"enforce"` only for the marker plus the
|
|
121
|
+
* `-enforce` mode and no `-record`; `"record"` for the marker plus
|
|
122
|
+
* `-record` only; `undefined` for anything else (no marker, as on every
|
|
123
|
+
* Node up to 1.21.0, both modes, or a malformed list). Only `"enforce"`
|
|
124
|
+
* enables policy-capable roots.
|
|
125
|
+
*/
|
|
126
|
+
declare function readPolicyOwnerAuthorityMode(features: unknown): "enforce" | "record" | undefined;
|
|
127
|
+
/** Per-Node cache of "does this Node enforce owner-authority expiry". */
|
|
128
|
+
interface PolicyOwnerModeProbe {
|
|
129
|
+
/** True only when the Node currently advertises `enforce`. Never throws. */
|
|
130
|
+
isEnforced(nodeOrigin: string): Promise<boolean>;
|
|
131
|
+
/**
|
|
132
|
+
* Record the `features` a sign-in just read from `GET /info`
|
|
133
|
+
* (`NodeInfo.features`), so each sign-in refreshes the answer without a
|
|
134
|
+
* second fetch.
|
|
135
|
+
*/
|
|
136
|
+
observe(nodeOrigin: string, features: readonly string[]): void;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Keep each Node's answer in memory for `ttlMs` (default and ceiling 5
|
|
140
|
+
* minutes), then read `GET /info` again, so a Node that stops advertising
|
|
141
|
+
* `enforce` turns the gate off within one TTL. Only `https:` origins (and
|
|
142
|
+
* `http:` on loopback) are probed. A failure, a non-JSON or oversized
|
|
143
|
+
* (64 KiB) answer, or a malformed list counts as not enforcing and is cached
|
|
144
|
+
* for the same TTL.
|
|
145
|
+
*/
|
|
146
|
+
declare function createPolicyOwnerModeProbe(options?: {
|
|
147
|
+
readonly fetch?: (input: URL, init: RequestInit) => Promise<Response>;
|
|
148
|
+
readonly ttlMs?: number;
|
|
149
|
+
readonly now?: () => number;
|
|
150
|
+
}): PolicyOwnerModeProbe;
|
|
151
|
+
/** Process-wide default; sign-in code should feed it `NodeInfo.features` through `observe`. */
|
|
152
|
+
declare const defaultPolicyOwnerModeProbe: PolicyOwnerModeProbe;
|
|
153
|
+
/**
|
|
154
|
+
* A wallet-signed, read-only root delegated to one non-extractable share key,
|
|
155
|
+
* so shares outlive the owner's login session (TC-1423 D3, option B').
|
|
156
|
+
*
|
|
157
|
+
* - Scope: `kv/get` + `kv/metadata` on the share prefix. `:share` decrypt is
|
|
158
|
+
* added (scope `kv+share-decrypt`) only when the root is created while
|
|
159
|
+
* `shareRootPolicyRoots` is on and its Node advertises owner-authority mode
|
|
160
|
+
* `enforce`; a `kv` root holds no decrypt, so the Node refuses any Policy/v3
|
|
161
|
+
* registration it signs. Never put, del, list, `capabilities/read`,
|
|
162
|
+
* `network.create` or `:default`.
|
|
163
|
+
* - Created only through `createOwnerDelegation({ permissions })`; the signed
|
|
164
|
+
* bytes are decoded and checked here.
|
|
165
|
+
* - Lifetime: at most 37 days (`agent`: 30). One key per root.
|
|
166
|
+
* - Key custody: `create` generates the non-extractable key itself and never
|
|
167
|
+
* exposes it; `clear()` drops the only handle. Browser persistence of a
|
|
168
|
+
* share key requires the composer to be on its own origin first (REVIEW-D3
|
|
169
|
+
* V2-2); this package provides none. CLI profiles may keep a key in a 0600
|
|
170
|
+
* file and rebuild with `restore`.
|
|
171
|
+
* - The client flag and `policyRootSigner` gate only this API: whoever holds
|
|
172
|
+
* the key can sign through other APIs. What bounds that is the scope of the
|
|
173
|
+
* root (no decrypt before `enforce`) and the Node.
|
|
174
|
+
*/
|
|
175
|
+
declare class ShareRoot {
|
|
176
|
+
#private;
|
|
177
|
+
readonly kind: ShareRootKind;
|
|
178
|
+
readonly scope: ShareRootScope;
|
|
179
|
+
readonly nodeOrigin: string;
|
|
180
|
+
readonly cid: string;
|
|
181
|
+
readonly ownerDid: string;
|
|
182
|
+
readonly spaceId: string;
|
|
183
|
+
readonly keyDid: string;
|
|
184
|
+
readonly issuedAt: Date;
|
|
185
|
+
readonly expiresAt: Date;
|
|
186
|
+
private constructor();
|
|
187
|
+
/**
|
|
188
|
+
* Ask the owner for a new root (one approval) for a fresh share key. The
|
|
189
|
+
* scope is chosen now: `kv+share-decrypt` only for a `share` root with the
|
|
190
|
+
* flag on and `nodeOrigin` advertising `enforce`, otherwise `kv`. All request
|
|
191
|
+
* checks run before anything is signed. If the signed result is rejected,
|
|
192
|
+
* the key is cleared and the error carries the imported `rootCid` (and
|
|
193
|
+
* `mustRevoke` when the root may be wider than requested).
|
|
194
|
+
*
|
|
195
|
+
* `keyFactory` defaults to a fresh non-extractable WebCrypto key that only
|
|
196
|
+
* this root holds. A custom factory must not persist the key before
|
|
197
|
+
* `create` resolves.
|
|
198
|
+
*/
|
|
199
|
+
static create(input: {
|
|
200
|
+
readonly owner: ShareRootOwnerAuthority;
|
|
201
|
+
readonly spaceId: string;
|
|
202
|
+
readonly nodeOrigin: string;
|
|
203
|
+
readonly expiresAt: Date;
|
|
204
|
+
readonly keyFactory?: () => Promise<DelegatedShareKey>;
|
|
205
|
+
readonly options?: ShareRootOptions;
|
|
206
|
+
}): Promise<ShareRoot>;
|
|
207
|
+
/** Rebuild a stored root with its key (e.g. a CLI 0600 key file); the signed bytes are checked again. */
|
|
208
|
+
static restore(input: {
|
|
209
|
+
readonly record: ShareRootRecord;
|
|
210
|
+
readonly key: DelegatedShareKey;
|
|
211
|
+
readonly options?: ShareRootOptions;
|
|
212
|
+
}): Promise<ShareRoot>;
|
|
213
|
+
/** The `Authorization` value the Node knows this root by (base64url CACAO). */
|
|
214
|
+
get authorization(): string;
|
|
215
|
+
/** True when the root holds `:share` decrypt and may act as a policy owner (still gated per call). */
|
|
216
|
+
get policyCapable(): boolean;
|
|
217
|
+
toRecord(): ShareRootRecord;
|
|
218
|
+
/** True while the root is live, its key is held, and it lasts at least until `expiresAt`. Revocation is not visible here. */
|
|
219
|
+
covers(expiresAt: Date, now?: number): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Sign a bearer link: `kv/get` on one exact key under the prefix, to the
|
|
222
|
+
* link's own key, with this root as its only proof. It never outlives the
|
|
223
|
+
* root (the Node refuses that too) or 30 days. Zero approvals.
|
|
224
|
+
*/
|
|
225
|
+
signBearerLink(input: {
|
|
226
|
+
readonly linkDid: string;
|
|
227
|
+
readonly path: string;
|
|
228
|
+
readonly expiresAt: Date;
|
|
229
|
+
}): Promise<ShareRootLink>;
|
|
230
|
+
/**
|
|
231
|
+
* The only ShareRoot API that signs Policy/v3 (email/domain) owner material.
|
|
232
|
+
* Needs a `kv+share-decrypt` root, the `shareRootPolicyRoots` flag, a live
|
|
233
|
+
* root and key, and the root's Node advertising `enforce`; the returned
|
|
234
|
+
* signer re-checks all of it on every call. Until then addressed shares use
|
|
235
|
+
* per-share owner grants. Agent roots are bearer-only.
|
|
236
|
+
*/
|
|
237
|
+
policyRootSigner(): Promise<ShareRootPolicySigner>;
|
|
238
|
+
/** Drop this root's key handle. It does not revoke the root: only the owner does that. */
|
|
239
|
+
clear(): void;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Re-root only when needed. `purpose: "bearer"` (default) keeps any live root
|
|
243
|
+
* of the same kind, space and Node that covers `expiresAt`. `purpose:
|
|
244
|
+
* "policy"` additionally needs a `kv+share-decrypt` root: it throws unless the
|
|
245
|
+
* flag is on and the Node enforces, and re-roots when the current root is
|
|
246
|
+
* `kv`; it never hands back a `kv` root. A re-root costs one approval, uses a
|
|
247
|
+
* new key and requests the kind's cap minus {@link SHARE_ROOT_REQUEST_MARGIN_MS}.
|
|
248
|
+
*
|
|
249
|
+
* - Links and policies signed under the old root stay valid until their own
|
|
250
|
+
* expiry; keep the old root (and its key) to revoke them (REVIEW-D3 V2-5).
|
|
251
|
+
* - Concurrent calls each re-root (two approvals, and one orphaned root if
|
|
252
|
+
* both write the same store slot): callers serialize, e.g. with a lock.
|
|
253
|
+
* - A revoked root still "covers" here: re-root when `/delegate` answers
|
|
254
|
+
* `delegation-revoked`.
|
|
255
|
+
*/
|
|
256
|
+
declare function ensureShareRoot(input: {
|
|
257
|
+
readonly current?: ShareRoot;
|
|
258
|
+
readonly expiresAt: Date;
|
|
259
|
+
readonly purpose?: "bearer" | "policy";
|
|
260
|
+
readonly owner: ShareRootOwnerAuthority;
|
|
261
|
+
readonly spaceId: string;
|
|
262
|
+
readonly nodeOrigin: string;
|
|
263
|
+
readonly keyFactory?: () => Promise<DelegatedShareKey>;
|
|
264
|
+
readonly options?: ShareRootOptions;
|
|
265
|
+
}): Promise<{
|
|
266
|
+
readonly root: ShareRoot;
|
|
267
|
+
readonly rerooted: boolean;
|
|
268
|
+
}>;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Link signing outside WASM. The SDK's WASM delegation builder signs with a
|
|
272
|
+
* raw session JWK; a share key must never exist as raw bytes in a browser.
|
|
273
|
+
* These helpers build the same compact UCAN the Node accepts and hand only
|
|
274
|
+
* the exact signing input to the key's `sign`, so the key can be a
|
|
275
|
+
* non-extractable WebCrypto Ed25519 handle (browser: kept in IndexedDB;
|
|
276
|
+
* Node/CLI: imported non-extractable from its own 0600 key file).
|
|
277
|
+
*/
|
|
278
|
+
type ShareKeySigner = Pick<DelegatedShareKey, "did" | "sign">;
|
|
279
|
+
/**
|
|
280
|
+
* Throw unless `key` is a non-extractable Ed25519 WebCrypto private key whose
|
|
281
|
+
* public half is `key.did`. The binding is checked by signing a fixed probe
|
|
282
|
+
* and verifying it against the DID, so a root is never requested for a key
|
|
283
|
+
* this process cannot actually use.
|
|
284
|
+
*/
|
|
285
|
+
declare function assertNonExtractableShareKey(key: DelegatedShareKey): Promise<void>;
|
|
286
|
+
interface ShareKeyDelegationInput {
|
|
287
|
+
readonly key: ShareKeySigner;
|
|
288
|
+
readonly audienceDid: string;
|
|
289
|
+
/** Resource -> ability -> caveats; the caller bounds it (see `ShareRoot.signBearerLink`). */
|
|
290
|
+
readonly attenuation: Readonly<Record<string, Readonly<Record<string, readonly Readonly<Record<string, unknown>>[]>>>>;
|
|
291
|
+
readonly proofs: readonly string[];
|
|
292
|
+
/** Exactly one fact object, as the Node's compact UCAN requires; defaults to `{}`. */
|
|
293
|
+
readonly facts?: readonly [Readonly<Record<string, unknown>>];
|
|
294
|
+
/** Unix seconds. */
|
|
295
|
+
readonly notBefore: number;
|
|
296
|
+
/** Unix seconds. */
|
|
297
|
+
readonly expiresAt: number;
|
|
298
|
+
readonly nonce?: string;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Sign a compact UCAN delegation (JCS header and payload, EdDSA) with a share
|
|
302
|
+
* key. Unlike share-envelope's invocation signer it is not limited to 60 s:
|
|
303
|
+
* lifetime limits belong to the caller. The result is re-verified (signature,
|
|
304
|
+
* issuer binding, canonical JSON) before it is returned.
|
|
305
|
+
*/
|
|
306
|
+
declare function signShareKeyDelegation(input: ShareKeyDelegationInput): Promise<CompactUcanAuthorization>;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* The fields of an owner-signed SIWE CACAO that bound its authority. Read
|
|
310
|
+
* from the exact bytes the Node imported; nothing here is taken from the
|
|
311
|
+
* SDK's own echo of the request.
|
|
312
|
+
*/
|
|
313
|
+
interface DecodedOwnerRootCacao {
|
|
314
|
+
/** CIDv1 (raw, BLAKE3) of the exact CACAO bytes, as the Node computes it. */
|
|
315
|
+
readonly cid: string;
|
|
316
|
+
readonly issuer: string;
|
|
317
|
+
readonly audience: string;
|
|
318
|
+
readonly issuedAt: string;
|
|
319
|
+
readonly expiresAt?: string;
|
|
320
|
+
readonly notBefore?: string;
|
|
321
|
+
/** Every SIWE resource, in signed order. */
|
|
322
|
+
readonly resources: readonly string[];
|
|
323
|
+
/** The ReCap `att` of the last resource; null-prototype maps. */
|
|
324
|
+
readonly attenuation: Readonly<Record<string, Readonly<Record<string, readonly unknown[]>>>>;
|
|
325
|
+
/** The ReCap `prf` list (parent capabilities); a root has none. */
|
|
326
|
+
readonly reCapProofs: readonly unknown[];
|
|
327
|
+
}
|
|
328
|
+
/** CIDv1 (raw, BLAKE3) of exact CACAO bytes, as the Node computes a delegation CID. */
|
|
329
|
+
declare function ownerRootCacaoCid(bytes: Uint8Array): string;
|
|
330
|
+
/**
|
|
331
|
+
* Decode the exact bytes of an owner-signed SIWE CACAO. Checks size, CBOR
|
|
332
|
+
* strictness, the envelope shape (eip4361 payload, 65-byte eip191 signature)
|
|
333
|
+
* and, when given, that the bytes hash to `expectedCid`.
|
|
334
|
+
*
|
|
335
|
+
* It does not verify the wallet signature: the Node verifies it when it
|
|
336
|
+
* imports the delegation and is the authority on it. This decoder exists so
|
|
337
|
+
* a caller can check what was signed (scope, audience, lifetime) instead of
|
|
338
|
+
* trusting the request it made.
|
|
339
|
+
*/
|
|
340
|
+
declare function decodeOwnerRootCacao(bytes: Uint8Array, expectedCid?: string): DecodedOwnerRootCacao;
|
|
341
|
+
|
|
342
|
+
export { AGENT_SHARE_ROOT_MAX_LIFETIME_MS, type DecodedOwnerRootCacao, POLICY_OWNER_AUTHORITY_FEATURES, POLICY_OWNER_AUTHORITY_PROBE_TTL_MS, type PolicyOwnerModeProbe, SHARE_ROOT_CLOCK_SKEW_MS, SHARE_ROOT_LINK_MAX_LIFETIME_MS, SHARE_ROOT_MAX_LIFETIME_MS, SHARE_ROOT_PREFIX, SHARE_ROOT_REQUEST_MARGIN_MS, type ShareKeyDelegationInput, type ShareKeySigner, ShareRoot, ShareRootError, type ShareRootErrorCode, type ShareRootErrorDetails, type ShareRootKind, type ShareRootLink, type ShareRootOptions, type ShareRootOwnerAuthority, type ShareRootPolicySigner, type ShareRootRecord, type ShareRootScope, assertNonExtractableShareKey, createPolicyOwnerModeProbe, decodeOwnerRootCacao, defaultPolicyOwnerModeProbe, ensureShareRoot, ownerRootCacaoCid, readPolicyOwnerAuthorityMode, signShareKeyDelegation };
|