@tinycloud/node-sdk 3.0.0-beta.9 → 3.0.1-beta.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.
@@ -184,7 +184,7 @@ interface NodeUserAuthorizationConfig {
184
184
  spacePrefix?: string;
185
185
  /** Default actions for sessions */
186
186
  defaultActions?: Record<string, Record<string, string[]>>;
187
- /** Session expiration time in milliseconds (default: 1 hour) */
187
+ /** Session expiration time in milliseconds (default: 30 days, `EXPIRY.SESSION_MS`) */
188
188
  sessionExpirationMs?: number;
189
189
  /** Automatically create space if it doesn't exist (default: false) */
190
190
  autoCreateSpace?: boolean;
@@ -1040,6 +1040,10 @@ declare class UnsupportedSessionRestoreError extends Error {
1040
1040
  readonly code: "RESTORE_SESSION_KEY_REPLACEMENT_UNSUPPORTED";
1041
1041
  constructor(reason?: string);
1042
1042
  }
1043
+ declare class InvalidRestoredSessionError extends Error {
1044
+ readonly code: "AUTH_EXPIRED";
1045
+ constructor(message?: string);
1046
+ }
1043
1047
  /**
1044
1048
  * Configuration for TinyCloudNode.
1045
1049
  * All fields are optional - TinyCloudNode can work with zero configuration.
@@ -1071,7 +1075,7 @@ interface TinyCloudNodeConfig {
1071
1075
  prefix?: string;
1072
1076
  /** Domain for SIWE messages (default: derived from host) */
1073
1077
  domain?: string;
1074
- /** Session expiration time in milliseconds (default: 1 hour) */
1078
+ /** Session expiration time in milliseconds (default: 30 days, `EXPIRY.SESSION_MS`) */
1075
1079
  sessionExpirationMs?: number;
1076
1080
  /** Whether to automatically create space if it doesn't exist (default: false) */
1077
1081
  autoCreateSpace?: boolean;
@@ -1125,7 +1129,8 @@ interface TinyCloudNodeConfig {
1125
1129
  * Options for {@link TinyCloudNode.delegateTo}.
1126
1130
  *
1127
1131
  * `expiry` accepts either an ms-format duration string (e.g. `"7d"`, `"1h"`)
1128
- * 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.
1129
1134
  *
1130
1135
  * `forceWalletSign` bypasses the derivability check and sends the
1131
1136
  * delegation through the legacy wallet-signed SIWE path, which always
@@ -1385,6 +1390,8 @@ declare class TinyCloudNode {
1385
1390
  * rather than treating a malformed session as unrestricted authority.
1386
1391
  */
1387
1392
  getVerifiedSessionCapabilities(): PermissionEntry[];
1393
+ /** Normalize signed capabilities without collapsing nested encryption into raw authority. */
1394
+ private projectSignedRecapCapabilities;
1388
1395
  /**
1389
1396
  * Get the Ethereum address for this user.
1390
1397
  */
@@ -1445,9 +1452,9 @@ declare class TinyCloudNode {
1445
1452
  * We must keep the full owner-scoped URI so a synthetic primary grant can
1446
1453
  * never cover an operation on a different owner's space.
1447
1454
  *
1448
- * Mirrors {@link operationsFromDelegation}'s op shape: encryption network
1449
- * entries (`urn:tinycloud:encryption:` paths) become `resource` ops; every
1450
- * 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.
1451
1458
  * One op per action.
1452
1459
  *
1453
1460
  * Returns `[]` for session-only / restored-without-siwe modes and for any
@@ -1791,6 +1798,10 @@ declare class TinyCloudNode {
1791
1798
  /** Authorize one short-lived v3 delivery against the signed v3 envelope and registered roots. */
1792
1799
  authorizeShareDeliveryV3(input: {
1793
1800
  readonly envelope: Record<string, CanonicalJson | undefined>;
1801
+ /** Canonical sealed recipient envelope: version || nonce || ciphertext+tag. */
1802
+ readonly sealedEnvelope: string;
1803
+ /** Base64url 32-byte envelope key; it must also be the URL fragment key. */
1804
+ readonly envelopeKey: string;
1794
1805
  readonly shareCid: string;
1795
1806
  readonly resourcePath: string;
1796
1807
  readonly recipientEmail: string;
@@ -1798,6 +1809,8 @@ declare class TinyCloudNode {
1798
1809
  readonly documentName: string;
1799
1810
  readonly expiresAt: string;
1800
1811
  readonly deliveryAudience: string;
1812
+ /** Stable caller retry identity. It is hashed into the protocol's 16-byte JTI. */
1813
+ readonly idempotencyKey: string;
1801
1814
  }): Promise<ShareDeliveryAuthorizationV3Receipt>;
1802
1815
  private createRootDelegationForSharing;
1803
1816
  /**
@@ -2212,6 +2225,8 @@ declare class TinyCloudNode {
2212
2225
  private isEncryptionPermissionEntry;
2213
2226
  private permissionsToRawAbilities;
2214
2227
  private permissionOperations;
2228
+ /** Raw network authority cannot be covered by a nested encryption space. */
2229
+ private signedCapabilitySubset;
2215
2230
  private sessionCoversPermissionEntries;
2216
2231
  private permissionEntriesToOperations;
2217
2232
  private findRuntimeGrantsForPermissionEntries;
@@ -2333,7 +2348,7 @@ declare class TinyCloudNode {
2333
2348
  delegateDID: string;
2334
2349
  /** Whether to prevent the recipient from creating further sub-delegations */
2335
2350
  disableSubDelegation?: boolean;
2336
- /** 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. */
2337
2352
  expiryMs?: number;
2338
2353
  /** Explicit multi-resource projection, including encryption networks. */
2339
2354
  resources?: Array<{
@@ -2453,4 +2468,4 @@ declare class WasmKeyProvider implements KeyProvider {
2453
2468
  */
2454
2469
  declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
2455
2470
 
2456
- 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 };
@@ -184,7 +184,7 @@ interface NodeUserAuthorizationConfig {
184
184
  spacePrefix?: string;
185
185
  /** Default actions for sessions */
186
186
  defaultActions?: Record<string, Record<string, string[]>>;
187
- /** Session expiration time in milliseconds (default: 1 hour) */
187
+ /** Session expiration time in milliseconds (default: 30 days, `EXPIRY.SESSION_MS`) */
188
188
  sessionExpirationMs?: number;
189
189
  /** Automatically create space if it doesn't exist (default: false) */
190
190
  autoCreateSpace?: boolean;
@@ -1040,6 +1040,10 @@ declare class UnsupportedSessionRestoreError extends Error {
1040
1040
  readonly code: "RESTORE_SESSION_KEY_REPLACEMENT_UNSUPPORTED";
1041
1041
  constructor(reason?: string);
1042
1042
  }
1043
+ declare class InvalidRestoredSessionError extends Error {
1044
+ readonly code: "AUTH_EXPIRED";
1045
+ constructor(message?: string);
1046
+ }
1043
1047
  /**
1044
1048
  * Configuration for TinyCloudNode.
1045
1049
  * All fields are optional - TinyCloudNode can work with zero configuration.
@@ -1071,7 +1075,7 @@ interface TinyCloudNodeConfig {
1071
1075
  prefix?: string;
1072
1076
  /** Domain for SIWE messages (default: derived from host) */
1073
1077
  domain?: string;
1074
- /** Session expiration time in milliseconds (default: 1 hour) */
1078
+ /** Session expiration time in milliseconds (default: 30 days, `EXPIRY.SESSION_MS`) */
1075
1079
  sessionExpirationMs?: number;
1076
1080
  /** Whether to automatically create space if it doesn't exist (default: false) */
1077
1081
  autoCreateSpace?: boolean;
@@ -1125,7 +1129,8 @@ interface TinyCloudNodeConfig {
1125
1129
  * Options for {@link TinyCloudNode.delegateTo}.
1126
1130
  *
1127
1131
  * `expiry` accepts either an ms-format duration string (e.g. `"7d"`, `"1h"`)
1128
- * 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.
1129
1134
  *
1130
1135
  * `forceWalletSign` bypasses the derivability check and sends the
1131
1136
  * delegation through the legacy wallet-signed SIWE path, which always
@@ -1385,6 +1390,8 @@ declare class TinyCloudNode {
1385
1390
  * rather than treating a malformed session as unrestricted authority.
1386
1391
  */
1387
1392
  getVerifiedSessionCapabilities(): PermissionEntry[];
1393
+ /** Normalize signed capabilities without collapsing nested encryption into raw authority. */
1394
+ private projectSignedRecapCapabilities;
1388
1395
  /**
1389
1396
  * Get the Ethereum address for this user.
1390
1397
  */
@@ -1445,9 +1452,9 @@ declare class TinyCloudNode {
1445
1452
  * We must keep the full owner-scoped URI so a synthetic primary grant can
1446
1453
  * never cover an operation on a different owner's space.
1447
1454
  *
1448
- * Mirrors {@link operationsFromDelegation}'s op shape: encryption network
1449
- * entries (`urn:tinycloud:encryption:` paths) become `resource` ops; every
1450
- * 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.
1451
1458
  * One op per action.
1452
1459
  *
1453
1460
  * Returns `[]` for session-only / restored-without-siwe modes and for any
@@ -1791,6 +1798,10 @@ declare class TinyCloudNode {
1791
1798
  /** Authorize one short-lived v3 delivery against the signed v3 envelope and registered roots. */
1792
1799
  authorizeShareDeliveryV3(input: {
1793
1800
  readonly envelope: Record<string, CanonicalJson | undefined>;
1801
+ /** Canonical sealed recipient envelope: version || nonce || ciphertext+tag. */
1802
+ readonly sealedEnvelope: string;
1803
+ /** Base64url 32-byte envelope key; it must also be the URL fragment key. */
1804
+ readonly envelopeKey: string;
1794
1805
  readonly shareCid: string;
1795
1806
  readonly resourcePath: string;
1796
1807
  readonly recipientEmail: string;
@@ -1798,6 +1809,8 @@ declare class TinyCloudNode {
1798
1809
  readonly documentName: string;
1799
1810
  readonly expiresAt: string;
1800
1811
  readonly deliveryAudience: string;
1812
+ /** Stable caller retry identity. It is hashed into the protocol's 16-byte JTI. */
1813
+ readonly idempotencyKey: string;
1801
1814
  }): Promise<ShareDeliveryAuthorizationV3Receipt>;
1802
1815
  private createRootDelegationForSharing;
1803
1816
  /**
@@ -2212,6 +2225,8 @@ declare class TinyCloudNode {
2212
2225
  private isEncryptionPermissionEntry;
2213
2226
  private permissionsToRawAbilities;
2214
2227
  private permissionOperations;
2228
+ /** Raw network authority cannot be covered by a nested encryption space. */
2229
+ private signedCapabilitySubset;
2215
2230
  private sessionCoversPermissionEntries;
2216
2231
  private permissionEntriesToOperations;
2217
2232
  private findRuntimeGrantsForPermissionEntries;
@@ -2333,7 +2348,7 @@ declare class TinyCloudNode {
2333
2348
  delegateDID: string;
2334
2349
  /** Whether to prevent the recipient from creating further sub-delegations */
2335
2350
  disableSubDelegation?: boolean;
2336
- /** 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. */
2337
2352
  expiryMs?: number;
2338
2353
  /** Explicit multi-resource projection, including encryption networks. */
2339
2354
  resources?: Array<{
@@ -2453,4 +2468,4 @@ declare class WasmKeyProvider implements KeyProvider {
2453
2468
  */
2454
2469
  declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
2455
2470
 
2456
- 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 };