@tinycloud/node-sdk 3.8.0-beta.0 → 3.8.0-beta.10

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-BtKzLDJX.d.ts → TinyCloudNode-DnD-SH6t.d.ts} +27 -4
  2. package/dist/{TinyCloudNode-ggmlnSfI.d.cts → TinyCloudNode-Dy65bxqs.d.cts} +27 -4
  3. package/dist/{authority-sJ6buHMj.d.ts → authority-BQnTX3fI.d.ts} +21 -5
  4. package/dist/{authority-_SYAE-uV.d.cts → authority-Rbye1U4o.d.cts} +21 -5
  5. package/dist/core.cjs +196 -29
  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 +190 -25
  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 +249 -41
  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 +236 -28
  24. package/dist/index.js.map +1 -1
  25. package/dist/replication/authority.cjs +43 -1
  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 +42 -1
  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.js';
7
8
 
8
9
  /**
9
10
  * Node.js-specific SignStrategy types for TinyCloud authorization.
@@ -275,7 +276,7 @@ interface NodeUserAuthorizationConfig {
275
276
  * unrestricted `get` covering it is already requested. Storage and
276
277
  * scheduling never reach this layer.
277
278
  */
278
- replication?: Pick<ReplicationOptions, "enabled" | "prefixes" | "allowSecrets">;
279
+ replication?: Pick<ReplicationOptions, "enabled" | "prefixes" | "allowSecrets" | "syncScope">;
279
280
  /** Extra top-level resource URIs and their abilities added to the sign-in ReCap (e.g. named-key prefixes). */
280
281
  additionalRawAbilities?: Record<string, string[]>;
281
282
  /**
@@ -515,6 +516,9 @@ declare class NodeUserAuthorization implements IUserAuthorization {
515
516
  * @internal
516
517
  */
517
518
  private getCapabilityRequest;
519
+ private refreshNamedKeyFeatureForSignIn;
520
+ /** Manifest key paths that this sign-in cannot grant. */
521
+ get unavailableKeyPaths(): string[];
518
522
  private resolveSpaceName;
519
523
  /**
520
524
  * The plain-session primary abilities: `defaultActions` (the shared table)
@@ -1292,6 +1296,7 @@ declare class TinyCloudNode {
1292
1296
  private replicaRestoreGate?;
1293
1297
  private replicaSessionPrincipal?;
1294
1298
  private replicaSessionStamp?;
1299
+ private readonly replicaPurgeFailedHandlers;
1295
1300
  /** Mints the replica session stamp on each fresh sign-in (TC-858 §4.1). Undefined when replication is off. */
1296
1301
  private readonly establishReplicaStamp;
1297
1302
  private readonly replicationControl?;
@@ -1300,6 +1305,8 @@ declare class TinyCloudNode {
1300
1305
  private _hooks?;
1301
1306
  private _vault?;
1302
1307
  private _encryption?;
1308
+ private _namedKeyClient?;
1309
+ private _keysUnavailable;
1303
1310
  private _baseVaults;
1304
1311
  private _baseSecrets;
1305
1312
  private _secrets;
@@ -1421,6 +1428,12 @@ declare class TinyCloudNode {
1421
1428
  * the unsubscribe function.
1422
1429
  */
1423
1430
  on(event: "storage.full", handler: (event: StorageFullEvent) => void): () => void;
1431
+ /**
1432
+ * Subscribe to `replica.purge.failed`. It fires when the browser local copy could not be erased
1433
+ * after the bounded retries (sign-out, account switch or `purgeLocalCopy()`). The event carries the
1434
+ * typed gate reason and `retryNow`; the SDK retries again on the next load. Returns the unsubscribe function.
1435
+ */
1436
+ on(event: "replica.purge.failed", handler: (event: ReplicaPurgeFailedEvent) => void): () => void;
1424
1437
  /**
1425
1438
  * Storage episode state for the UI mount. @internal
1426
1439
  *
@@ -1611,6 +1624,12 @@ declare class TinyCloudNode {
1611
1624
  */
1612
1625
  signOut(): Promise<void>;
1613
1626
  private endSession;
1627
+ /**
1628
+ * Erases the browser local copy after a deny (retry, event and next-load marker live in the lazy
1629
+ * replication authority). Never rejects; `undefined` when replication is off or the storage keeps
1630
+ * no browser database.
1631
+ */
1632
+ private eraseReplicaLocalCopy;
1614
1633
  /**
1615
1634
  * Step 1 of replica sign-out. Never rejects: failures come back as `unguarded` so the session
1616
1635
  * is still cleared. Returns `undefined` when replication is off.
@@ -2067,7 +2086,7 @@ declare class TinyCloudNode {
2067
2086
  * Sign a wallet (CACAO) revocation of the delegation `cid` for the node's
2068
2087
  * `POST /revoke`, and return its Authorization header value. The node
2069
2088
  * 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
2089
+ * target, whichever key issued it. Valid for 10 minutes. Requires the
2071
2090
  * owner wallet signer.
2072
2091
  */
2073
2092
  signOwnerRevocation(cid: string): Promise<string>;
@@ -2149,6 +2168,10 @@ declare class TinyCloudNode {
2149
2168
  * Network-scoped encryption/decrypt service.
2150
2169
  */
2151
2170
  get encryption(): IEncryptionService;
2171
+ /** Named keys bound to the current session. */
2172
+ get keys(): NamedKeyClient;
2173
+ /** Manifest key paths unavailable during the latest `signIn()` attempt. */
2174
+ get keysUnavailable(): readonly string[];
2152
2175
  getEncryptionNetwork(nameOrNetworkId?: string): Promise<NetworkDescriptor | null>;
2153
2176
  createEncryptionNetwork(name?: string): Promise<NetworkDescriptor>;
2154
2177
  /**
@@ -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.cjs';
7
8
 
8
9
  /**
9
10
  * Node.js-specific SignStrategy types for TinyCloud authorization.
@@ -275,7 +276,7 @@ interface NodeUserAuthorizationConfig {
275
276
  * unrestricted `get` covering it is already requested. Storage and
276
277
  * scheduling never reach this layer.
277
278
  */
278
- replication?: Pick<ReplicationOptions, "enabled" | "prefixes" | "allowSecrets">;
279
+ replication?: Pick<ReplicationOptions, "enabled" | "prefixes" | "allowSecrets" | "syncScope">;
279
280
  /** Extra top-level resource URIs and their abilities added to the sign-in ReCap (e.g. named-key prefixes). */
280
281
  additionalRawAbilities?: Record<string, string[]>;
281
282
  /**
@@ -515,6 +516,9 @@ declare class NodeUserAuthorization implements IUserAuthorization {
515
516
  * @internal
516
517
  */
517
518
  private getCapabilityRequest;
519
+ private refreshNamedKeyFeatureForSignIn;
520
+ /** Manifest key paths that this sign-in cannot grant. */
521
+ get unavailableKeyPaths(): string[];
518
522
  private resolveSpaceName;
519
523
  /**
520
524
  * The plain-session primary abilities: `defaultActions` (the shared table)
@@ -1292,6 +1296,7 @@ declare class TinyCloudNode {
1292
1296
  private replicaRestoreGate?;
1293
1297
  private replicaSessionPrincipal?;
1294
1298
  private replicaSessionStamp?;
1299
+ private readonly replicaPurgeFailedHandlers;
1295
1300
  /** Mints the replica session stamp on each fresh sign-in (TC-858 §4.1). Undefined when replication is off. */
1296
1301
  private readonly establishReplicaStamp;
1297
1302
  private readonly replicationControl?;
@@ -1300,6 +1305,8 @@ declare class TinyCloudNode {
1300
1305
  private _hooks?;
1301
1306
  private _vault?;
1302
1307
  private _encryption?;
1308
+ private _namedKeyClient?;
1309
+ private _keysUnavailable;
1303
1310
  private _baseVaults;
1304
1311
  private _baseSecrets;
1305
1312
  private _secrets;
@@ -1421,6 +1428,12 @@ declare class TinyCloudNode {
1421
1428
  * the unsubscribe function.
1422
1429
  */
1423
1430
  on(event: "storage.full", handler: (event: StorageFullEvent) => void): () => void;
1431
+ /**
1432
+ * Subscribe to `replica.purge.failed`. It fires when the browser local copy could not be erased
1433
+ * after the bounded retries (sign-out, account switch or `purgeLocalCopy()`). The event carries the
1434
+ * typed gate reason and `retryNow`; the SDK retries again on the next load. Returns the unsubscribe function.
1435
+ */
1436
+ on(event: "replica.purge.failed", handler: (event: ReplicaPurgeFailedEvent) => void): () => void;
1424
1437
  /**
1425
1438
  * Storage episode state for the UI mount. @internal
1426
1439
  *
@@ -1611,6 +1624,12 @@ declare class TinyCloudNode {
1611
1624
  */
1612
1625
  signOut(): Promise<void>;
1613
1626
  private endSession;
1627
+ /**
1628
+ * Erases the browser local copy after a deny (retry, event and next-load marker live in the lazy
1629
+ * replication authority). Never rejects; `undefined` when replication is off or the storage keeps
1630
+ * no browser database.
1631
+ */
1632
+ private eraseReplicaLocalCopy;
1614
1633
  /**
1615
1634
  * Step 1 of replica sign-out. Never rejects: failures come back as `unguarded` so the session
1616
1635
  * is still cleared. Returns `undefined` when replication is off.
@@ -2067,7 +2086,7 @@ declare class TinyCloudNode {
2067
2086
  * Sign a wallet (CACAO) revocation of the delegation `cid` for the node's
2068
2087
  * `POST /revoke`, and return its Authorization header value. The node
2069
2088
  * 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
2089
+ * target, whichever key issued it. Valid for 10 minutes. Requires the
2071
2090
  * owner wallet signer.
2072
2091
  */
2073
2092
  signOwnerRevocation(cid: string): Promise<string>;
@@ -2149,6 +2168,10 @@ declare class TinyCloudNode {
2149
2168
  * Network-scoped encryption/decrypt service.
2150
2169
  */
2151
2170
  get encryption(): IEncryptionService;
2171
+ /** Named keys bound to the current session. */
2172
+ get keys(): NamedKeyClient;
2173
+ /** Manifest key paths unavailable during the latest `signIn()` attempt. */
2174
+ get keysUnavailable(): readonly string[];
2152
2175
  getEncryptionNetwork(nameOrNetworkId?: string): Promise<NetworkDescriptor | null>;
2153
2176
  createEncryptionNetwork(name?: string): Promise<NetworkDescriptor>;
2154
2177
  /**
@@ -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-BtKzLDJX.js';
3
+ import { ReplicaLocalEraseOutcome, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaPurgeFailedEvent, ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
+ import { T as TinyCloudNode } from './TinyCloudNode-DnD-SH6t.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 & {
@@ -12,7 +12,7 @@ declare function hasUnrestrictedGetCoverage(entries: readonly PermissionEntry[],
12
12
  declare function augmentSignInEntriesWithReplication(input: {
13
13
  entries: readonly PermissionEntry[];
14
14
  primarySpaceId: string;
15
- replication?: Pick<ReplicationOptions, "prefixes" | "allowSecrets">;
15
+ replication?: Pick<ReplicationOptions, "prefixes" | "allowSecrets" | "syncScope">;
16
16
  }): PermissionEntry[];
17
17
 
18
18
  /** Report a completed deny from the already-loaded authority; delivery was revoked synchronously. */
@@ -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-ggmlnSfI.cjs';
3
+ import { ReplicaLocalEraseOutcome, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaPurgeFailedEvent, ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
+ import { T as TinyCloudNode } from './TinyCloudNode-Dy65bxqs.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 & {
@@ -12,7 +12,7 @@ declare function hasUnrestrictedGetCoverage(entries: readonly PermissionEntry[],
12
12
  declare function augmentSignInEntriesWithReplication(input: {
13
13
  entries: readonly PermissionEntry[];
14
14
  primarySpaceId: string;
15
- replication?: Pick<ReplicationOptions, "prefixes" | "allowSecrets">;
15
+ replication?: Pick<ReplicationOptions, "prefixes" | "allowSecrets" | "syncScope">;
16
16
  }): PermissionEntry[];
17
17
 
18
18
  /** Report a completed deny from the already-loaded authority; delivery was revoked synchronously. */
@@ -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 };