@tinycloud/node-sdk 3.0.0-beta.8 → 3.0.0

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.
@@ -1,4 +1,5 @@
1
- import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, CapabilityPresentationEnvelopeV1, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, INotificationHandler, IENSResolver, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ShareDeliveryAuthorizationReceipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
1
+ import * as _tinycloud_sdk_core from '@tinycloud/sdk-core';
2
+ import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, CapabilityPresentationEnvelopeV1, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, INotificationHandler, IENSResolver, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
2
3
  import { EventEmitter } from 'events';
3
4
  import { InvokeFunction, InvokeAnyFunction } from '@tinycloud/sdk-services';
4
5
 
@@ -183,7 +184,7 @@ interface NodeUserAuthorizationConfig {
183
184
  spacePrefix?: string;
184
185
  /** Default actions for sessions */
185
186
  defaultActions?: Record<string, Record<string, string[]>>;
186
- /** Session expiration time in milliseconds (default: 1 hour) */
187
+ /** Session expiration time in milliseconds (default: 30 days, `EXPIRY.SESSION_MS`) */
187
188
  sessionExpirationMs?: number;
188
189
  /** Automatically create space if it doesn't exist (default: false) */
189
190
  autoCreateSpace?: boolean;
@@ -955,39 +956,6 @@ declare class DelegatedAccess {
955
956
  get restorable(): RestorableSession;
956
957
  }
957
958
 
958
- /**
959
- * TinyCloudNode - High-level API for Node.js users.
960
- *
961
- * Each user has their own TinyCloudNode instance with their own key.
962
- * This class provides a simplified interface for:
963
- * - Signing in and managing sessions
964
- * - Key-value storage operations on own space
965
- * - Creating and using delegations
966
- *
967
- * @example
968
- * ```typescript
969
- * const alice = new TinyCloudNode({
970
- * privateKey: process.env.ALICE_PRIVATE_KEY,
971
- * host: "https://node.tinycloud.xyz",
972
- * prefix: "myapp",
973
- * });
974
- *
975
- * await alice.signIn();
976
- * await alice.kv.put("greeting", "Hello, world!");
977
- *
978
- * // Delegate access to Bob
979
- * const delegation = await alice.createDelegation({
980
- * path: "shared/",
981
- * actions: ["tinycloud.kv/get", "tinycloud.kv/put"],
982
- * delegateDID: bob.did,
983
- * });
984
- *
985
- * // Bob uses the delegation
986
- * const access = await bob.useDelegation(delegation);
987
- * const data = await access.kv.get("shared/data");
988
- * ```
989
- */
990
-
991
959
  declare const BOOTSTRAP_COMPLETION_MARKER_KEY = "system/bootstrap/complete";
992
960
  declare const BOOTSTRAP_COMPLETION_MARKER_VERSION = 1;
993
961
  declare const ACCEPTED_MARKER_VERSIONS: readonly number[];
@@ -1072,6 +1040,10 @@ declare class UnsupportedSessionRestoreError extends Error {
1072
1040
  readonly code: "RESTORE_SESSION_KEY_REPLACEMENT_UNSUPPORTED";
1073
1041
  constructor(reason?: string);
1074
1042
  }
1043
+ declare class InvalidRestoredSessionError extends Error {
1044
+ readonly code: "AUTH_EXPIRED";
1045
+ constructor(message?: string);
1046
+ }
1075
1047
  /**
1076
1048
  * Configuration for TinyCloudNode.
1077
1049
  * All fields are optional - TinyCloudNode can work with zero configuration.
@@ -1103,7 +1075,7 @@ interface TinyCloudNodeConfig {
1103
1075
  prefix?: string;
1104
1076
  /** Domain for SIWE messages (default: derived from host) */
1105
1077
  domain?: string;
1106
- /** Session expiration time in milliseconds (default: 1 hour) */
1078
+ /** Session expiration time in milliseconds (default: 30 days, `EXPIRY.SESSION_MS`) */
1107
1079
  sessionExpirationMs?: number;
1108
1080
  /** Whether to automatically create space if it doesn't exist (default: false) */
1109
1081
  autoCreateSpace?: boolean;
@@ -1157,7 +1129,8 @@ interface TinyCloudNodeConfig {
1157
1129
  * Options for {@link TinyCloudNode.delegateTo}.
1158
1130
  *
1159
1131
  * `expiry` accepts either an ms-format duration string (e.g. `"7d"`, `"1h"`)
1160
- * or a raw number of milliseconds. When omitted, the default is 1 hour.
1132
+ * or a raw number of milliseconds. When omitted, the default is
1133
+ * `EXPIRY.SESSION_MS` (30 days), still capped at the session's own expiry.
1161
1134
  *
1162
1135
  * `forceWalletSign` bypasses the derivability check and sends the
1163
1136
  * delegation through the legacy wallet-signed SIWE path, which always
@@ -1382,6 +1355,13 @@ declare class TinyCloudNode {
1382
1355
  get manifest(): Manifest | Manifest[] | undefined;
1383
1356
  get capabilityRequest(): ComposedManifestRequest | undefined;
1384
1357
  get hosts(): string[];
1358
+ /** The registry-resolved Node endpoint and the identity returned by that exact Node. */
1359
+ activeNodeIdentity(): Promise<{
1360
+ readonly origin: string;
1361
+ readonly nodeDid: string;
1362
+ }>;
1363
+ /** Publish the active owner Node as a session-signed registry record. */
1364
+ publishActiveNodeLocation(registryUrl: string, fetchFn?: typeof fetch): Promise<_tinycloud_sdk_core.LocationRecord>;
1385
1365
  /**
1386
1366
  * Get the primary identity DID for this user.
1387
1367
  * - If wallet connected and signed in: returns PKH DID (did:pkh:eip155:{chainId}:{address})
@@ -1410,6 +1390,8 @@ declare class TinyCloudNode {
1410
1390
  * rather than treating a malformed session as unrestricted authority.
1411
1391
  */
1412
1392
  getVerifiedSessionCapabilities(): PermissionEntry[];
1393
+ /** Normalize signed capabilities without collapsing nested encryption into raw authority. */
1394
+ private projectSignedRecapCapabilities;
1413
1395
  /**
1414
1396
  * Get the Ethereum address for this user.
1415
1397
  */
@@ -1470,9 +1452,9 @@ declare class TinyCloudNode {
1470
1452
  * We must keep the full owner-scoped URI so a synthetic primary grant can
1471
1453
  * never cover an operation on a different owner's space.
1472
1454
  *
1473
- * Mirrors {@link operationsFromDelegation}'s op shape: encryption network
1474
- * entries (`urn:tinycloud:encryption:` paths) become `resource` ops; every
1475
- * other entry becomes a `spaceId` op carrying the raw recap `space` URI.
1455
+ * Only top-level encryption network entries (`space: "encryption"` or
1456
+ * absent) become `resource` ops. A network-shaped path nested under a
1457
+ * data space remains a `spaceId` op, not raw network authority.
1476
1458
  * One op per action.
1477
1459
  *
1478
1460
  * Returns `[]` for session-only / restored-without-siwe modes and for any
@@ -1813,33 +1795,12 @@ declare class TinyCloudNode {
1813
1795
  createOwnerDelegation(params: CreateOwnerDelegationParams, assertActive?: () => void): Promise<OwnerDelegationReceipt>;
1814
1796
  /** Register a signed policy and sibling roots with this Node's Policy/v3 runtime. */
1815
1797
  registerPolicy(params: Omit<RegisterPolicyV3Input, "nodeOrigin" | "fetch">): Promise<RegisterPolicyV3Receipt>;
1816
- /** @deprecated Policy/v2 delivery transport is retired. Use authorizeShareDeliveryV3. */
1817
- authorizeShareDelivery(input: {
1818
- readonly envelopeCid: string;
1819
- readonly shareCid: string;
1820
- readonly shareId: string;
1821
- readonly registrationCid: string;
1822
- readonly policyCid: string;
1823
- readonly delegationCid: string;
1824
- readonly enforcementDelegationCid: string;
1825
- readonly resourcePath: string;
1826
- readonly recipientEmail: string;
1827
- readonly shareUrl: string;
1828
- readonly documentName: string;
1829
- readonly idempotencyKey: string;
1830
- readonly expiresAt: string;
1831
- /** The enrolled receipt key from the node trust bundle. */
1832
- readonly nodeProof: {
1833
- readonly kid: string;
1834
- readonly publicKey: Uint8Array;
1835
- };
1836
- /** The trusted OpenCredentials witness origin from the same trust bundle as `nodeProof`. */
1837
- readonly credentialsAudience: string;
1838
- }): Promise<ShareDeliveryAuthorizationReceipt>;
1839
1798
  /** Authorize one short-lived v3 delivery against the signed v3 envelope and registered roots. */
1840
1799
  authorizeShareDeliveryV3(input: {
1841
1800
  readonly envelope: Record<string, CanonicalJson | undefined>;
1801
+ /** Canonical sealed recipient envelope: version || nonce || ciphertext+tag. */
1842
1802
  readonly sealedEnvelope: string;
1803
+ /** Base64url 32-byte envelope key; it must also be the URL fragment key. */
1843
1804
  readonly envelopeKey: string;
1844
1805
  readonly shareCid: string;
1845
1806
  readonly resourcePath: string;
@@ -1847,11 +1808,9 @@ declare class TinyCloudNode {
1847
1808
  readonly shareUrl: string;
1848
1809
  readonly documentName: string;
1849
1810
  readonly expiresAt: string;
1850
- readonly nodeProof: {
1851
- readonly kid: string;
1852
- readonly publicKey: Uint8Array;
1853
- };
1854
- readonly credentialsAudience: string;
1811
+ readonly deliveryAudience: string;
1812
+ /** Stable caller retry identity. It is hashed into the protocol's 16-byte JTI. */
1813
+ readonly idempotencyKey: string;
1855
1814
  }): Promise<ShareDeliveryAuthorizationV3Receipt>;
1856
1815
  private createRootDelegationForSharing;
1857
1816
  /**
@@ -2266,6 +2225,8 @@ declare class TinyCloudNode {
2266
2225
  private isEncryptionPermissionEntry;
2267
2226
  private permissionsToRawAbilities;
2268
2227
  private permissionOperations;
2228
+ /** Raw network authority cannot be covered by a nested encryption space. */
2229
+ private signedCapabilitySubset;
2269
2230
  private sessionCoversPermissionEntries;
2270
2231
  private permissionEntriesToOperations;
2271
2232
  private findRuntimeGrantsForPermissionEntries;
@@ -2387,7 +2348,7 @@ declare class TinyCloudNode {
2387
2348
  delegateDID: string;
2388
2349
  /** Whether to prevent the recipient from creating further sub-delegations */
2389
2350
  disableSubDelegation?: boolean;
2390
- /** Expiration time in milliseconds from now (must be before parent's expiry) */
2351
+ /** Expiration in milliseconds from now; defaults to the parent's own expiry, the longest allowed. */
2391
2352
  expiryMs?: number;
2392
2353
  /** Explicit multi-resource projection, including encryption networks. */
2393
2354
  resources?: Array<{
@@ -2507,4 +2468,4 @@ declare class WasmKeyProvider implements KeyProvider {
2507
2468
  */
2508
2469
  declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
2509
2470
 
2510
- export { ACCEPTED_MARKER_VERSIONS as A, BOOTSTRAP_COMPLETION_MARKER_KEY as B, type CompactRuntimeDelegationInput as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, serializeDelegation as G, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthDelegationArtifact as a, type AuthRequestArtifact as b, BOOTSTRAP_COMPLETION_MARKER_VERSION as c, type BootstrapCompletionMarker as d, type BootstrapWarning as e, type CreateOwnerDelegationParams as f, type DelegateToResult as g, DelegatedAccess as h, type DelegationAuthority as i, NodeUserAuthorization as j, type NodeUserAuthorizationConfig as k, type RuntimeDelegationActivator as l, type RuntimePermissionGrantOptions as m, type SecretReadInput as n, type SecretReadResult as o, type SignStrategy as p, type TinyCloudNodeConfig as q, type UnifiedOwnerRootReceipt as r, UnsupportedSessionRestoreError as s, type WasmKeyProviderConfig as t, activateCompactRuntimeDelegation as u, activateValidatedRuntimeDelegation as v, createWasmKeyProvider as w, defaultSignStrategy as x, deserializeDelegation as y, grantAuthRequest as z };
2471
+ export { ACCEPTED_MARKER_VERSIONS as A, BOOTSTRAP_COMPLETION_MARKER_KEY as B, type CompactRuntimeDelegationInput as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, serializeDelegation as G, InvalidRestoredSessionError as I, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthDelegationArtifact as a, type AuthRequestArtifact as b, BOOTSTRAP_COMPLETION_MARKER_VERSION as c, type BootstrapCompletionMarker as d, type BootstrapWarning as e, type CreateOwnerDelegationParams as f, type DelegateToResult as g, DelegatedAccess as h, type DelegationAuthority as i, NodeUserAuthorization as j, type NodeUserAuthorizationConfig as k, type RuntimeDelegationActivator as l, type RuntimePermissionGrantOptions as m, type SecretReadInput as n, type SecretReadResult as o, type SignStrategy as p, type TinyCloudNodeConfig as q, type UnifiedOwnerRootReceipt as r, UnsupportedSessionRestoreError as s, type WasmKeyProviderConfig as t, activateCompactRuntimeDelegation as u, activateValidatedRuntimeDelegation as v, createWasmKeyProvider as w, defaultSignStrategy as x, deserializeDelegation as y, grantAuthRequest as z };
@@ -1,4 +1,5 @@
1
- import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, CapabilityPresentationEnvelopeV1, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, INotificationHandler, IENSResolver, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ShareDeliveryAuthorizationReceipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
1
+ import * as _tinycloud_sdk_core from '@tinycloud/sdk-core';
2
+ import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, CapabilityPresentationEnvelopeV1, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, INotificationHandler, IENSResolver, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
2
3
  import { EventEmitter } from 'events';
3
4
  import { InvokeFunction, InvokeAnyFunction } from '@tinycloud/sdk-services';
4
5
 
@@ -183,7 +184,7 @@ interface NodeUserAuthorizationConfig {
183
184
  spacePrefix?: string;
184
185
  /** Default actions for sessions */
185
186
  defaultActions?: Record<string, Record<string, string[]>>;
186
- /** Session expiration time in milliseconds (default: 1 hour) */
187
+ /** Session expiration time in milliseconds (default: 30 days, `EXPIRY.SESSION_MS`) */
187
188
  sessionExpirationMs?: number;
188
189
  /** Automatically create space if it doesn't exist (default: false) */
189
190
  autoCreateSpace?: boolean;
@@ -955,39 +956,6 @@ declare class DelegatedAccess {
955
956
  get restorable(): RestorableSession;
956
957
  }
957
958
 
958
- /**
959
- * TinyCloudNode - High-level API for Node.js users.
960
- *
961
- * Each user has their own TinyCloudNode instance with their own key.
962
- * This class provides a simplified interface for:
963
- * - Signing in and managing sessions
964
- * - Key-value storage operations on own space
965
- * - Creating and using delegations
966
- *
967
- * @example
968
- * ```typescript
969
- * const alice = new TinyCloudNode({
970
- * privateKey: process.env.ALICE_PRIVATE_KEY,
971
- * host: "https://node.tinycloud.xyz",
972
- * prefix: "myapp",
973
- * });
974
- *
975
- * await alice.signIn();
976
- * await alice.kv.put("greeting", "Hello, world!");
977
- *
978
- * // Delegate access to Bob
979
- * const delegation = await alice.createDelegation({
980
- * path: "shared/",
981
- * actions: ["tinycloud.kv/get", "tinycloud.kv/put"],
982
- * delegateDID: bob.did,
983
- * });
984
- *
985
- * // Bob uses the delegation
986
- * const access = await bob.useDelegation(delegation);
987
- * const data = await access.kv.get("shared/data");
988
- * ```
989
- */
990
-
991
959
  declare const BOOTSTRAP_COMPLETION_MARKER_KEY = "system/bootstrap/complete";
992
960
  declare const BOOTSTRAP_COMPLETION_MARKER_VERSION = 1;
993
961
  declare const ACCEPTED_MARKER_VERSIONS: readonly number[];
@@ -1072,6 +1040,10 @@ declare class UnsupportedSessionRestoreError extends Error {
1072
1040
  readonly code: "RESTORE_SESSION_KEY_REPLACEMENT_UNSUPPORTED";
1073
1041
  constructor(reason?: string);
1074
1042
  }
1043
+ declare class InvalidRestoredSessionError extends Error {
1044
+ readonly code: "AUTH_EXPIRED";
1045
+ constructor(message?: string);
1046
+ }
1075
1047
  /**
1076
1048
  * Configuration for TinyCloudNode.
1077
1049
  * All fields are optional - TinyCloudNode can work with zero configuration.
@@ -1103,7 +1075,7 @@ interface TinyCloudNodeConfig {
1103
1075
  prefix?: string;
1104
1076
  /** Domain for SIWE messages (default: derived from host) */
1105
1077
  domain?: string;
1106
- /** Session expiration time in milliseconds (default: 1 hour) */
1078
+ /** Session expiration time in milliseconds (default: 30 days, `EXPIRY.SESSION_MS`) */
1107
1079
  sessionExpirationMs?: number;
1108
1080
  /** Whether to automatically create space if it doesn't exist (default: false) */
1109
1081
  autoCreateSpace?: boolean;
@@ -1157,7 +1129,8 @@ interface TinyCloudNodeConfig {
1157
1129
  * Options for {@link TinyCloudNode.delegateTo}.
1158
1130
  *
1159
1131
  * `expiry` accepts either an ms-format duration string (e.g. `"7d"`, `"1h"`)
1160
- * or a raw number of milliseconds. When omitted, the default is 1 hour.
1132
+ * or a raw number of milliseconds. When omitted, the default is
1133
+ * `EXPIRY.SESSION_MS` (30 days), still capped at the session's own expiry.
1161
1134
  *
1162
1135
  * `forceWalletSign` bypasses the derivability check and sends the
1163
1136
  * delegation through the legacy wallet-signed SIWE path, which always
@@ -1382,6 +1355,13 @@ declare class TinyCloudNode {
1382
1355
  get manifest(): Manifest | Manifest[] | undefined;
1383
1356
  get capabilityRequest(): ComposedManifestRequest | undefined;
1384
1357
  get hosts(): string[];
1358
+ /** The registry-resolved Node endpoint and the identity returned by that exact Node. */
1359
+ activeNodeIdentity(): Promise<{
1360
+ readonly origin: string;
1361
+ readonly nodeDid: string;
1362
+ }>;
1363
+ /** Publish the active owner Node as a session-signed registry record. */
1364
+ publishActiveNodeLocation(registryUrl: string, fetchFn?: typeof fetch): Promise<_tinycloud_sdk_core.LocationRecord>;
1385
1365
  /**
1386
1366
  * Get the primary identity DID for this user.
1387
1367
  * - If wallet connected and signed in: returns PKH DID (did:pkh:eip155:{chainId}:{address})
@@ -1410,6 +1390,8 @@ declare class TinyCloudNode {
1410
1390
  * rather than treating a malformed session as unrestricted authority.
1411
1391
  */
1412
1392
  getVerifiedSessionCapabilities(): PermissionEntry[];
1393
+ /** Normalize signed capabilities without collapsing nested encryption into raw authority. */
1394
+ private projectSignedRecapCapabilities;
1413
1395
  /**
1414
1396
  * Get the Ethereum address for this user.
1415
1397
  */
@@ -1470,9 +1452,9 @@ declare class TinyCloudNode {
1470
1452
  * We must keep the full owner-scoped URI so a synthetic primary grant can
1471
1453
  * never cover an operation on a different owner's space.
1472
1454
  *
1473
- * Mirrors {@link operationsFromDelegation}'s op shape: encryption network
1474
- * entries (`urn:tinycloud:encryption:` paths) become `resource` ops; every
1475
- * other entry becomes a `spaceId` op carrying the raw recap `space` URI.
1455
+ * Only top-level encryption network entries (`space: "encryption"` or
1456
+ * absent) become `resource` ops. A network-shaped path nested under a
1457
+ * data space remains a `spaceId` op, not raw network authority.
1476
1458
  * One op per action.
1477
1459
  *
1478
1460
  * Returns `[]` for session-only / restored-without-siwe modes and for any
@@ -1813,33 +1795,12 @@ declare class TinyCloudNode {
1813
1795
  createOwnerDelegation(params: CreateOwnerDelegationParams, assertActive?: () => void): Promise<OwnerDelegationReceipt>;
1814
1796
  /** Register a signed policy and sibling roots with this Node's Policy/v3 runtime. */
1815
1797
  registerPolicy(params: Omit<RegisterPolicyV3Input, "nodeOrigin" | "fetch">): Promise<RegisterPolicyV3Receipt>;
1816
- /** @deprecated Policy/v2 delivery transport is retired. Use authorizeShareDeliveryV3. */
1817
- authorizeShareDelivery(input: {
1818
- readonly envelopeCid: string;
1819
- readonly shareCid: string;
1820
- readonly shareId: string;
1821
- readonly registrationCid: string;
1822
- readonly policyCid: string;
1823
- readonly delegationCid: string;
1824
- readonly enforcementDelegationCid: string;
1825
- readonly resourcePath: string;
1826
- readonly recipientEmail: string;
1827
- readonly shareUrl: string;
1828
- readonly documentName: string;
1829
- readonly idempotencyKey: string;
1830
- readonly expiresAt: string;
1831
- /** The enrolled receipt key from the node trust bundle. */
1832
- readonly nodeProof: {
1833
- readonly kid: string;
1834
- readonly publicKey: Uint8Array;
1835
- };
1836
- /** The trusted OpenCredentials witness origin from the same trust bundle as `nodeProof`. */
1837
- readonly credentialsAudience: string;
1838
- }): Promise<ShareDeliveryAuthorizationReceipt>;
1839
1798
  /** Authorize one short-lived v3 delivery against the signed v3 envelope and registered roots. */
1840
1799
  authorizeShareDeliveryV3(input: {
1841
1800
  readonly envelope: Record<string, CanonicalJson | undefined>;
1801
+ /** Canonical sealed recipient envelope: version || nonce || ciphertext+tag. */
1842
1802
  readonly sealedEnvelope: string;
1803
+ /** Base64url 32-byte envelope key; it must also be the URL fragment key. */
1843
1804
  readonly envelopeKey: string;
1844
1805
  readonly shareCid: string;
1845
1806
  readonly resourcePath: string;
@@ -1847,11 +1808,9 @@ declare class TinyCloudNode {
1847
1808
  readonly shareUrl: string;
1848
1809
  readonly documentName: string;
1849
1810
  readonly expiresAt: string;
1850
- readonly nodeProof: {
1851
- readonly kid: string;
1852
- readonly publicKey: Uint8Array;
1853
- };
1854
- readonly credentialsAudience: string;
1811
+ readonly deliveryAudience: string;
1812
+ /** Stable caller retry identity. It is hashed into the protocol's 16-byte JTI. */
1813
+ readonly idempotencyKey: string;
1855
1814
  }): Promise<ShareDeliveryAuthorizationV3Receipt>;
1856
1815
  private createRootDelegationForSharing;
1857
1816
  /**
@@ -2266,6 +2225,8 @@ declare class TinyCloudNode {
2266
2225
  private isEncryptionPermissionEntry;
2267
2226
  private permissionsToRawAbilities;
2268
2227
  private permissionOperations;
2228
+ /** Raw network authority cannot be covered by a nested encryption space. */
2229
+ private signedCapabilitySubset;
2269
2230
  private sessionCoversPermissionEntries;
2270
2231
  private permissionEntriesToOperations;
2271
2232
  private findRuntimeGrantsForPermissionEntries;
@@ -2387,7 +2348,7 @@ declare class TinyCloudNode {
2387
2348
  delegateDID: string;
2388
2349
  /** Whether to prevent the recipient from creating further sub-delegations */
2389
2350
  disableSubDelegation?: boolean;
2390
- /** Expiration time in milliseconds from now (must be before parent's expiry) */
2351
+ /** Expiration in milliseconds from now; defaults to the parent's own expiry, the longest allowed. */
2391
2352
  expiryMs?: number;
2392
2353
  /** Explicit multi-resource projection, including encryption networks. */
2393
2354
  resources?: Array<{
@@ -2507,4 +2468,4 @@ declare class WasmKeyProvider implements KeyProvider {
2507
2468
  */
2508
2469
  declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
2509
2470
 
2510
- export { ACCEPTED_MARKER_VERSIONS as A, BOOTSTRAP_COMPLETION_MARKER_KEY as B, type CompactRuntimeDelegationInput as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, serializeDelegation as G, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthDelegationArtifact as a, type AuthRequestArtifact as b, BOOTSTRAP_COMPLETION_MARKER_VERSION as c, type BootstrapCompletionMarker as d, type BootstrapWarning as e, type CreateOwnerDelegationParams as f, type DelegateToResult as g, DelegatedAccess as h, type DelegationAuthority as i, NodeUserAuthorization as j, type NodeUserAuthorizationConfig as k, type RuntimeDelegationActivator as l, type RuntimePermissionGrantOptions as m, type SecretReadInput as n, type SecretReadResult as o, type SignStrategy as p, type TinyCloudNodeConfig as q, type UnifiedOwnerRootReceipt as r, UnsupportedSessionRestoreError as s, type WasmKeyProviderConfig as t, activateCompactRuntimeDelegation as u, activateValidatedRuntimeDelegation as v, createWasmKeyProvider as w, defaultSignStrategy as x, deserializeDelegation as y, grantAuthRequest as z };
2471
+ export { ACCEPTED_MARKER_VERSIONS as A, BOOTSTRAP_COMPLETION_MARKER_KEY as B, type CompactRuntimeDelegationInput as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, serializeDelegation as G, InvalidRestoredSessionError as I, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthDelegationArtifact as a, type AuthRequestArtifact as b, BOOTSTRAP_COMPLETION_MARKER_VERSION as c, type BootstrapCompletionMarker as d, type BootstrapWarning as e, type CreateOwnerDelegationParams as f, type DelegateToResult as g, DelegatedAccess as h, type DelegationAuthority as i, NodeUserAuthorization as j, type NodeUserAuthorizationConfig as k, type RuntimeDelegationActivator as l, type RuntimePermissionGrantOptions as m, type SecretReadInput as n, type SecretReadResult as o, type SignStrategy as p, type TinyCloudNodeConfig as q, type UnifiedOwnerRootReceipt as r, UnsupportedSessionRestoreError as s, type WasmKeyProviderConfig as t, activateCompactRuntimeDelegation as u, activateValidatedRuntimeDelegation as v, createWasmKeyProvider as w, defaultSignStrategy as x, deserializeDelegation as y, grantAuthRequest as z };