@tinycloud/node-sdk 3.8.0-beta.7 → 3.8.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.
Files changed (44) hide show
  1. package/README.md +6 -0
  2. package/dist/{TinyCloudNode-jPL2UqH5.d.ts → TinyCloudNode-DaD5vJhL.d.cts} +38 -5
  3. package/dist/{TinyCloudNode-C0LgPzzJ.d.cts → TinyCloudNode-k3TbBwwj.d.ts} +38 -5
  4. package/dist/{WasmKeyProvider-5Ee7fcAw.d.cts → WasmKeyProvider-BKCPRC-c.d.cts} +21 -1
  5. package/dist/{WasmKeyProvider-5Ee7fcAw.d.ts → WasmKeyProvider-BKCPRC-c.d.ts} +21 -1
  6. package/dist/{authority-DvHTgPC4.d.ts → authority-C_fWaxAu.d.ts} +1 -1
  7. package/dist/{authority-Dkhr6n-f.d.cts → authority-DJdbZM6k.d.cts} +1 -1
  8. package/dist/core.cjs +238 -29
  9. package/dist/core.cjs.map +1 -1
  10. package/dist/core.d.cts +4 -4
  11. package/dist/core.d.ts +4 -4
  12. package/dist/core.js +239 -30
  13. package/dist/core.js.map +1 -1
  14. package/dist/credentials-core.d.cts +1 -1
  15. package/dist/credentials-core.d.ts +1 -1
  16. package/dist/credentials.d.cts +1 -1
  17. package/dist/credentials.d.ts +1 -1
  18. package/dist/{delegation-0LKZkmP2.d.cts → delegation-Ckc3UETl.d.cts} +1 -1
  19. package/dist/{delegation-0LKZkmP2.d.ts → delegation-Ckc3UETl.d.ts} +1 -1
  20. package/dist/encryption-keys.d.cts +2 -2
  21. package/dist/encryption-keys.d.ts +2 -2
  22. package/dist/index.cjs +194 -30
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +3 -3
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +199 -32
  27. package/dist/index.js.map +1 -1
  28. package/dist/replication/authority.cjs +3 -0
  29. package/dist/replication/authority.cjs.map +1 -1
  30. package/dist/replication/authority.d.cts +3 -3
  31. package/dist/replication/authority.d.ts +3 -3
  32. package/dist/replication/authority.js +3 -0
  33. package/dist/replication/authority.js.map +1 -1
  34. package/dist/replication/runtime.cjs +1 -0
  35. package/dist/replication/runtime.cjs.map +1 -1
  36. package/dist/replication/runtime.js +1 -0
  37. package/dist/replication/runtime.js.map +1 -1
  38. package/dist/share-receive.cjs +775 -0
  39. package/dist/share-receive.cjs.map +1 -0
  40. package/dist/share-receive.d.cts +32 -0
  41. package/dist/share-receive.d.ts +32 -0
  42. package/dist/share-receive.js +777 -0
  43. package/dist/share-receive.js.map +1 -0
  44. package/package.json +11 -4
package/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tinycloud/node-sdk
2
2
 
3
+ ## Signed SIWE metadata
4
+
5
+ Set `siweConfig.resources` to `urn:tinycloud:recipients:<base64url>` URI strings to include a recipients declaration in the signed SIWE. The payload uses only unpadded base64url characters (`A–Z`, `a–z`, `0–9`, `_`, `-`). Node-sdk inserts these URIs immediately before the original ReCap resource, which remains last. Ordinary sign-in, external/OpenKey preparation, and bootstrap sessions use the same insertion path; completion and session storage retain the signed message unchanged.
6
+
7
+ These resources do not add permissions. Other schemes, percent encoding, escape sequences and literal controls are not accepted in this option. The generated statement and ReCap remain unchanged; `siweConfig.statement` does not replace the generated statement. Omitting resources or passing an empty array leaves the prepared message unchanged.
8
+
3
9
  ## `@tinycloud/node-sdk/credential-pending-store`
4
10
 
5
11
  File-backed pending store for the email-proof flow. It keeps one file per request under `<home>/credentials/`, named by a hash of the request id. The directory is created with mode 0700 and each file with mode 0600. Permissions and ownership are re-checked on every read. Only a `home` that is itself a symlink is refused; ancestors of `home` may be symlinks, but `realpath(home)` must be owned by the current user. Unsafe files are left in place and reported as an error.
@@ -4,7 +4,7 @@ import { ReplicaPurgeFailedEvent, ReplicaSessionStamp } from '@tinycloud/sdk-ser
4
4
  import { InvokeFunction, InvokeAnyFunction, FetchFunction, RequestSink, RequestLogReader } from '@tinycloud/sdk-services';
5
5
  import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
6
6
  import { EventEmitter } from 'events';
7
- 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';
8
8
 
9
9
  /**
10
10
  * Node.js-specific SignStrategy types for TinyCloud authorization.
@@ -81,6 +81,8 @@ interface OpenKeyAuthorizeTinyCloud {
81
81
  * validates and size-bounds it before use.
82
82
  */
83
83
  presentation?: CapabilityPresentationEnvelopeV1;
84
+ }, opts?: {
85
+ mode?: "iframe" | "popup" | "redirect";
84
86
  }): Promise<{
85
87
  protocolVersion: 1;
86
88
  address: string;
@@ -143,9 +145,22 @@ type NodeUserAuthorizationAuthorizeFn = (input: OpenKeyBridgeInput) => Promise<{
143
145
  * const clientSession = await nodeAuth.signInWithOpenKey(authorize);
144
146
  * ```
145
147
  */
146
- declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud): NodeUserAuthorizationAuthorizeFn;
148
+ declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud, opts?: {
149
+ mode?: "iframe" | "popup" | "redirect";
150
+ }): NodeUserAuthorizationAuthorizeFn;
147
151
 
148
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
+ }
149
164
  type OpenKeyAuthorizationResultV1 = Awaited<ReturnType<NodeUserAuthorizationAuthorizeFn>>;
150
165
  type PreparedOpenKeySession = {
151
166
  siwe: string;
@@ -366,6 +381,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
366
381
  private readonly includeAccountRegistryPermissions;
367
382
  private sessionManager;
368
383
  private activeSessionKeyId;
384
+ private preparedSessionCounter;
369
385
  /** Incremented by resetSession; a sign-in started earlier publishes nothing. */
370
386
  private sessionGeneration;
371
387
  /**
@@ -571,13 +587,13 @@ declare class NodeUserAuthorization implements IUserAuthorization {
571
587
  /**
572
588
  * Build SIWE overrides from the top-level nonce and siweConfig.
573
589
  * - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
574
- * - statement is prepended to the default statement
575
- * - resources are appended to the default resources
590
+ * - resources are inserted after WASM preparation, before the final ReCap
576
591
  * - uri triggers a warning (overwriting delegation target)
577
592
  * - all other fields override directly
578
593
  * - per-call nonce overrides siweConfig.nonce when provided
579
594
  */
580
595
  private buildSiweOverrides;
596
+ private prepareSessionWithResources;
581
597
  /**
582
598
  * Add an extension to the authorization flow.
583
599
  */
@@ -738,6 +754,10 @@ declare class NodeUserAuthorization implements IUserAuthorization {
738
754
  */
739
755
  retryResult?: (error: Error, originalRequest: OpenKeyAuthorizeInput, attempt: number) => Promise<OpenKeyAuthorizationResultV1 | null>;
740
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>;
741
761
  /**
742
762
  * Build a `CapabilityPresentationEnvelopeV1` from `this._manifest`. The
743
763
  * envelope is display-only — the OpenKey widget renders it under an
@@ -1171,6 +1191,8 @@ interface DelegateToResult {
1171
1191
  interface RuntimePermissionGrantOptions {
1172
1192
  /** Override expiry. ms-format string ("7d", "1h") or raw milliseconds. */
1173
1193
  expiry?: string | number;
1194
+ /** In-memory key snapshot captured when exact Share-key consent opened. */
1195
+ expectedSessionKey?: Readonly<TinyCloudSession["jwk"]>;
1174
1196
  }
1175
1197
  interface EnsureEncryptionNetworkOptions {
1176
1198
  /**
@@ -1280,6 +1302,7 @@ declare class TinyCloudNode {
1280
1302
  private readonly explicitHost?;
1281
1303
  private signer;
1282
1304
  private auth;
1305
+ private readonly consumedOpenKeyPendings;
1283
1306
  private tc;
1284
1307
  private _address?;
1285
1308
  private _chainId;
@@ -1656,6 +1679,10 @@ declare class TinyCloudNode {
1656
1679
  * bytes before the network session or replica stamp is committed.
1657
1680
  */
1658
1681
  signInWithOpenKey(authorizeFn: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[0], options?: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[1]): Promise<void>;
1682
+ /** Prepare the OpenKey request before the approval click. */
1683
+ prepareOpenKeySignIn(): Promise<PreparedOpenKeyAuthorization>;
1684
+ /** Start OpenKey authorization synchronously, then complete normal session setup. */
1685
+ signInWithPreparedOpenKey(pending: PreparedOpenKeyAuthorization, authorizeFn: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[0]): Promise<void>;
1659
1686
  private signInWith;
1660
1687
  private establishSignIn;
1661
1688
  /**
@@ -1960,6 +1987,12 @@ declare class TinyCloudNode {
1960
1987
  invokeAny(entries: Parameters<InvokeAnyFunction$1>[1], facts?: Parameters<InvokeAnyFunction$1>[2]): ReturnType<InvokeAnyFunction$1>;
1961
1988
  /** Sign protocol bytes with the established in-memory session key. */
1962
1989
  signSessionBytes(bytes: Uint8Array): Promise<Uint8Array>;
1990
+ /**
1991
+ * Signs proofless invocations with `session`'s own did:key, for the node's
1992
+ * issued-delegation list and revocation by the delegator. The audience is
1993
+ * this Node's DID; each invocation lives 60 seconds.
1994
+ */
1995
+ private sessionInvocationSignerFor;
1963
1996
  /** Author a proofless Policy/v3 owner root with the authenticated holder key. */
1964
1997
  createUnifiedOwnerRoot(input: UnifiedOwnerRootInput): Promise<UnifiedOwnerRootReceipt>;
1965
1998
  /** Apply only an already-enabled signing policy to the exact credential request. */
@@ -2708,4 +2741,4 @@ declare class TinyCloudNode {
2708
2741
  }): Promise<PortableDelegation>;
2709
2742
  }
2710
2743
 
2711
- 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 };
2744
+ 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 };
@@ -4,7 +4,7 @@ import { ReplicaPurgeFailedEvent, ReplicaSessionStamp } from '@tinycloud/sdk-ser
4
4
  import { InvokeFunction, InvokeAnyFunction, FetchFunction, RequestSink, RequestLogReader } from '@tinycloud/sdk-services';
5
5
  import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
6
6
  import { EventEmitter } from 'events';
7
- 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';
8
8
 
9
9
  /**
10
10
  * Node.js-specific SignStrategy types for TinyCloud authorization.
@@ -81,6 +81,8 @@ interface OpenKeyAuthorizeTinyCloud {
81
81
  * validates and size-bounds it before use.
82
82
  */
83
83
  presentation?: CapabilityPresentationEnvelopeV1;
84
+ }, opts?: {
85
+ mode?: "iframe" | "popup" | "redirect";
84
86
  }): Promise<{
85
87
  protocolVersion: 1;
86
88
  address: string;
@@ -143,9 +145,22 @@ type NodeUserAuthorizationAuthorizeFn = (input: OpenKeyBridgeInput) => Promise<{
143
145
  * const clientSession = await nodeAuth.signInWithOpenKey(authorize);
144
146
  * ```
145
147
  */
146
- declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud): NodeUserAuthorizationAuthorizeFn;
148
+ declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud, opts?: {
149
+ mode?: "iframe" | "popup" | "redirect";
150
+ }): NodeUserAuthorizationAuthorizeFn;
147
151
 
148
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
+ }
149
164
  type OpenKeyAuthorizationResultV1 = Awaited<ReturnType<NodeUserAuthorizationAuthorizeFn>>;
150
165
  type PreparedOpenKeySession = {
151
166
  siwe: string;
@@ -366,6 +381,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
366
381
  private readonly includeAccountRegistryPermissions;
367
382
  private sessionManager;
368
383
  private activeSessionKeyId;
384
+ private preparedSessionCounter;
369
385
  /** Incremented by resetSession; a sign-in started earlier publishes nothing. */
370
386
  private sessionGeneration;
371
387
  /**
@@ -571,13 +587,13 @@ declare class NodeUserAuthorization implements IUserAuthorization {
571
587
  /**
572
588
  * Build SIWE overrides from the top-level nonce and siweConfig.
573
589
  * - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
574
- * - statement is prepended to the default statement
575
- * - resources are appended to the default resources
590
+ * - resources are inserted after WASM preparation, before the final ReCap
576
591
  * - uri triggers a warning (overwriting delegation target)
577
592
  * - all other fields override directly
578
593
  * - per-call nonce overrides siweConfig.nonce when provided
579
594
  */
580
595
  private buildSiweOverrides;
596
+ private prepareSessionWithResources;
581
597
  /**
582
598
  * Add an extension to the authorization flow.
583
599
  */
@@ -738,6 +754,10 @@ declare class NodeUserAuthorization implements IUserAuthorization {
738
754
  */
739
755
  retryResult?: (error: Error, originalRequest: OpenKeyAuthorizeInput, attempt: number) => Promise<OpenKeyAuthorizationResultV1 | null>;
740
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>;
741
761
  /**
742
762
  * Build a `CapabilityPresentationEnvelopeV1` from `this._manifest`. The
743
763
  * envelope is display-only — the OpenKey widget renders it under an
@@ -1171,6 +1191,8 @@ interface DelegateToResult {
1171
1191
  interface RuntimePermissionGrantOptions {
1172
1192
  /** Override expiry. ms-format string ("7d", "1h") or raw milliseconds. */
1173
1193
  expiry?: string | number;
1194
+ /** In-memory key snapshot captured when exact Share-key consent opened. */
1195
+ expectedSessionKey?: Readonly<TinyCloudSession["jwk"]>;
1174
1196
  }
1175
1197
  interface EnsureEncryptionNetworkOptions {
1176
1198
  /**
@@ -1280,6 +1302,7 @@ declare class TinyCloudNode {
1280
1302
  private readonly explicitHost?;
1281
1303
  private signer;
1282
1304
  private auth;
1305
+ private readonly consumedOpenKeyPendings;
1283
1306
  private tc;
1284
1307
  private _address?;
1285
1308
  private _chainId;
@@ -1656,6 +1679,10 @@ declare class TinyCloudNode {
1656
1679
  * bytes before the network session or replica stamp is committed.
1657
1680
  */
1658
1681
  signInWithOpenKey(authorizeFn: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[0], options?: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[1]): Promise<void>;
1682
+ /** Prepare the OpenKey request before the approval click. */
1683
+ prepareOpenKeySignIn(): Promise<PreparedOpenKeyAuthorization>;
1684
+ /** Start OpenKey authorization synchronously, then complete normal session setup. */
1685
+ signInWithPreparedOpenKey(pending: PreparedOpenKeyAuthorization, authorizeFn: Parameters<NodeUserAuthorization["signInWithOpenKey"]>[0]): Promise<void>;
1659
1686
  private signInWith;
1660
1687
  private establishSignIn;
1661
1688
  /**
@@ -1960,6 +1987,12 @@ declare class TinyCloudNode {
1960
1987
  invokeAny(entries: Parameters<InvokeAnyFunction$1>[1], facts?: Parameters<InvokeAnyFunction$1>[2]): ReturnType<InvokeAnyFunction$1>;
1961
1988
  /** Sign protocol bytes with the established in-memory session key. */
1962
1989
  signSessionBytes(bytes: Uint8Array): Promise<Uint8Array>;
1990
+ /**
1991
+ * Signs proofless invocations with `session`'s own did:key, for the node's
1992
+ * issued-delegation list and revocation by the delegator. The audience is
1993
+ * this Node's DID; each invocation lives 60 seconds.
1994
+ */
1995
+ private sessionInvocationSignerFor;
1963
1996
  /** Author a proofless Policy/v3 owner root with the authenticated holder key. */
1964
1997
  createUnifiedOwnerRoot(input: UnifiedOwnerRootInput): Promise<UnifiedOwnerRootReceipt>;
1965
1998
  /** Apply only an already-enabled signing policy to the exact credential request. */
@@ -2708,4 +2741,4 @@ declare class TinyCloudNode {
2708
2741
  }): Promise<PortableDelegation>;
2709
2742
  }
2710
2743
 
2711
- 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 };
2744
+ 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 };
@@ -106,6 +106,26 @@ declare class FileSessionStorage implements ISessionStorage {
106
106
  isAvailable(): boolean;
107
107
  }
108
108
 
109
+ /**
110
+ * Whether sign-in at `origin` can be granted named-key abilities for the app
111
+ * whose manifest `keys_app_id` (or `app_id`) is `keysAppId`.
112
+ *
113
+ * "Bound" means the key app id equals the reversed host of the origin, or
114
+ * extends it with further dot-separated labels: `tinycloud.chat` binds
115
+ * `chat.tinycloud.tinychat` and `chat.tinycloud.tinychat.worker`. Origins with
116
+ * no registrable host (`localhost`, `tauri.localhost`, IP addresses) or with
117
+ * lookalike hosts (`evil-tinycloud.chat`, `tinycloud.chat.evil.com`) are not
118
+ * bound. `origin` is a URL, an origin string such as `https://tinycloud.chat`,
119
+ * or a bare SIWE domain such as `tinycloud.chat`; the host (including any
120
+ * non-default port, which makes the origin unbound) is what is checked.
121
+ *
122
+ * This is the check `NodeUserAuthorization` applies when it decides whether a
123
+ * manifest's `keys` rows are granted at sign-in. A bound origin still needs a
124
+ * node that lists `encryption-named-keys-v1` in `/info` to actually receive
125
+ * the row.
126
+ */
127
+ declare function isAppKeyHostBound(keysAppId: string, origin: string | URL): boolean;
128
+
109
129
  /**
110
130
  * WasmKeyProvider - KeyProvider implementation using WASM session manager.
111
131
  *
@@ -214,4 +234,4 @@ declare class WasmKeyProvider implements KeyProvider {
214
234
  */
215
235
  declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
216
236
 
217
- export { FileSessionStorage as F, MemorySessionStorage as M, WasmKeyProvider as W, type WasmKeyProviderConfig as a, createWasmKeyProvider as c };
237
+ export { FileSessionStorage as F, MemorySessionStorage as M, WasmKeyProvider as W, type WasmKeyProviderConfig as a, createWasmKeyProvider as c, isAppKeyHostBound as i };
@@ -106,6 +106,26 @@ declare class FileSessionStorage implements ISessionStorage {
106
106
  isAvailable(): boolean;
107
107
  }
108
108
 
109
+ /**
110
+ * Whether sign-in at `origin` can be granted named-key abilities for the app
111
+ * whose manifest `keys_app_id` (or `app_id`) is `keysAppId`.
112
+ *
113
+ * "Bound" means the key app id equals the reversed host of the origin, or
114
+ * extends it with further dot-separated labels: `tinycloud.chat` binds
115
+ * `chat.tinycloud.tinychat` and `chat.tinycloud.tinychat.worker`. Origins with
116
+ * no registrable host (`localhost`, `tauri.localhost`, IP addresses) or with
117
+ * lookalike hosts (`evil-tinycloud.chat`, `tinycloud.chat.evil.com`) are not
118
+ * bound. `origin` is a URL, an origin string such as `https://tinycloud.chat`,
119
+ * or a bare SIWE domain such as `tinycloud.chat`; the host (including any
120
+ * non-default port, which makes the origin unbound) is what is checked.
121
+ *
122
+ * This is the check `NodeUserAuthorization` applies when it decides whether a
123
+ * manifest's `keys` rows are granted at sign-in. A bound origin still needs a
124
+ * node that lists `encryption-named-keys-v1` in `/info` to actually receive
125
+ * the row.
126
+ */
127
+ declare function isAppKeyHostBound(keysAppId: string, origin: string | URL): boolean;
128
+
109
129
  /**
110
130
  * WasmKeyProvider - KeyProvider implementation using WASM session manager.
111
131
  *
@@ -214,4 +234,4 @@ declare class WasmKeyProvider implements KeyProvider {
214
234
  */
215
235
  declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
216
236
 
217
- export { FileSessionStorage as F, MemorySessionStorage as M, WasmKeyProvider as W, type WasmKeyProviderConfig as a, createWasmKeyProvider as c };
237
+ export { FileSessionStorage as F, MemorySessionStorage as M, WasmKeyProvider as W, type WasmKeyProviderConfig as a, createWasmKeyProvider as c, isAppKeyHostBound as i };
@@ -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
3
  import { ReplicaLocalEraseOutcome, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaPurgeFailedEvent, ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
- import { T as TinyCloudNode } from './TinyCloudNode-jPL2UqH5.js';
4
+ import { T as TinyCloudNode } from './TinyCloudNode-k3TbBwwj.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 & {
@@ -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
3
  import { ReplicaLocalEraseOutcome, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaPurgeFailedEvent, ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
- import { T as TinyCloudNode } from './TinyCloudNode-C0LgPzzJ.cjs';
4
+ import { T as TinyCloudNode } from './TinyCloudNode-DaD5vJhL.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 & {