@tinycloud/node-sdk 3.8.0-beta.1 → 3.8.0-beta.11

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.
Files changed (39) hide show
  1. package/dist/{TinyCloudNode-Ckqu_fqH.d.ts → TinyCloudNode-BVDUdEcf.d.cts} +53 -5
  2. package/dist/{TinyCloudNode-DDfx8Fx5.d.cts → TinyCloudNode-jMK_2Uj8.d.ts} +53 -5
  3. package/dist/{authority-BwM_s3Ya.d.cts → authority-DJ-PE4Xo.d.cts} +20 -4
  4. package/dist/{authority-DcyJpajL.d.ts → authority-i22vHbbp.d.ts} +20 -4
  5. package/dist/core.cjs +300 -32
  6. package/dist/core.cjs.map +1 -1
  7. package/dist/core.d.cts +5 -4
  8. package/dist/core.d.ts +5 -4
  9. package/dist/core.js +292 -27
  10. package/dist/core.js.map +1 -1
  11. package/dist/credentials-core.d.cts +1 -1
  12. package/dist/credentials-core.d.ts +1 -1
  13. package/dist/credentials.d.cts +1 -1
  14. package/dist/credentials.d.ts +1 -1
  15. package/dist/{delegation-0LKZkmP2.d.cts → delegation-Ckc3UETl.d.cts} +1 -1
  16. package/dist/{delegation-0LKZkmP2.d.ts → delegation-Ckc3UETl.d.ts} +1 -1
  17. package/dist/encryption-keys.d.cts +2 -2
  18. package/dist/encryption-keys.d.ts +2 -2
  19. package/dist/index.cjs +304 -44
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +4 -3
  22. package/dist/index.d.ts +4 -3
  23. package/dist/index.js +291 -31
  24. package/dist/index.js.map +1 -1
  25. package/dist/replication/authority.cjs +39 -0
  26. package/dist/replication/authority.cjs.map +1 -1
  27. package/dist/replication/authority.d.cts +4 -3
  28. package/dist/replication/authority.d.ts +4 -3
  29. package/dist/replication/authority.js +38 -0
  30. package/dist/replication/authority.js.map +1 -1
  31. package/dist/replication/runtime.cjs +1 -0
  32. package/dist/replication/runtime.cjs.map +1 -1
  33. package/dist/replication/runtime.d.cts +1 -1
  34. package/dist/replication/runtime.d.ts +1 -1
  35. package/dist/replication/runtime.js +1 -0
  36. package/dist/replication/runtime.js.map +1 -1
  37. package/dist/{runtime-v62FzQHz.d.ts → runtime-CO4VXnPq.d.ts} +2 -1
  38. package/dist/{runtime-D1o9Eybt.d.cts → runtime-mRhSu-vJ.d.cts} +2 -1
  39. package/package.json +4 -4
@@ -1,9 +1,10 @@
1
1
  import * as _tinycloud_sdk_core from '@tinycloud/sdk-core';
2
2
  import { AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, CapabilityPresentationEnvelopeV1, IUserAuthorization, ISigner, ISessionStorage, ISpaceCreationHandler, RegistryPolicy, RegistrySequenceStore, OnNodeNotFound, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ReplicationOptions, TinyCloudSession, PersistedSessionData, ClientSession, PermissionEntry, Extension, SignRequest, SpaceHostResult, SignInOptions, TelemetryConfig, ServiceContext, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, Delegation, StorageFullEvent, IStorageService, INotificationHandler, IENSResolver, RetryPolicy, KVReplicaStorage, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ServiceSession, ReplicationControl, ResolvedDelegate } from '@tinycloud/sdk-core';
3
- import { ReplicaSessionStamp } from '@tinycloud/sdk-services/kv/replication';
3
+ import { ReplicaPurgeFailedEvent, ReplicaSessionStamp } from '@tinycloud/sdk-services/kv/replication';
4
4
  import { InvokeFunction, InvokeAnyFunction, FetchFunction, RequestSink, RequestLogReader } from '@tinycloud/sdk-services';
5
+ import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
5
6
  import { EventEmitter } from 'events';
6
- import { P as PortableDelegation, S as SessionGrantProof, g as VerifiedSessionGrant } from './delegation-0LKZkmP2.js';
7
+ import { P as PortableDelegation, S as SessionGrantProof, h as VerifiedSessionGrant } from './delegation-Ckc3UETl.cjs';
7
8
 
8
9
  /**
9
10
  * Node.js-specific SignStrategy types for TinyCloud authorization.
@@ -80,6 +81,8 @@ interface OpenKeyAuthorizeTinyCloud {
80
81
  * validates and size-bounds it before use.
81
82
  */
82
83
  presentation?: CapabilityPresentationEnvelopeV1;
84
+ }, opts?: {
85
+ mode?: "iframe" | "popup" | "redirect";
83
86
  }): Promise<{
84
87
  protocolVersion: 1;
85
88
  address: string;
@@ -142,9 +145,22 @@ type NodeUserAuthorizationAuthorizeFn = (input: OpenKeyBridgeInput) => Promise<{
142
145
  * const clientSession = await nodeAuth.signInWithOpenKey(authorize);
143
146
  * ```
144
147
  */
145
- declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud): NodeUserAuthorizationAuthorizeFn;
148
+ declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud, opts?: {
149
+ mode?: "iframe" | "popup" | "redirect";
150
+ }): NodeUserAuthorizationAuthorizeFn;
146
151
 
147
152
  type OpenKeyAuthorizeInput = OpenKeyBridgeInput;
153
+ /** SIWE and session key prepared before an OpenKey approval click. */
154
+ interface PreparedOpenKeyAuthorization {
155
+ readonly request: OpenKeyAuthorizeInput;
156
+ readonly prepared: PreparedOpenKeySession;
157
+ readonly keyId: string;
158
+ readonly jwk: Record<string, unknown>;
159
+ readonly address: string;
160
+ readonly chainId: number;
161
+ readonly generation: number;
162
+ readonly createdAt: number;
163
+ }
148
164
  type OpenKeyAuthorizationResultV1 = Awaited<ReturnType<NodeUserAuthorizationAuthorizeFn>>;
149
165
  type PreparedOpenKeySession = {
150
166
  siwe: string;
@@ -365,6 +381,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
365
381
  private readonly includeAccountRegistryPermissions;
366
382
  private sessionManager;
367
383
  private activeSessionKeyId;
384
+ private preparedSessionCounter;
368
385
  /** Incremented by resetSession; a sign-in started earlier publishes nothing. */
369
386
  private sessionGeneration;
370
387
  /**
@@ -515,6 +532,9 @@ declare class NodeUserAuthorization implements IUserAuthorization {
515
532
  * @internal
516
533
  */
517
534
  private getCapabilityRequest;
535
+ private refreshNamedKeyFeatureForSignIn;
536
+ /** Manifest key paths that this sign-in cannot grant. */
537
+ get unavailableKeyPaths(): string[];
518
538
  private resolveSpaceName;
519
539
  /**
520
540
  * The plain-session primary abilities: `defaultActions` (the shared table)
@@ -734,6 +754,10 @@ declare class NodeUserAuthorization implements IUserAuthorization {
734
754
  */
735
755
  retryResult?: (error: Error, originalRequest: OpenKeyAuthorizeInput, attempt: number) => Promise<OpenKeyAuthorizationResultV1 | null>;
736
756
  }): Promise<ClientSession>;
757
+ /** Finish address, host and SIWE preparation before an approval click. */
758
+ prepareOpenKeySignIn(options?: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[1]): Promise<PreparedOpenKeyAuthorization>;
759
+ /** Complete a prepared approval. The caller starts authorization before awaiting this method. */
760
+ completeOpenKeySignIn(pending: PreparedOpenKeyAuthorization, authorization: Promise<OpenKeyAuthorizationResultV1>, options?: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[1]): Promise<ClientSession>;
737
761
  /**
738
762
  * Build a `CapabilityPresentationEnvelopeV1` from `this._manifest`. The
739
763
  * envelope is display-only — the OpenKey widget renders it under an
@@ -1276,6 +1300,7 @@ declare class TinyCloudNode {
1276
1300
  private readonly explicitHost?;
1277
1301
  private signer;
1278
1302
  private auth;
1303
+ private readonly consumedOpenKeyPendings;
1279
1304
  private tc;
1280
1305
  private _address?;
1281
1306
  private _chainId;
@@ -1292,6 +1317,7 @@ declare class TinyCloudNode {
1292
1317
  private replicaRestoreGate?;
1293
1318
  private replicaSessionPrincipal?;
1294
1319
  private replicaSessionStamp?;
1320
+ private readonly replicaPurgeFailedHandlers;
1295
1321
  /** Mints the replica session stamp on each fresh sign-in (TC-858 §4.1). Undefined when replication is off. */
1296
1322
  private readonly establishReplicaStamp;
1297
1323
  private readonly replicationControl?;
@@ -1300,6 +1326,8 @@ declare class TinyCloudNode {
1300
1326
  private _hooks?;
1301
1327
  private _vault?;
1302
1328
  private _encryption?;
1329
+ private _namedKeyClient?;
1330
+ private _keysUnavailable;
1303
1331
  private _baseVaults;
1304
1332
  private _baseSecrets;
1305
1333
  private _secrets;
@@ -1421,6 +1449,12 @@ declare class TinyCloudNode {
1421
1449
  * the unsubscribe function.
1422
1450
  */
1423
1451
  on(event: "storage.full", handler: (event: StorageFullEvent) => void): () => void;
1452
+ /**
1453
+ * Subscribe to `replica.purge.failed`. It fires when the browser local copy could not be erased
1454
+ * after the bounded retries (sign-out, account switch or `purgeLocalCopy()`). The event carries the
1455
+ * typed gate reason and `retryNow`; the SDK retries again on the next load. Returns the unsubscribe function.
1456
+ */
1457
+ on(event: "replica.purge.failed", handler: (event: ReplicaPurgeFailedEvent) => void): () => void;
1424
1458
  /**
1425
1459
  * Storage episode state for the UI mount. @internal
1426
1460
  *
@@ -1611,6 +1645,12 @@ declare class TinyCloudNode {
1611
1645
  */
1612
1646
  signOut(): Promise<void>;
1613
1647
  private endSession;
1648
+ /**
1649
+ * Erases the browser local copy after a deny (retry, event and next-load marker live in the lazy
1650
+ * replication authority). Never rejects; `undefined` when replication is off or the storage keeps
1651
+ * no browser database.
1652
+ */
1653
+ private eraseReplicaLocalCopy;
1614
1654
  /**
1615
1655
  * Step 1 of replica sign-out. Never rejects: failures come back as `unguarded` so the session
1616
1656
  * is still cleared. Returns `undefined` when replication is off.
@@ -1637,6 +1677,10 @@ declare class TinyCloudNode {
1637
1677
  * bytes before the network session or replica stamp is committed.
1638
1678
  */
1639
1679
  signInWithOpenKey(authorizeFn: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[0], options?: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[1]): Promise<void>;
1680
+ /** Prepare the OpenKey request before the approval click. */
1681
+ prepareOpenKeySignIn(): Promise<PreparedOpenKeyAuthorization>;
1682
+ /** Start OpenKey authorization synchronously, then complete normal session setup. */
1683
+ signInWithPreparedOpenKey(pending: PreparedOpenKeyAuthorization, authorizeFn: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[0]): Promise<void>;
1640
1684
  private signInWith;
1641
1685
  private establishSignIn;
1642
1686
  /**
@@ -2067,7 +2111,7 @@ declare class TinyCloudNode {
2067
2111
  * Sign a wallet (CACAO) revocation of the delegation `cid` for the node's
2068
2112
  * `POST /revoke`, and return its Authorization header value. The node
2069
2113
  * accepts it when the owner delegated `cid` or owns a space its abilities
2070
- * target, whichever key issued it. Valid for 60 seconds. Requires the
2114
+ * target, whichever key issued it. Valid for 10 minutes. Requires the
2071
2115
  * owner wallet signer.
2072
2116
  */
2073
2117
  signOwnerRevocation(cid: string): Promise<string>;
@@ -2149,6 +2193,10 @@ declare class TinyCloudNode {
2149
2193
  * Network-scoped encryption/decrypt service.
2150
2194
  */
2151
2195
  get encryption(): IEncryptionService;
2196
+ /** Named keys bound to the current session. */
2197
+ get keys(): NamedKeyClient;
2198
+ /** Manifest key paths unavailable during the latest `signIn()` attempt. */
2199
+ get keysUnavailable(): readonly string[];
2152
2200
  getEncryptionNetwork(nameOrNetworkId?: string): Promise<NetworkDescriptor | null>;
2153
2201
  createEncryptionNetwork(name?: string): Promise<NetworkDescriptor>;
2154
2202
  /**
@@ -2685,4 +2733,4 @@ declare class TinyCloudNode {
2685
2733
  }): Promise<PortableDelegation>;
2686
2734
  }
2687
2735
 
2688
- export { ACCEPTED_MARKER_VERSIONS as A, type BootstrapWarning as B, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, InvalidRestoredSessionError as I, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type RuntimePermissionGrantOptions as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type DelegateToResult as a, DelegatedAccess as b, NodeUserAuthorization as c, type NodeUserAuthorizationConfig as d, type SecretReadInput as e, type SecretReadResult as f, type SignStrategy as g, type TinyCloudNodeConfig as h, type UnifiedOwnerRootReceipt as i, UnsupportedSessionRestoreError as j, defaultSignStrategy as k, BOOTSTRAP_COMPLETION_MARKER_KEY as l, BOOTSTRAP_COMPLETION_MARKER_VERSION as m, type BootstrapCompletionMarker as n, type NodeUserAuthorizationAuthorizeFn as o, type OpenKeyAuthorizationResultV1 as p, type OpenKeyAuthorizeInput as q, type OpenKeyAuthorizeTinyCloud as r, type OpenKeyBridgeInput as s, type RestorableSession as t, wireOpenKeyAuthorize as w };
2736
+ export { ACCEPTED_MARKER_VERSIONS as A, type BootstrapWarning as B, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, InvalidRestoredSessionError as I, type NodeEventEmitterStrategy as N, type OpenKeyAuthorizeTinyCloud as O, type PreparedOpenKeyAuthorization as P, type RuntimePermissionGrantOptions as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type DelegateToResult as a, DelegatedAccess as b, NodeUserAuthorization as c, type NodeUserAuthorizationConfig as d, type OwnerDelegationReceipt as e, type SecretReadInput as f, type SecretReadResult as g, type SignStrategy as h, type TinyCloudNodeConfig as i, type UnifiedOwnerRootReceipt as j, UnsupportedSessionRestoreError as k, defaultSignStrategy as l, BOOTSTRAP_COMPLETION_MARKER_KEY as m, BOOTSTRAP_COMPLETION_MARKER_VERSION as n, type BootstrapCompletionMarker as o, type NodeUserAuthorizationAuthorizeFn as p, type OpenKeyAuthorizationResultV1 as q, type OpenKeyAuthorizeInput as r, type OpenKeyBridgeInput as s, type RestorableSession as t, wireOpenKeyAuthorize as w };
@@ -1,9 +1,10 @@
1
1
  import * as _tinycloud_sdk_core from '@tinycloud/sdk-core';
2
2
  import { AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, CapabilityPresentationEnvelopeV1, IUserAuthorization, ISigner, ISessionStorage, ISpaceCreationHandler, RegistryPolicy, RegistrySequenceStore, OnNodeNotFound, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ReplicationOptions, TinyCloudSession, PersistedSessionData, ClientSession, PermissionEntry, Extension, SignRequest, SpaceHostResult, SignInOptions, TelemetryConfig, ServiceContext, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, Delegation, StorageFullEvent, IStorageService, INotificationHandler, IENSResolver, RetryPolicy, KVReplicaStorage, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ServiceSession, ReplicationControl, ResolvedDelegate } from '@tinycloud/sdk-core';
3
- import { ReplicaSessionStamp } from '@tinycloud/sdk-services/kv/replication';
3
+ import { ReplicaPurgeFailedEvent, ReplicaSessionStamp } from '@tinycloud/sdk-services/kv/replication';
4
4
  import { InvokeFunction, InvokeAnyFunction, FetchFunction, RequestSink, RequestLogReader } from '@tinycloud/sdk-services';
5
+ import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
5
6
  import { EventEmitter } from 'events';
6
- import { P as PortableDelegation, S as SessionGrantProof, g as VerifiedSessionGrant } from './delegation-0LKZkmP2.cjs';
7
+ import { P as PortableDelegation, S as SessionGrantProof, h as VerifiedSessionGrant } from './delegation-Ckc3UETl.js';
7
8
 
8
9
  /**
9
10
  * Node.js-specific SignStrategy types for TinyCloud authorization.
@@ -80,6 +81,8 @@ interface OpenKeyAuthorizeTinyCloud {
80
81
  * validates and size-bounds it before use.
81
82
  */
82
83
  presentation?: CapabilityPresentationEnvelopeV1;
84
+ }, opts?: {
85
+ mode?: "iframe" | "popup" | "redirect";
83
86
  }): Promise<{
84
87
  protocolVersion: 1;
85
88
  address: string;
@@ -142,9 +145,22 @@ type NodeUserAuthorizationAuthorizeFn = (input: OpenKeyBridgeInput) => Promise<{
142
145
  * const clientSession = await nodeAuth.signInWithOpenKey(authorize);
143
146
  * ```
144
147
  */
145
- declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud): NodeUserAuthorizationAuthorizeFn;
148
+ declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud, opts?: {
149
+ mode?: "iframe" | "popup" | "redirect";
150
+ }): NodeUserAuthorizationAuthorizeFn;
146
151
 
147
152
  type OpenKeyAuthorizeInput = OpenKeyBridgeInput;
153
+ /** SIWE and session key prepared before an OpenKey approval click. */
154
+ interface PreparedOpenKeyAuthorization {
155
+ readonly request: OpenKeyAuthorizeInput;
156
+ readonly prepared: PreparedOpenKeySession;
157
+ readonly keyId: string;
158
+ readonly jwk: Record<string, unknown>;
159
+ readonly address: string;
160
+ readonly chainId: number;
161
+ readonly generation: number;
162
+ readonly createdAt: number;
163
+ }
148
164
  type OpenKeyAuthorizationResultV1 = Awaited<ReturnType<NodeUserAuthorizationAuthorizeFn>>;
149
165
  type PreparedOpenKeySession = {
150
166
  siwe: string;
@@ -365,6 +381,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
365
381
  private readonly includeAccountRegistryPermissions;
366
382
  private sessionManager;
367
383
  private activeSessionKeyId;
384
+ private preparedSessionCounter;
368
385
  /** Incremented by resetSession; a sign-in started earlier publishes nothing. */
369
386
  private sessionGeneration;
370
387
  /**
@@ -515,6 +532,9 @@ declare class NodeUserAuthorization implements IUserAuthorization {
515
532
  * @internal
516
533
  */
517
534
  private getCapabilityRequest;
535
+ private refreshNamedKeyFeatureForSignIn;
536
+ /** Manifest key paths that this sign-in cannot grant. */
537
+ get unavailableKeyPaths(): string[];
518
538
  private resolveSpaceName;
519
539
  /**
520
540
  * The plain-session primary abilities: `defaultActions` (the shared table)
@@ -734,6 +754,10 @@ declare class NodeUserAuthorization implements IUserAuthorization {
734
754
  */
735
755
  retryResult?: (error: Error, originalRequest: OpenKeyAuthorizeInput, attempt: number) => Promise<OpenKeyAuthorizationResultV1 | null>;
736
756
  }): Promise<ClientSession>;
757
+ /** Finish address, host and SIWE preparation before an approval click. */
758
+ prepareOpenKeySignIn(options?: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[1]): Promise<PreparedOpenKeyAuthorization>;
759
+ /** Complete a prepared approval. The caller starts authorization before awaiting this method. */
760
+ completeOpenKeySignIn(pending: PreparedOpenKeyAuthorization, authorization: Promise<OpenKeyAuthorizationResultV1>, options?: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[1]): Promise<ClientSession>;
737
761
  /**
738
762
  * Build a `CapabilityPresentationEnvelopeV1` from `this._manifest`. The
739
763
  * envelope is display-only — the OpenKey widget renders it under an
@@ -1276,6 +1300,7 @@ declare class TinyCloudNode {
1276
1300
  private readonly explicitHost?;
1277
1301
  private signer;
1278
1302
  private auth;
1303
+ private readonly consumedOpenKeyPendings;
1279
1304
  private tc;
1280
1305
  private _address?;
1281
1306
  private _chainId;
@@ -1292,6 +1317,7 @@ declare class TinyCloudNode {
1292
1317
  private replicaRestoreGate?;
1293
1318
  private replicaSessionPrincipal?;
1294
1319
  private replicaSessionStamp?;
1320
+ private readonly replicaPurgeFailedHandlers;
1295
1321
  /** Mints the replica session stamp on each fresh sign-in (TC-858 §4.1). Undefined when replication is off. */
1296
1322
  private readonly establishReplicaStamp;
1297
1323
  private readonly replicationControl?;
@@ -1300,6 +1326,8 @@ declare class TinyCloudNode {
1300
1326
  private _hooks?;
1301
1327
  private _vault?;
1302
1328
  private _encryption?;
1329
+ private _namedKeyClient?;
1330
+ private _keysUnavailable;
1303
1331
  private _baseVaults;
1304
1332
  private _baseSecrets;
1305
1333
  private _secrets;
@@ -1421,6 +1449,12 @@ declare class TinyCloudNode {
1421
1449
  * the unsubscribe function.
1422
1450
  */
1423
1451
  on(event: "storage.full", handler: (event: StorageFullEvent) => void): () => void;
1452
+ /**
1453
+ * Subscribe to `replica.purge.failed`. It fires when the browser local copy could not be erased
1454
+ * after the bounded retries (sign-out, account switch or `purgeLocalCopy()`). The event carries the
1455
+ * typed gate reason and `retryNow`; the SDK retries again on the next load. Returns the unsubscribe function.
1456
+ */
1457
+ on(event: "replica.purge.failed", handler: (event: ReplicaPurgeFailedEvent) => void): () => void;
1424
1458
  /**
1425
1459
  * Storage episode state for the UI mount. @internal
1426
1460
  *
@@ -1611,6 +1645,12 @@ declare class TinyCloudNode {
1611
1645
  */
1612
1646
  signOut(): Promise<void>;
1613
1647
  private endSession;
1648
+ /**
1649
+ * Erases the browser local copy after a deny (retry, event and next-load marker live in the lazy
1650
+ * replication authority). Never rejects; `undefined` when replication is off or the storage keeps
1651
+ * no browser database.
1652
+ */
1653
+ private eraseReplicaLocalCopy;
1614
1654
  /**
1615
1655
  * Step 1 of replica sign-out. Never rejects: failures come back as `unguarded` so the session
1616
1656
  * is still cleared. Returns `undefined` when replication is off.
@@ -1637,6 +1677,10 @@ declare class TinyCloudNode {
1637
1677
  * bytes before the network session or replica stamp is committed.
1638
1678
  */
1639
1679
  signInWithOpenKey(authorizeFn: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[0], options?: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[1]): Promise<void>;
1680
+ /** Prepare the OpenKey request before the approval click. */
1681
+ prepareOpenKeySignIn(): Promise<PreparedOpenKeyAuthorization>;
1682
+ /** Start OpenKey authorization synchronously, then complete normal session setup. */
1683
+ signInWithPreparedOpenKey(pending: PreparedOpenKeyAuthorization, authorizeFn: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[0]): Promise<void>;
1640
1684
  private signInWith;
1641
1685
  private establishSignIn;
1642
1686
  /**
@@ -2067,7 +2111,7 @@ declare class TinyCloudNode {
2067
2111
  * Sign a wallet (CACAO) revocation of the delegation `cid` for the node's
2068
2112
  * `POST /revoke`, and return its Authorization header value. The node
2069
2113
  * accepts it when the owner delegated `cid` or owns a space its abilities
2070
- * target, whichever key issued it. Valid for 60 seconds. Requires the
2114
+ * target, whichever key issued it. Valid for 10 minutes. Requires the
2071
2115
  * owner wallet signer.
2072
2116
  */
2073
2117
  signOwnerRevocation(cid: string): Promise<string>;
@@ -2149,6 +2193,10 @@ declare class TinyCloudNode {
2149
2193
  * Network-scoped encryption/decrypt service.
2150
2194
  */
2151
2195
  get encryption(): IEncryptionService;
2196
+ /** Named keys bound to the current session. */
2197
+ get keys(): NamedKeyClient;
2198
+ /** Manifest key paths unavailable during the latest `signIn()` attempt. */
2199
+ get keysUnavailable(): readonly string[];
2152
2200
  getEncryptionNetwork(nameOrNetworkId?: string): Promise<NetworkDescriptor | null>;
2153
2201
  createEncryptionNetwork(name?: string): Promise<NetworkDescriptor>;
2154
2202
  /**
@@ -2685,4 +2733,4 @@ declare class TinyCloudNode {
2685
2733
  }): Promise<PortableDelegation>;
2686
2734
  }
2687
2735
 
2688
- export { ACCEPTED_MARKER_VERSIONS as A, type BootstrapWarning as B, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, InvalidRestoredSessionError as I, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type RuntimePermissionGrantOptions as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type DelegateToResult as a, DelegatedAccess as b, NodeUserAuthorization as c, type NodeUserAuthorizationConfig as d, type SecretReadInput as e, type SecretReadResult as f, type SignStrategy as g, type TinyCloudNodeConfig as h, type UnifiedOwnerRootReceipt as i, UnsupportedSessionRestoreError as j, defaultSignStrategy as k, BOOTSTRAP_COMPLETION_MARKER_KEY as l, BOOTSTRAP_COMPLETION_MARKER_VERSION as m, type BootstrapCompletionMarker as n, type NodeUserAuthorizationAuthorizeFn as o, type OpenKeyAuthorizationResultV1 as p, type OpenKeyAuthorizeInput as q, type OpenKeyAuthorizeTinyCloud as r, type OpenKeyBridgeInput as s, type RestorableSession as t, wireOpenKeyAuthorize as w };
2736
+ export { ACCEPTED_MARKER_VERSIONS as A, type BootstrapWarning as B, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, InvalidRestoredSessionError as I, type NodeEventEmitterStrategy as N, type OpenKeyAuthorizeTinyCloud as O, type PreparedOpenKeyAuthorization as P, type RuntimePermissionGrantOptions as R, type SecretPermissionHint as S, TinyCloudNode as T, type UnifiedOwnerRootInput as U, type DelegateToResult as a, DelegatedAccess as b, NodeUserAuthorization as c, type NodeUserAuthorizationConfig as d, type OwnerDelegationReceipt as e, type SecretReadInput as f, type SecretReadResult as g, type SignStrategy as h, type TinyCloudNodeConfig as i, type UnifiedOwnerRootReceipt as j, UnsupportedSessionRestoreError as k, defaultSignStrategy as l, BOOTSTRAP_COMPLETION_MARKER_KEY as m, BOOTSTRAP_COMPLETION_MARKER_VERSION as n, type BootstrapCompletionMarker as o, type NodeUserAuthorizationAuthorizeFn as p, type OpenKeyAuthorizationResultV1 as q, type OpenKeyAuthorizeInput as r, type OpenKeyBridgeInput as s, type RestorableSession as t, wireOpenKeyAuthorize as w };
@@ -1,7 +1,7 @@
1
1
  import { ReplicationOptions, PermissionEntry, TinyCloudSession, KVReplicaStorage, ServiceContext, IWasmBindings, WasmRecapEntry } from '@tinycloud/sdk-core';
2
2
  import { ReplicaConsentAnchor, AuthorityRefusal, ReplicationAuthority } from '@tinycloud/sdk-services';
3
- import { ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
- import { T as TinyCloudNode } from './TinyCloudNode-DDfx8Fx5.cjs';
3
+ import { ReplicaLocalEraseOutcome, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaPurgeFailedEvent, ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
+ import { T as TinyCloudNode } from './TinyCloudNode-BVDUdEcf.cjs';
5
5
 
6
6
  /** Constructor-time validation; the space-dependent secrets check runs at sign-in and open. */
7
7
  declare function assertValidReplicationConfig(replication: (ReplicationOptions & {
@@ -21,6 +21,20 @@ declare function reportReplicaDenial(result: {
21
21
  code?: string;
22
22
  intents?: number;
23
23
  }, reason: ReplicaDenyInput["reason"], onEvent: ReplicationOptions["onEvent"], context?: ServiceContext): void;
24
+ /** What the root needs after a local-copy erase: the outcome, the `purgeLocalCopy()` result and the marker state. */
25
+ interface ReplicaLocalEraseReport {
26
+ outcome: ReplicaLocalEraseOutcome;
27
+ purge: ReplicaPurgeLocalCopyResult;
28
+ /** The logout marker is set: the next load finishes the erase and the replica stays gated meanwhile. */
29
+ logoutPending?: true;
30
+ }
31
+ /**
32
+ * Erases the browser local copy after a deny, retrying a `failed` outcome with the delays above. After
33
+ * the last failure (or a refusal while the deny kept the keys) it notifies `handlers` with
34
+ * `replica.purge.failed`; the logout marker the lifecycle set makes the next load finish the erase.
35
+ * Never rejects. `undefined`: this storage has no browser local copy to erase.
36
+ */
37
+ declare function eraseReplicaLocalCopy(lifecycle: KVReplicaStorage["lifecycle"], trigger: ReplicaPurgeTrigger, denyStatus: string | undefined, handlers: ReadonlySet<(event: ReplicaPurgeFailedEvent) => void>): Promise<ReplicaLocalEraseReport | undefined>;
24
38
  /** The verified owner proof is signed, finite, exact-space, and uncaveated on one get+sync scope. */
25
39
  declare function verifiedOwnerConsentAnchor(session: TinyCloudSession, wasmBindings: Pick<IWasmBindings, "validatePersistedSession">, exactVerifiedRecap: (verified: {
26
40
  verifiedRecap?: unknown;
@@ -96,12 +110,14 @@ declare function createReplicationAuthority(host: ReplicationAuthorityHost): Rep
96
110
 
97
111
  declare const __authority_AUTHORITY_EXPIRY_MARGIN_MS: typeof AUTHORITY_EXPIRY_MARGIN_MS;
98
112
  type __authority_DelegationPlanResult = DelegationPlanResult;
113
+ type __authority_ReplicaLocalEraseReport = ReplicaLocalEraseReport;
99
114
  type __authority_ReplicationAuthorityHost = ReplicationAuthorityHost;
100
115
  type __authority_ReplicationAuthoritySession = ReplicationAuthoritySession;
101
116
  declare const __authority_assertRenewalParent: typeof assertRenewalParent;
102
117
  declare const __authority_assertValidReplicationConfig: typeof assertValidReplicationConfig;
103
118
  declare const __authority_augmentSignInEntriesWithReplication: typeof augmentSignInEntriesWithReplication;
104
119
  declare const __authority_createReplicationAuthority: typeof createReplicationAuthority;
120
+ declare const __authority_eraseReplicaLocalCopy: typeof eraseReplicaLocalCopy;
105
121
  declare const __authority_establishReplicaSessionStamp: typeof establishReplicaSessionStamp;
106
122
  declare const __authority_hasUnrestrictedGetCoverage: typeof hasUnrestrictedGetCoverage;
107
123
  declare const __authority_mintNodeReplicationGrant: typeof mintNodeReplicationGrant;
@@ -112,7 +128,7 @@ declare const __authority_ucanAttCovers: typeof ucanAttCovers;
112
128
  declare const __authority_ucanAttUnconstrainedFor: typeof ucanAttUnconstrainedFor;
113
129
  declare const __authority_verifiedOwnerConsentAnchor: typeof verifiedOwnerConsentAnchor;
114
130
  declare namespace __authority {
115
- export { __authority_AUTHORITY_EXPIRY_MARGIN_MS as AUTHORITY_EXPIRY_MARGIN_MS, type __authority_DelegationPlanResult as DelegationPlanResult, type __authority_ReplicationAuthorityHost as ReplicationAuthorityHost, type __authority_ReplicationAuthoritySession as ReplicationAuthoritySession, __authority_assertRenewalParent as assertRenewalParent, __authority_assertValidReplicationConfig as assertValidReplicationConfig, __authority_augmentSignInEntriesWithReplication as augmentSignInEntriesWithReplication, __authority_createReplicationAuthority as createReplicationAuthority, __authority_establishReplicaSessionStamp as establishReplicaSessionStamp, __authority_hasUnrestrictedGetCoverage as hasUnrestrictedGetCoverage, __authority_mintNodeReplicationGrant as mintNodeReplicationGrant, __authority_replicationScopeFromSignedSession as replicationScopeFromSignedSession, __authority_reportReplicaDenial as reportReplicaDenial, __authority_restoreReplicaSessionStamp as restoreReplicaSessionStamp, __authority_ucanAttCovers as ucanAttCovers, __authority_ucanAttUnconstrainedFor as ucanAttUnconstrainedFor, __authority_verifiedOwnerConsentAnchor as verifiedOwnerConsentAnchor };
131
+ export { __authority_AUTHORITY_EXPIRY_MARGIN_MS as AUTHORITY_EXPIRY_MARGIN_MS, type __authority_DelegationPlanResult as DelegationPlanResult, type __authority_ReplicaLocalEraseReport as ReplicaLocalEraseReport, type __authority_ReplicationAuthorityHost as ReplicationAuthorityHost, type __authority_ReplicationAuthoritySession as ReplicationAuthoritySession, __authority_assertRenewalParent as assertRenewalParent, __authority_assertValidReplicationConfig as assertValidReplicationConfig, __authority_augmentSignInEntriesWithReplication as augmentSignInEntriesWithReplication, __authority_createReplicationAuthority as createReplicationAuthority, __authority_eraseReplicaLocalCopy as eraseReplicaLocalCopy, __authority_establishReplicaSessionStamp as establishReplicaSessionStamp, __authority_hasUnrestrictedGetCoverage as hasUnrestrictedGetCoverage, __authority_mintNodeReplicationGrant as mintNodeReplicationGrant, __authority_replicationScopeFromSignedSession as replicationScopeFromSignedSession, __authority_reportReplicaDenial as reportReplicaDenial, __authority_restoreReplicaSessionStamp as restoreReplicaSessionStamp, __authority_ucanAttCovers as ucanAttCovers, __authority_ucanAttUnconstrainedFor as ucanAttUnconstrainedFor, __authority_verifiedOwnerConsentAnchor as verifiedOwnerConsentAnchor };
116
132
  }
117
133
 
118
- export { AUTHORITY_EXPIRY_MARGIN_MS as A, type DelegationPlanResult as D, type ReplicationAuthorityHost as R, __authority as _, type ReplicationAuthoritySession as a, assertRenewalParent as b, assertValidReplicationConfig as c, augmentSignInEntriesWithReplication as d, createReplicationAuthority as e, establishReplicaSessionStamp as f, reportReplicaDenial as g, hasUnrestrictedGetCoverage as h, restoreReplicaSessionStamp as i, ucanAttUnconstrainedFor as j, mintNodeReplicationGrant as m, replicationScopeFromSignedSession as r, ucanAttCovers as u, verifiedOwnerConsentAnchor as v };
134
+ export { AUTHORITY_EXPIRY_MARGIN_MS as A, type DelegationPlanResult as D, type ReplicaLocalEraseReport as R, __authority as _, type ReplicationAuthorityHost as a, type ReplicationAuthoritySession as b, assertRenewalParent as c, assertValidReplicationConfig as d, augmentSignInEntriesWithReplication as e, createReplicationAuthority as f, eraseReplicaLocalCopy as g, establishReplicaSessionStamp as h, hasUnrestrictedGetCoverage as i, reportReplicaDenial as j, restoreReplicaSessionStamp as k, ucanAttUnconstrainedFor as l, mintNodeReplicationGrant as m, replicationScopeFromSignedSession as r, ucanAttCovers as u, verifiedOwnerConsentAnchor as v };
@@ -1,7 +1,7 @@
1
1
  import { ReplicationOptions, PermissionEntry, TinyCloudSession, KVReplicaStorage, ServiceContext, IWasmBindings, WasmRecapEntry } from '@tinycloud/sdk-core';
2
2
  import { ReplicaConsentAnchor, AuthorityRefusal, ReplicationAuthority } from '@tinycloud/sdk-services';
3
- import { ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
- import { T as TinyCloudNode } from './TinyCloudNode-Ckqu_fqH.js';
3
+ import { ReplicaLocalEraseOutcome, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaPurgeFailedEvent, ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
+ import { T as TinyCloudNode } from './TinyCloudNode-jMK_2Uj8.js';
5
5
 
6
6
  /** Constructor-time validation; the space-dependent secrets check runs at sign-in and open. */
7
7
  declare function assertValidReplicationConfig(replication: (ReplicationOptions & {
@@ -21,6 +21,20 @@ declare function reportReplicaDenial(result: {
21
21
  code?: string;
22
22
  intents?: number;
23
23
  }, reason: ReplicaDenyInput["reason"], onEvent: ReplicationOptions["onEvent"], context?: ServiceContext): void;
24
+ /** What the root needs after a local-copy erase: the outcome, the `purgeLocalCopy()` result and the marker state. */
25
+ interface ReplicaLocalEraseReport {
26
+ outcome: ReplicaLocalEraseOutcome;
27
+ purge: ReplicaPurgeLocalCopyResult;
28
+ /** The logout marker is set: the next load finishes the erase and the replica stays gated meanwhile. */
29
+ logoutPending?: true;
30
+ }
31
+ /**
32
+ * Erases the browser local copy after a deny, retrying a `failed` outcome with the delays above. After
33
+ * the last failure (or a refusal while the deny kept the keys) it notifies `handlers` with
34
+ * `replica.purge.failed`; the logout marker the lifecycle set makes the next load finish the erase.
35
+ * Never rejects. `undefined`: this storage has no browser local copy to erase.
36
+ */
37
+ declare function eraseReplicaLocalCopy(lifecycle: KVReplicaStorage["lifecycle"], trigger: ReplicaPurgeTrigger, denyStatus: string | undefined, handlers: ReadonlySet<(event: ReplicaPurgeFailedEvent) => void>): Promise<ReplicaLocalEraseReport | undefined>;
24
38
  /** The verified owner proof is signed, finite, exact-space, and uncaveated on one get+sync scope. */
25
39
  declare function verifiedOwnerConsentAnchor(session: TinyCloudSession, wasmBindings: Pick<IWasmBindings, "validatePersistedSession">, exactVerifiedRecap: (verified: {
26
40
  verifiedRecap?: unknown;
@@ -96,12 +110,14 @@ declare function createReplicationAuthority(host: ReplicationAuthorityHost): Rep
96
110
 
97
111
  declare const __authority_AUTHORITY_EXPIRY_MARGIN_MS: typeof AUTHORITY_EXPIRY_MARGIN_MS;
98
112
  type __authority_DelegationPlanResult = DelegationPlanResult;
113
+ type __authority_ReplicaLocalEraseReport = ReplicaLocalEraseReport;
99
114
  type __authority_ReplicationAuthorityHost = ReplicationAuthorityHost;
100
115
  type __authority_ReplicationAuthoritySession = ReplicationAuthoritySession;
101
116
  declare const __authority_assertRenewalParent: typeof assertRenewalParent;
102
117
  declare const __authority_assertValidReplicationConfig: typeof assertValidReplicationConfig;
103
118
  declare const __authority_augmentSignInEntriesWithReplication: typeof augmentSignInEntriesWithReplication;
104
119
  declare const __authority_createReplicationAuthority: typeof createReplicationAuthority;
120
+ declare const __authority_eraseReplicaLocalCopy: typeof eraseReplicaLocalCopy;
105
121
  declare const __authority_establishReplicaSessionStamp: typeof establishReplicaSessionStamp;
106
122
  declare const __authority_hasUnrestrictedGetCoverage: typeof hasUnrestrictedGetCoverage;
107
123
  declare const __authority_mintNodeReplicationGrant: typeof mintNodeReplicationGrant;
@@ -112,7 +128,7 @@ declare const __authority_ucanAttCovers: typeof ucanAttCovers;
112
128
  declare const __authority_ucanAttUnconstrainedFor: typeof ucanAttUnconstrainedFor;
113
129
  declare const __authority_verifiedOwnerConsentAnchor: typeof verifiedOwnerConsentAnchor;
114
130
  declare namespace __authority {
115
- export { __authority_AUTHORITY_EXPIRY_MARGIN_MS as AUTHORITY_EXPIRY_MARGIN_MS, type __authority_DelegationPlanResult as DelegationPlanResult, type __authority_ReplicationAuthorityHost as ReplicationAuthorityHost, type __authority_ReplicationAuthoritySession as ReplicationAuthoritySession, __authority_assertRenewalParent as assertRenewalParent, __authority_assertValidReplicationConfig as assertValidReplicationConfig, __authority_augmentSignInEntriesWithReplication as augmentSignInEntriesWithReplication, __authority_createReplicationAuthority as createReplicationAuthority, __authority_establishReplicaSessionStamp as establishReplicaSessionStamp, __authority_hasUnrestrictedGetCoverage as hasUnrestrictedGetCoverage, __authority_mintNodeReplicationGrant as mintNodeReplicationGrant, __authority_replicationScopeFromSignedSession as replicationScopeFromSignedSession, __authority_reportReplicaDenial as reportReplicaDenial, __authority_restoreReplicaSessionStamp as restoreReplicaSessionStamp, __authority_ucanAttCovers as ucanAttCovers, __authority_ucanAttUnconstrainedFor as ucanAttUnconstrainedFor, __authority_verifiedOwnerConsentAnchor as verifiedOwnerConsentAnchor };
131
+ export { __authority_AUTHORITY_EXPIRY_MARGIN_MS as AUTHORITY_EXPIRY_MARGIN_MS, type __authority_DelegationPlanResult as DelegationPlanResult, type __authority_ReplicaLocalEraseReport as ReplicaLocalEraseReport, type __authority_ReplicationAuthorityHost as ReplicationAuthorityHost, type __authority_ReplicationAuthoritySession as ReplicationAuthoritySession, __authority_assertRenewalParent as assertRenewalParent, __authority_assertValidReplicationConfig as assertValidReplicationConfig, __authority_augmentSignInEntriesWithReplication as augmentSignInEntriesWithReplication, __authority_createReplicationAuthority as createReplicationAuthority, __authority_eraseReplicaLocalCopy as eraseReplicaLocalCopy, __authority_establishReplicaSessionStamp as establishReplicaSessionStamp, __authority_hasUnrestrictedGetCoverage as hasUnrestrictedGetCoverage, __authority_mintNodeReplicationGrant as mintNodeReplicationGrant, __authority_replicationScopeFromSignedSession as replicationScopeFromSignedSession, __authority_reportReplicaDenial as reportReplicaDenial, __authority_restoreReplicaSessionStamp as restoreReplicaSessionStamp, __authority_ucanAttCovers as ucanAttCovers, __authority_ucanAttUnconstrainedFor as ucanAttUnconstrainedFor, __authority_verifiedOwnerConsentAnchor as verifiedOwnerConsentAnchor };
116
132
  }
117
133
 
118
- export { AUTHORITY_EXPIRY_MARGIN_MS as A, type DelegationPlanResult as D, type ReplicationAuthorityHost as R, __authority as _, type ReplicationAuthoritySession as a, assertRenewalParent as b, assertValidReplicationConfig as c, augmentSignInEntriesWithReplication as d, createReplicationAuthority as e, establishReplicaSessionStamp as f, reportReplicaDenial as g, hasUnrestrictedGetCoverage as h, restoreReplicaSessionStamp as i, ucanAttUnconstrainedFor as j, mintNodeReplicationGrant as m, replicationScopeFromSignedSession as r, ucanAttCovers as u, verifiedOwnerConsentAnchor as v };
134
+ export { AUTHORITY_EXPIRY_MARGIN_MS as A, type DelegationPlanResult as D, type ReplicaLocalEraseReport as R, __authority as _, type ReplicationAuthorityHost as a, type ReplicationAuthoritySession as b, assertRenewalParent as c, assertValidReplicationConfig as d, augmentSignInEntriesWithReplication as e, createReplicationAuthority as f, eraseReplicaLocalCopy as g, establishReplicaSessionStamp as h, hasUnrestrictedGetCoverage as i, reportReplicaDenial as j, restoreReplicaSessionStamp as k, ucanAttUnconstrainedFor as l, mintNodeReplicationGrant as m, replicationScopeFromSignedSession as r, ucanAttCovers as u, verifiedOwnerConsentAnchor as v };