@tinycloud/sdk-core 2.1.0-beta.0 → 2.1.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/index.d.cts CHANGED
@@ -179,6 +179,359 @@ interface IENSResolver {
179
179
  resolveAvatar?(ensName: string): Promise<string | null>;
180
180
  }
181
181
 
182
+ /**
183
+ * TinyCloud App Manifest
184
+ *
185
+ * A declarative description of an app's identity and the capabilities it
186
+ * needs. The manifest drives the SIWE recap at sign-in time, enabling a
187
+ * single wallet prompt that covers the app's own permissions plus any
188
+ * pre-declared delegations.
189
+ *
190
+ * The SDK does NOT fetch external manifests. Apps compose their own manifest
191
+ * (optionally including backend or agent addenda) before handing it to the
192
+ * SDK.
193
+ *
194
+ * Canonical spec: `.claude/specs/manifest.md`.
195
+ *
196
+ * @packageDocumentation
197
+ */
198
+ /**
199
+ * A single permission entry inside a manifest. This is the shape apps write
200
+ * in their `manifest.json` and the shape we compare against when performing
201
+ * the capability-subset derivability check in the delegation flow.
202
+ *
203
+ * `service` uses the long form (e.g. `"tinycloud.kv"`, `"tinycloud.sql"`)
204
+ * which matches the ability-namespace half of the full action URN.
205
+ */
206
+ interface PermissionEntry {
207
+ /** Service namespace, e.g. "tinycloud.kv", "tinycloud.sql", "tinycloud.duckdb", "tinycloud.capabilities". */
208
+ service: string;
209
+ /** "default" for the user's personal space, or a specific space id. */
210
+ space: string;
211
+ /**
212
+ * Service-specific path.
213
+ * - tinycloud.kv: hierarchical prefix. "/" = all, "foo/" = prefix match, "foo" = exact key
214
+ * - tinycloud.sql: database name/file (e.g. "data.sqlite") or "/" for all
215
+ * - tinycloud.duckdb: database name/file
216
+ * - tinycloud.capabilities: capability key URI or "/" for all
217
+ */
218
+ path: string;
219
+ /**
220
+ * Short action names (e.g. "get", "put", "read", "ddl"). The SDK expands
221
+ * these to full URNs (e.g. `tinycloud.kv/get`) during resolution.
222
+ * Already-expanded URNs are passed through unchanged.
223
+ */
224
+ actions: string[];
225
+ /** When true, the manifest prefix is NOT prepended to `path`. Default false. */
226
+ skipPrefix?: boolean;
227
+ /** Per-entry expiry override, ms-format. */
228
+ expiry?: string;
229
+ }
230
+ /**
231
+ * A pre-declared delegation that will be included in the main SIWE recap as
232
+ * an additional audience.
233
+ */
234
+ interface ManifestDelegation {
235
+ /** DID of the delegate (e.g. a backend's wallet DID). */
236
+ to: string;
237
+ /** Informational display name. Optional. */
238
+ name?: string;
239
+ /** Expiry override for this delegation, ms-format. Optional. */
240
+ expiry?: string;
241
+ /**
242
+ * Permissions to delegate. Same shape as the top-level `permissions`, and
243
+ * the manifest prefix is inherited identically (unless `skipPrefix: true`).
244
+ */
245
+ permissions: PermissionEntry[];
246
+ }
247
+ /**
248
+ * The valid values for `Manifest.defaults`.
249
+ *
250
+ * - `false` → no auto-included permissions
251
+ * - `true` → standard tier (KV + SQL read/write + capabilities:read)
252
+ * - `"admin"` → standard + SQL ddl + capabilities:admin
253
+ * - `"all"` → everything the SDK supports (including DuckDB)
254
+ *
255
+ * Unknown string values silently fall back to `true`. Values are normalized
256
+ * (lowercase + trim) before matching.
257
+ */
258
+ type ManifestDefaults = boolean | "admin" | "all";
259
+ /**
260
+ * The raw manifest shape an app declares. See `.claude/specs/manifest.md`.
261
+ */
262
+ interface Manifest {
263
+ /** Schema version. Optional, defaults to 1. */
264
+ version?: number;
265
+ /** Bundle identifier — reverse DNS. Required. */
266
+ id: string;
267
+ /** Display name. Required. */
268
+ name: string;
269
+ /** One-line description. Optional. */
270
+ description?: string;
271
+ /** URL to app icon. Optional. */
272
+ icon?: string;
273
+ /** App version string. Optional. */
274
+ appVersion?: string;
275
+ /** Default expiry for permissions. ms-format ("30d", "2h", "1y"). Default "30d". */
276
+ expiry?: string;
277
+ /**
278
+ * Path prefix auto-prepended to permission paths. Optional, defaults to
279
+ * `id`. Set to `""` to disable entirely. Individual permissions can opt
280
+ * out with `skipPrefix: true`.
281
+ */
282
+ prefix?: string;
283
+ /**
284
+ * Default permission set to auto-include. Optional, defaults to `true`.
285
+ * See {@link ManifestDefaults}.
286
+ */
287
+ defaults?: ManifestDefaults | string;
288
+ /** Whether to include the public-space companion delegation. Default `true`. */
289
+ includePublicSpace?: boolean;
290
+ /**
291
+ * Additional permissions beyond the defaults. Use for cross-space access,
292
+ * DuckDB (opt-in), or `skipPrefix: true` entries.
293
+ */
294
+ permissions?: PermissionEntry[];
295
+ /** Pre-delegations to other DIDs at sign-in. */
296
+ delegations?: ManifestDelegation[];
297
+ }
298
+ /**
299
+ * A resolved permission entry with fully-expanded paths and action URNs.
300
+ * This is the shape the delegation flow compares against parsed recap
301
+ * capabilities, and the shape the session-key delegation path actually uses.
302
+ */
303
+ interface ResourceCapability {
304
+ /** Long-form service, e.g. "tinycloud.kv". */
305
+ service: string;
306
+ /** Space id — "default" stays as-is here; the caller resolves it to a full SpaceId at sign-in time. */
307
+ space: string;
308
+ /** Path with the manifest prefix applied (or skipped per `skipPrefix`). */
309
+ path: string;
310
+ /** Full-URN actions, e.g. ["tinycloud.kv/get", "tinycloud.kv/put"]. */
311
+ actions: string[];
312
+ /** Per-entry expiry override in milliseconds. */
313
+ expiryMs?: number;
314
+ }
315
+ /**
316
+ * A resolved delegation entry with fully-expanded permissions.
317
+ */
318
+ interface ResolvedDelegate {
319
+ /** DID of the delegate. */
320
+ did: string;
321
+ /** Informational display name. Optional. */
322
+ name?: string;
323
+ /** Expiry in milliseconds (per-delegation > manifest default > 30 days). */
324
+ expiryMs: number;
325
+ /** Fully resolved permissions. */
326
+ permissions: ResourceCapability[];
327
+ }
328
+ /**
329
+ * The output of {@link resolveManifest}: a fully-expanded capability set
330
+ * ready to drive the SIWE recap.
331
+ */
332
+ interface ResolvedCapabilities {
333
+ /** Bundle identifier copied from manifest.id. */
334
+ id: string;
335
+ /** All session-key resources with paths fully resolved (prefix applied). */
336
+ resources: ResourceCapability[];
337
+ /** Default expiry for the session, in milliseconds. */
338
+ expiryMs: number;
339
+ /** Whether to include the public-space companion. */
340
+ includePublicSpace: boolean;
341
+ /** Additional delegate targets with resolved paths. */
342
+ additionalDelegates: ResolvedDelegate[];
343
+ }
344
+ /**
345
+ * Thrown when the manifest fails validation (missing id/name, bad expiry,
346
+ * empty actions on a permission, etc).
347
+ */
348
+ declare class ManifestValidationError extends Error {
349
+ constructor(message: string);
350
+ }
351
+ /**
352
+ * Default expiry when neither the manifest, delegation, nor permission
353
+ * specifies one. Spec: 30 days.
354
+ */
355
+ declare const DEFAULT_EXPIRY = "30d";
356
+ /**
357
+ * Default `defaults` value when the manifest omits it. Spec: standard tier.
358
+ */
359
+ declare const DEFAULT_DEFAULTS: ManifestDefaults;
360
+ /**
361
+ * Known services and their short-form (recap URI) names. The TinyCloud
362
+ * node encodes the recap resource URI with the short service name, while
363
+ * action URNs and manifest entries use the long `tinycloud.<short>` form.
364
+ * This table is the canonical bridge between the two.
365
+ */
366
+ declare const SERVICE_SHORT_TO_LONG: Readonly<Record<string, string>>;
367
+ /**
368
+ * Inverse of {@link SERVICE_SHORT_TO_LONG}.
369
+ */
370
+ declare const SERVICE_LONG_TO_SHORT: Readonly<Record<string, string>>;
371
+ /**
372
+ * Parse an ms-format duration string (e.g. "30d", "2h", "1y") into
373
+ * milliseconds.
374
+ *
375
+ * @throws {ManifestValidationError} on empty string, non-string input, or
376
+ * any input `ms()` cannot parse.
377
+ */
378
+ declare function parseExpiry(duration: string): number;
379
+ /**
380
+ * Expand a list of action short names (or already-expanded URNs) into full
381
+ * ability URNs of the form `<service>/<action>`.
382
+ *
383
+ * Examples:
384
+ * `expandActionShortNames("tinycloud.kv", ["get", "put"])`
385
+ * → `["tinycloud.kv/get", "tinycloud.kv/put"]`
386
+ * `expandActionShortNames("tinycloud.kv", ["tinycloud.kv/get"])`
387
+ * → `["tinycloud.kv/get"]` (passed through unchanged)
388
+ */
389
+ declare function expandActionShortNames(service: string, actions: readonly string[]): string[];
390
+ /**
391
+ * Apply the manifest prefix to a permission path per the spec rules.
392
+ *
393
+ * - `skipPrefix: true` → path is returned as-is
394
+ * - `prefix === ""` → path is returned as-is
395
+ * - path starts with "/" → `prefix + path` (e.g. "com.listen.app" + "/" → "com.listen.app/")
396
+ * - otherwise → `prefix + "/" + path` (e.g. "com.listen.app" + "data.sqlite" → "com.listen.app/data.sqlite")
397
+ */
398
+ declare function applyPrefix(prefix: string, path: string, skipPrefix: boolean): string;
399
+ /**
400
+ * Fetch and parse a manifest from a URL (browser) or file path (node).
401
+ * The runtime decides the fetch strategy via `globalThis.fetch`; this is
402
+ * platform-agnostic. Callers that want custom loading should JSON.parse a
403
+ * Manifest themselves and skip this helper.
404
+ *
405
+ * @throws if the fetch fails, the JSON is invalid, or the manifest fails
406
+ * validation.
407
+ */
408
+ declare function loadManifest(url: string): Promise<Manifest>;
409
+ /**
410
+ * Validate a manifest-shaped object and return it strongly-typed.
411
+ * Throws {@link ManifestValidationError} on any hard failure.
412
+ */
413
+ declare function validateManifest(input: unknown): Manifest;
414
+ /**
415
+ * Normalize a `defaults` value: lowercase + trim, then match against known
416
+ * tiers. Unknown string values silently fall back to `true` (standard).
417
+ * Boolean values pass through.
418
+ */
419
+ declare function normalizeDefaults(value: Manifest["defaults"] | undefined): ManifestDefaults;
420
+ /**
421
+ * Resolve a raw manifest into a {@link ResolvedCapabilities} object: expand
422
+ * shortform actions, apply the prefix, merge defaults, and compute effective
423
+ * expiries. Pure function — does no I/O.
424
+ *
425
+ * Resolution semantics (spec):
426
+ * - `prefix` defaults to `id`; set to `""` to disable prefix application entirely.
427
+ * - `defaults` defaults to `true` (standard tier); unknown string values fall back to `true`.
428
+ * - Per-entry expiry overrides per-delegation overrides manifest > `DEFAULT_EXPIRY`.
429
+ * - Default entries use `skipPrefix: false` so they inherit the manifest prefix.
430
+ * - Prefix inheritance applies identically to `permissions` and `delegations[*].permissions`.
431
+ */
432
+ declare function resolveManifest(input: Manifest): ResolvedCapabilities;
433
+
434
+ /**
435
+ * Capability subset checking and recap parsing.
436
+ *
437
+ * This module powers the capability-chain delegation flow. The key decision
438
+ * a `delegateTo` call has to make is: "are the requested capabilities a
439
+ * subset of what the current session already grants?"
440
+ *
441
+ * - If yes → issue the delegation via the session-key UCAN path (no wallet prompt).
442
+ * - If no → raise {@link PermissionNotInManifestError} so the caller can
443
+ * trigger an escalation flow via `requestPermissions`.
444
+ *
445
+ * Canonical spec: `.claude/specs/capability-chain.md`.
446
+ *
447
+ * @packageDocumentation
448
+ */
449
+
450
+ /**
451
+ * Thrown when a `delegateTo` call requests capabilities that the current
452
+ * session does not already grant. The caller can catch this and trigger
453
+ * `requestPermissions(missing)` to show an escalation modal.
454
+ */
455
+ declare class PermissionNotInManifestError extends Error {
456
+ readonly missing: PermissionEntry[];
457
+ readonly granted: PermissionEntry[];
458
+ constructor(missing: PermissionEntry[], granted: PermissionEntry[]);
459
+ }
460
+ /**
461
+ * Thrown when the current session has expired (or will expire within the
462
+ * safety margin). The caller should trigger a fresh sign-in.
463
+ */
464
+ declare class SessionExpiredError extends Error {
465
+ readonly expiredAt: Date;
466
+ constructor(expiredAt: Date);
467
+ }
468
+ interface SubsetCheckResult {
469
+ /** True when every requested entry is covered by a granted entry. */
470
+ subset: boolean;
471
+ /** Entries the granted set does not cover (empty when `subset` is true). */
472
+ missing: PermissionEntry[];
473
+ }
474
+ /**
475
+ * Check whether `requested` is a strict subset of `granted`.
476
+ *
477
+ * Matching rules for each `requested[i]`:
478
+ * - `service` matches exactly.
479
+ * - `space` matches exactly.
480
+ * - Path containment:
481
+ * - If `granted.path` ends with `/`, it covers any `requested.path` that
482
+ * starts with `granted.path`.
483
+ * - Otherwise, the paths must match exactly.
484
+ * - Action containment: every URN in `requested.actions` must appear in
485
+ * `granted.actions` (set subset).
486
+ *
487
+ * Any `requested` entry that does not find a matching `granted` entry is
488
+ * added to `missing` and the overall result is non-subset.
489
+ *
490
+ * Both sides are expected to be in the canonical long-form shape (service
491
+ * starts with `tinycloud.`, actions are full URNs). Use {@link parseRecapCapabilities}
492
+ * or `expandActionShortNames` to normalize inputs first.
493
+ */
494
+ declare function isCapabilitySubset(requested: readonly PermissionEntry[], granted: readonly PermissionEntry[]): SubsetCheckResult;
495
+ /**
496
+ * The raw shape returned from the WASM `parseRecapFromSiwe` export. The
497
+ * Rust layer encodes the service in the short form (e.g. `"kv"`) because
498
+ * that is what the SIWE recap resource URI actually contains. We normalize
499
+ * to the manifest long form (`"tinycloud.kv"`) in {@link parseRecapCapabilities}.
500
+ *
501
+ * @internal
502
+ */
503
+ interface WasmRecapEntry {
504
+ service: string;
505
+ space: string;
506
+ path: string;
507
+ actions: string[];
508
+ }
509
+ /**
510
+ * Signature of the WASM `parseRecapFromSiwe` export. Accepts the signed
511
+ * SIWE message string and returns an array of raw recap entries. Throws if
512
+ * the SIWE is malformed or the recap statement has been tampered.
513
+ *
514
+ * Exposed as an interface so the SDK can inject the web or node binding
515
+ * without `capabilities.ts` needing to know which.
516
+ */
517
+ type ParseRecapFromSiwe = (siweString: string) => WasmRecapEntry[];
518
+ /**
519
+ * Parse a signed SIWE message into an array of {@link PermissionEntry}
520
+ * objects in the canonical long-form manifest shape.
521
+ *
522
+ * This is a thin wrapper around the WASM `parseRecapFromSiwe` export that:
523
+ * 1. Normalizes short-form services (`"kv"`) to long-form (`"tinycloud.kv"`).
524
+ * 2. Returns entries in a deterministic order (sorted by space, then service,
525
+ * then path) so downstream equality checks are stable.
526
+ *
527
+ * Returns an empty array when the SIWE has no recap resource (plain auth
528
+ * SIWE); this matches the WASM function's behavior and the spec.
529
+ *
530
+ * @param parseWasm The WASM `parseRecapFromSiwe` binding.
531
+ * @param siwe The signed SIWE message string (exactly what `session.siwe` stores).
532
+ */
533
+ declare function parseRecapCapabilities(parseWasm: ParseRecapFromSiwe, siwe: string): PermissionEntry[];
534
+
182
535
  /**
183
536
  * WASM binding abstraction for TinyCloud SDK.
184
537
  *
@@ -210,6 +563,15 @@ interface IWasmBindings {
210
563
  makeSpaceId: (address: string, chainId: number, prefix: string) => string;
211
564
  /** Create a delegation */
212
565
  createDelegation: (...args: any[]) => any;
566
+ /**
567
+ * Parse the recap resource of a signed SIWE message into structured
568
+ * permission entries. Used by the capability-chain delegation flow to
569
+ * decide whether a requested delegation is derivable from the current
570
+ * session without a fresh wallet prompt.
571
+ *
572
+ * Returns an empty array when the SIWE has no recap resource.
573
+ */
574
+ parseRecapFromSiwe: (siweString: string) => WasmRecapEntry[];
213
575
  /** Generate a host SIWE message for space activation */
214
576
  generateHostSIWEMessage: (params: any) => string;
215
577
  /** Convert a signed SIWE message to delegation headers */
@@ -837,11 +1199,11 @@ declare const DelegationSchema: z.ZodObject<{
837
1199
  authHeader: z.ZodOptional<z.ZodString>;
838
1200
  }, "strip", z.ZodTypeAny, {
839
1201
  path: string;
1202
+ actions: string[];
1203
+ expiry: Date;
840
1204
  spaceId: string;
841
1205
  cid: string;
842
1206
  delegateDID: string;
843
- actions: string[];
844
- expiry: Date;
845
1207
  isRevoked: boolean;
846
1208
  createdAt?: Date | undefined;
847
1209
  delegatorDID?: string | undefined;
@@ -850,11 +1212,11 @@ declare const DelegationSchema: z.ZodObject<{
850
1212
  authHeader?: string | undefined;
851
1213
  }, {
852
1214
  path: string;
1215
+ actions: string[];
1216
+ expiry: Date;
853
1217
  spaceId: string;
854
1218
  cid: string;
855
1219
  delegateDID: string;
856
- actions: string[];
857
- expiry: Date;
858
1220
  isRevoked: boolean;
859
1221
  createdAt?: Date | undefined;
860
1222
  delegatorDID?: string | undefined;
@@ -995,11 +1357,11 @@ declare const CapabilityEntrySchema: z.ZodObject<{
995
1357
  authHeader: z.ZodOptional<z.ZodString>;
996
1358
  }, "strip", z.ZodTypeAny, {
997
1359
  path: string;
1360
+ actions: string[];
1361
+ expiry: Date;
998
1362
  spaceId: string;
999
1363
  cid: string;
1000
1364
  delegateDID: string;
1001
- actions: string[];
1002
- expiry: Date;
1003
1365
  isRevoked: boolean;
1004
1366
  createdAt?: Date | undefined;
1005
1367
  delegatorDID?: string | undefined;
@@ -1008,11 +1370,11 @@ declare const CapabilityEntrySchema: z.ZodObject<{
1008
1370
  authHeader?: string | undefined;
1009
1371
  }, {
1010
1372
  path: string;
1373
+ actions: string[];
1374
+ expiry: Date;
1011
1375
  spaceId: string;
1012
1376
  cid: string;
1013
1377
  delegateDID: string;
1014
- actions: string[];
1015
- expiry: Date;
1016
1378
  isRevoked: boolean;
1017
1379
  createdAt?: Date | undefined;
1018
1380
  delegatorDID?: string | undefined;
@@ -1044,11 +1406,11 @@ declare const CapabilityEntrySchema: z.ZodObject<{
1044
1406
  }[];
1045
1407
  delegation: {
1046
1408
  path: string;
1409
+ actions: string[];
1410
+ expiry: Date;
1047
1411
  spaceId: string;
1048
1412
  cid: string;
1049
1413
  delegateDID: string;
1050
- actions: string[];
1051
- expiry: Date;
1052
1414
  isRevoked: boolean;
1053
1415
  createdAt?: Date | undefined;
1054
1416
  delegatorDID?: string | undefined;
@@ -1081,11 +1443,11 @@ declare const CapabilityEntrySchema: z.ZodObject<{
1081
1443
  }[];
1082
1444
  delegation: {
1083
1445
  path: string;
1446
+ actions: string[];
1447
+ expiry: Date;
1084
1448
  spaceId: string;
1085
1449
  cid: string;
1086
1450
  delegateDID: string;
1087
- actions: string[];
1088
- expiry: Date;
1089
1451
  isRevoked: boolean;
1090
1452
  createdAt?: Date | undefined;
1091
1453
  delegatorDID?: string | undefined;
@@ -1128,10 +1490,10 @@ declare const DelegationRecordSchema: z.ZodObject<{
1128
1490
  parentCid: z.ZodOptional<z.ZodString>;
1129
1491
  }, "strip", z.ZodTypeAny, {
1130
1492
  path: string;
1493
+ actions: string[];
1131
1494
  spaceId: string;
1132
1495
  createdAt: Date;
1133
1496
  cid: string;
1134
- actions: string[];
1135
1497
  isRevoked: boolean;
1136
1498
  delegator: string;
1137
1499
  delegatee: string;
@@ -1141,10 +1503,10 @@ declare const DelegationRecordSchema: z.ZodObject<{
1141
1503
  keyId?: string | undefined;
1142
1504
  }, {
1143
1505
  path: string;
1506
+ actions: string[];
1144
1507
  spaceId: string;
1145
1508
  createdAt: Date;
1146
1509
  cid: string;
1147
- actions: string[];
1148
1510
  isRevoked: boolean;
1149
1511
  delegator: string;
1150
1512
  delegatee: string;
@@ -1172,15 +1534,15 @@ declare const CreateDelegationParamsSchema: z.ZodObject<{
1172
1534
  statement: z.ZodOptional<z.ZodString>;
1173
1535
  }, "strip", z.ZodTypeAny, {
1174
1536
  path: string;
1175
- delegateDID: string;
1176
1537
  actions: string[];
1538
+ delegateDID: string;
1177
1539
  statement?: string | undefined;
1178
1540
  expiry?: Date | undefined;
1179
1541
  disableSubDelegation?: boolean | undefined;
1180
1542
  }, {
1181
1543
  path: string;
1182
- delegateDID: string;
1183
1544
  actions: string[];
1545
+ delegateDID: string;
1184
1546
  statement?: string | undefined;
1185
1547
  expiry?: Date | undefined;
1186
1548
  disableSubDelegation?: boolean | undefined;
@@ -1216,11 +1578,11 @@ declare const DelegationChainSchema: z.ZodArray<z.ZodObject<{
1216
1578
  authHeader: z.ZodOptional<z.ZodString>;
1217
1579
  }, "strip", z.ZodTypeAny, {
1218
1580
  path: string;
1581
+ actions: string[];
1582
+ expiry: Date;
1219
1583
  spaceId: string;
1220
1584
  cid: string;
1221
1585
  delegateDID: string;
1222
- actions: string[];
1223
- expiry: Date;
1224
1586
  isRevoked: boolean;
1225
1587
  createdAt?: Date | undefined;
1226
1588
  delegatorDID?: string | undefined;
@@ -1229,11 +1591,11 @@ declare const DelegationChainSchema: z.ZodArray<z.ZodObject<{
1229
1591
  authHeader?: string | undefined;
1230
1592
  }, {
1231
1593
  path: string;
1594
+ actions: string[];
1595
+ expiry: Date;
1232
1596
  spaceId: string;
1233
1597
  cid: string;
1234
1598
  delegateDID: string;
1235
- actions: string[];
1236
- expiry: Date;
1237
1599
  isRevoked: boolean;
1238
1600
  createdAt?: Date | undefined;
1239
1601
  delegatorDID?: string | undefined;
@@ -1274,11 +1636,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1274
1636
  authHeader: z.ZodOptional<z.ZodString>;
1275
1637
  }, "strip", z.ZodTypeAny, {
1276
1638
  path: string;
1639
+ actions: string[];
1640
+ expiry: Date;
1277
1641
  spaceId: string;
1278
1642
  cid: string;
1279
1643
  delegateDID: string;
1280
- actions: string[];
1281
- expiry: Date;
1282
1644
  isRevoked: boolean;
1283
1645
  createdAt?: Date | undefined;
1284
1646
  delegatorDID?: string | undefined;
@@ -1287,11 +1649,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1287
1649
  authHeader?: string | undefined;
1288
1650
  }, {
1289
1651
  path: string;
1652
+ actions: string[];
1653
+ expiry: Date;
1290
1654
  spaceId: string;
1291
1655
  cid: string;
1292
1656
  delegateDID: string;
1293
- actions: string[];
1294
- expiry: Date;
1295
1657
  isRevoked: boolean;
1296
1658
  createdAt?: Date | undefined;
1297
1659
  delegatorDID?: string | undefined;
@@ -1327,11 +1689,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1327
1689
  authHeader: z.ZodOptional<z.ZodString>;
1328
1690
  }, "strip", z.ZodTypeAny, {
1329
1691
  path: string;
1692
+ actions: string[];
1693
+ expiry: Date;
1330
1694
  spaceId: string;
1331
1695
  cid: string;
1332
1696
  delegateDID: string;
1333
- actions: string[];
1334
- expiry: Date;
1335
1697
  isRevoked: boolean;
1336
1698
  createdAt?: Date | undefined;
1337
1699
  delegatorDID?: string | undefined;
@@ -1340,11 +1702,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1340
1702
  authHeader?: string | undefined;
1341
1703
  }, {
1342
1704
  path: string;
1705
+ actions: string[];
1706
+ expiry: Date;
1343
1707
  spaceId: string;
1344
1708
  cid: string;
1345
1709
  delegateDID: string;
1346
- actions: string[];
1347
- expiry: Date;
1348
1710
  isRevoked: boolean;
1349
1711
  createdAt?: Date | undefined;
1350
1712
  delegatorDID?: string | undefined;
@@ -1380,11 +1742,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1380
1742
  authHeader: z.ZodOptional<z.ZodString>;
1381
1743
  }, "strip", z.ZodTypeAny, {
1382
1744
  path: string;
1745
+ actions: string[];
1746
+ expiry: Date;
1383
1747
  spaceId: string;
1384
1748
  cid: string;
1385
1749
  delegateDID: string;
1386
- actions: string[];
1387
- expiry: Date;
1388
1750
  isRevoked: boolean;
1389
1751
  createdAt?: Date | undefined;
1390
1752
  delegatorDID?: string | undefined;
@@ -1393,11 +1755,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1393
1755
  authHeader?: string | undefined;
1394
1756
  }, {
1395
1757
  path: string;
1758
+ actions: string[];
1759
+ expiry: Date;
1396
1760
  spaceId: string;
1397
1761
  cid: string;
1398
1762
  delegateDID: string;
1399
- actions: string[];
1400
- expiry: Date;
1401
1763
  isRevoked: boolean;
1402
1764
  createdAt?: Date | undefined;
1403
1765
  delegatorDID?: string | undefined;
@@ -1408,11 +1770,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1408
1770
  }, "strip", z.ZodTypeAny, {
1409
1771
  root: {
1410
1772
  path: string;
1773
+ actions: string[];
1774
+ expiry: Date;
1411
1775
  spaceId: string;
1412
1776
  cid: string;
1413
1777
  delegateDID: string;
1414
- actions: string[];
1415
- expiry: Date;
1416
1778
  isRevoked: boolean;
1417
1779
  createdAt?: Date | undefined;
1418
1780
  delegatorDID?: string | undefined;
@@ -1422,11 +1784,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1422
1784
  };
1423
1785
  chain: {
1424
1786
  path: string;
1787
+ actions: string[];
1788
+ expiry: Date;
1425
1789
  spaceId: string;
1426
1790
  cid: string;
1427
1791
  delegateDID: string;
1428
- actions: string[];
1429
- expiry: Date;
1430
1792
  isRevoked: boolean;
1431
1793
  createdAt?: Date | undefined;
1432
1794
  delegatorDID?: string | undefined;
@@ -1436,11 +1798,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1436
1798
  }[];
1437
1799
  leaf: {
1438
1800
  path: string;
1801
+ actions: string[];
1802
+ expiry: Date;
1439
1803
  spaceId: string;
1440
1804
  cid: string;
1441
1805
  delegateDID: string;
1442
- actions: string[];
1443
- expiry: Date;
1444
1806
  isRevoked: boolean;
1445
1807
  createdAt?: Date | undefined;
1446
1808
  delegatorDID?: string | undefined;
@@ -1451,11 +1813,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1451
1813
  }, {
1452
1814
  root: {
1453
1815
  path: string;
1816
+ actions: string[];
1817
+ expiry: Date;
1454
1818
  spaceId: string;
1455
1819
  cid: string;
1456
1820
  delegateDID: string;
1457
- actions: string[];
1458
- expiry: Date;
1459
1821
  isRevoked: boolean;
1460
1822
  createdAt?: Date | undefined;
1461
1823
  delegatorDID?: string | undefined;
@@ -1465,11 +1827,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1465
1827
  };
1466
1828
  chain: {
1467
1829
  path: string;
1830
+ actions: string[];
1831
+ expiry: Date;
1468
1832
  spaceId: string;
1469
1833
  cid: string;
1470
1834
  delegateDID: string;
1471
- actions: string[];
1472
- expiry: Date;
1473
1835
  isRevoked: boolean;
1474
1836
  createdAt?: Date | undefined;
1475
1837
  delegatorDID?: string | undefined;
@@ -1479,11 +1841,11 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1479
1841
  }[];
1480
1842
  leaf: {
1481
1843
  path: string;
1844
+ actions: string[];
1845
+ expiry: Date;
1482
1846
  spaceId: string;
1483
1847
  cid: string;
1484
1848
  delegateDID: string;
1485
- actions: string[];
1486
- expiry: Date;
1487
1849
  isRevoked: boolean;
1488
1850
  createdAt?: Date | undefined;
1489
1851
  delegatorDID?: string | undefined;
@@ -1525,7 +1887,7 @@ declare const DelegationFiltersSchema: z.ZodObject<{
1525
1887
  actions?: string[] | undefined;
1526
1888
  delegator?: string | undefined;
1527
1889
  delegatee?: string | undefined;
1528
- direction?: "received" | "granted" | "all" | undefined;
1890
+ direction?: "received" | "all" | "granted" | undefined;
1529
1891
  includeRevoked?: boolean | undefined;
1530
1892
  validAt?: Date | undefined;
1531
1893
  limit?: number | undefined;
@@ -1535,7 +1897,7 @@ declare const DelegationFiltersSchema: z.ZodObject<{
1535
1897
  actions?: string[] | undefined;
1536
1898
  delegator?: string | undefined;
1537
1899
  delegatee?: string | undefined;
1538
- direction?: "received" | "granted" | "all" | undefined;
1900
+ direction?: "received" | "all" | "granted" | undefined;
1539
1901
  includeRevoked?: boolean | undefined;
1540
1902
  validAt?: Date | undefined;
1541
1903
  limit?: number | undefined;
@@ -1620,11 +1982,11 @@ declare const ShareLinkSchema: z.ZodObject<{
1620
1982
  authHeader: z.ZodOptional<z.ZodString>;
1621
1983
  }, "strip", z.ZodTypeAny, {
1622
1984
  path: string;
1985
+ actions: string[];
1986
+ expiry: Date;
1623
1987
  spaceId: string;
1624
1988
  cid: string;
1625
1989
  delegateDID: string;
1626
- actions: string[];
1627
- expiry: Date;
1628
1990
  isRevoked: boolean;
1629
1991
  createdAt?: Date | undefined;
1630
1992
  delegatorDID?: string | undefined;
@@ -1633,11 +1995,11 @@ declare const ShareLinkSchema: z.ZodObject<{
1633
1995
  authHeader?: string | undefined;
1634
1996
  }, {
1635
1997
  path: string;
1998
+ actions: string[];
1999
+ expiry: Date;
1636
2000
  spaceId: string;
1637
2001
  cid: string;
1638
2002
  delegateDID: string;
1639
- actions: string[];
1640
- expiry: Date;
1641
2003
  isRevoked: boolean;
1642
2004
  createdAt?: Date | undefined;
1643
2005
  delegatorDID?: string | undefined;
@@ -1655,11 +2017,11 @@ declare const ShareLinkSchema: z.ZodObject<{
1655
2017
  url: string;
1656
2018
  delegation: {
1657
2019
  path: string;
2020
+ actions: string[];
2021
+ expiry: Date;
1658
2022
  spaceId: string;
1659
2023
  cid: string;
1660
2024
  delegateDID: string;
1661
- actions: string[];
1662
- expiry: Date;
1663
2025
  isRevoked: boolean;
1664
2026
  createdAt?: Date | undefined;
1665
2027
  delegatorDID?: string | undefined;
@@ -1675,11 +2037,11 @@ declare const ShareLinkSchema: z.ZodObject<{
1675
2037
  url: string;
1676
2038
  delegation: {
1677
2039
  path: string;
2040
+ actions: string[];
2041
+ expiry: Date;
1678
2042
  spaceId: string;
1679
2043
  cid: string;
1680
2044
  delegateDID: string;
1681
- actions: string[];
1682
- expiry: Date;
1683
2045
  isRevoked: boolean;
1684
2046
  createdAt?: Date | undefined;
1685
2047
  delegatorDID?: string | undefined;
@@ -1848,17 +2210,17 @@ declare const CreateDelegationWasmParamsSchema: z.ZodObject<{
1848
2210
  notBeforeSecs: z.ZodOptional<z.ZodNumber>;
1849
2211
  }, "strip", z.ZodTypeAny, {
1850
2212
  path: string;
2213
+ actions: string[];
1851
2214
  spaceId: string;
1852
2215
  session: ServiceSession;
1853
2216
  delegateDID: string;
1854
- actions: string[];
1855
2217
  expirationSecs: number;
1856
2218
  notBeforeSecs?: number | undefined;
1857
2219
  }, {
1858
2220
  path: string;
2221
+ actions: string[];
1859
2222
  spaceId: string;
1860
2223
  delegateDID: string;
1861
- actions: string[];
1862
2224
  expirationSecs: number;
1863
2225
  session?: unknown;
1864
2226
  notBeforeSecs?: number | undefined;
@@ -1882,18 +2244,18 @@ declare const CreateDelegationWasmResultSchema: z.ZodObject<{
1882
2244
  expiry: z.ZodDate;
1883
2245
  }, "strip", z.ZodTypeAny, {
1884
2246
  path: string;
2247
+ actions: string[];
2248
+ expiry: Date;
1885
2249
  delegation: string;
1886
2250
  cid: string;
1887
2251
  delegateDID: string;
1888
- actions: string[];
1889
- expiry: Date;
1890
2252
  }, {
1891
2253
  path: string;
2254
+ actions: string[];
2255
+ expiry: Date;
1892
2256
  delegation: string;
1893
2257
  cid: string;
1894
2258
  delegateDID: string;
1895
- actions: string[];
1896
- expiry: Date;
1897
2259
  }>;
1898
2260
  type CreateDelegationWasmResult = z.infer<typeof CreateDelegationWasmResultSchema>;
1899
2261
 
@@ -3875,4 +4237,4 @@ interface NodeInfo {
3875
4237
  }
3876
4238
  declare function checkNodeInfo(host: string, sdkProtocol: number, fetchFn?: typeof globalThis.fetch): Promise<NodeInfo>;
3877
4239
 
3878
- export { AutoApproveSpaceCreationHandler, type AutoRejectStrategy, type AutoSignStrategy, type Bytes, type CallbackStrategy, type CapabilityEntry, CapabilityKeyRegistry, type CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, type ClientSession, ClientSessionSchema, type CreateDelegationFunction, type CreateDelegationParams, type CreateDelegationWasmParams, type CreateDelegationWasmResult, type Delegation, type DelegationApiResponse, type DelegationChain, type DelegationChainV2, type DelegationDirection, type DelegationError, type DelegationErrorCode, DelegationErrorCodes, type DelegationFilters, DelegationManager, type DelegationManagerConfig, type DelegationRecord, type Result as DelegationResult, type EncodedShareData, type EnsData, EnsDataSchema, type EventEmitterStrategy, type Extension, type GenerateShareParams, type ICapabilityKeyRegistry, type IENSResolver, type INotificationHandler, type ISessionManager, type ISessionStorage, type ISharingService, type ISigner, type ISpace, type ISpaceCreationHandler, type ISpaceScopedDelegations, type ISpaceScopedSharing, type ISpaceService, type IUserAuthorization, type IWasmBindings, type IngestOptions, type JWK, type KeyInfo, type KeyProvider, type KeyType, type NodeInfo, type PartialSiweMessage, type PersistedSessionData, type PersistedTinyCloudSession, ProtocolMismatchError, type ReceiveOptions, type ServerHost, type ShareAccess, type ShareLink, type ShareLinkData, type ShareSchema, SharingService, type SharingServiceConfig, type SignCallback, type SignRequest, type SignResponse, type SignStrategy, SilentNotificationHandler, type SiweConfig, SiweConfigSchema, Space, type SpaceConfig, type SpaceCreationContext, type SpaceDelegationParams, type SpaceErrorCode, SpaceErrorCodes, type SpaceHostResult, type SpaceInfo, type SpaceOwnership, SpaceService, type SpaceServiceConfig, type StoredDelegationChain, TinyCloud, type TinyCloudConfig, type TinyCloudSession, UnsupportedFeatureError, type UserAuthorizationConfig, type ValidationError, VersionCheckError, activateSessionWithHost, buildSpaceUri, checkNodeInfo, createCapabilityKeyRegistry, createSharingService, createSpaceService, defaultSignStrategy, defaultSpaceCreationHandler, fetchPeerId, makePublicSpaceId, parseSpaceUri, submitHostDelegation, validateClientSession, validatePersistedSessionData };
4240
+ export { AutoApproveSpaceCreationHandler, type AutoRejectStrategy, type AutoSignStrategy, type Bytes, type CallbackStrategy, type CapabilityEntry, CapabilityKeyRegistry, type CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, type ClientSession, ClientSessionSchema, type CreateDelegationFunction, type CreateDelegationParams, type CreateDelegationWasmParams, type CreateDelegationWasmResult, DEFAULT_DEFAULTS, DEFAULT_EXPIRY, type Delegation, type DelegationApiResponse, type DelegationChain, type DelegationChainV2, type DelegationDirection, type DelegationError, type DelegationErrorCode, DelegationErrorCodes, type DelegationFilters, DelegationManager, type DelegationManagerConfig, type DelegationRecord, type Result as DelegationResult, type EncodedShareData, type EnsData, EnsDataSchema, type EventEmitterStrategy, type Extension, type GenerateShareParams, type ICapabilityKeyRegistry, type IENSResolver, type INotificationHandler, type ISessionManager, type ISessionStorage, type ISharingService, type ISigner, type ISpace, type ISpaceCreationHandler, type ISpaceScopedDelegations, type ISpaceScopedSharing, type ISpaceService, type IUserAuthorization, type IWasmBindings, type IngestOptions, type JWK, type KeyInfo, type KeyProvider, type KeyType, type Manifest, type ManifestDefaults, type ManifestDelegation, ManifestValidationError, type NodeInfo, type ParseRecapFromSiwe, type PartialSiweMessage, type PermissionEntry, PermissionNotInManifestError, type PersistedSessionData, type PersistedTinyCloudSession, ProtocolMismatchError, type ReceiveOptions, type ResolvedCapabilities, type ResolvedDelegate, type ResourceCapability, SERVICE_LONG_TO_SHORT, SERVICE_SHORT_TO_LONG, type ServerHost, SessionExpiredError, type ShareAccess, type ShareLink, type ShareLinkData, type ShareSchema, SharingService, type SharingServiceConfig, type SignCallback, type SignRequest, type SignResponse, type SignStrategy, SilentNotificationHandler, type SiweConfig, SiweConfigSchema, Space, type SpaceConfig, type SpaceCreationContext, type SpaceDelegationParams, type SpaceErrorCode, SpaceErrorCodes, type SpaceHostResult, type SpaceInfo, type SpaceOwnership, SpaceService, type SpaceServiceConfig, type StoredDelegationChain, type SubsetCheckResult, TinyCloud, type TinyCloudConfig, type TinyCloudSession, UnsupportedFeatureError, type UserAuthorizationConfig, type ValidationError, VersionCheckError, type WasmRecapEntry, activateSessionWithHost, applyPrefix, buildSpaceUri, checkNodeInfo, createCapabilityKeyRegistry, createSharingService, createSpaceService, defaultSignStrategy, defaultSpaceCreationHandler, expandActionShortNames, fetchPeerId, isCapabilitySubset, loadManifest, makePublicSpaceId, normalizeDefaults, parseExpiry, parseRecapCapabilities, parseSpaceUri, resolveManifest, submitHostDelegation, validateClientSession, validateManifest, validatePersistedSessionData };