@tinycloud/node-sdk 3.8.0-beta.2 → 3.8.0-beta.21
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.
- package/README.md +6 -0
- package/dist/{TinyCloudNode-B6VOBrCb.d.ts → TinyCloudNode-DaD5vJhL.d.cts} +49 -6
- package/dist/{TinyCloudNode-CVO41O12.d.cts → TinyCloudNode-k3TbBwwj.d.ts} +49 -6
- package/dist/{WasmKeyProvider-5Ee7fcAw.d.cts → WasmKeyProvider-BKCPRC-c.d.cts} +21 -1
- package/dist/{WasmKeyProvider-5Ee7fcAw.d.ts → WasmKeyProvider-BKCPRC-c.d.ts} +21 -1
- package/dist/{authority-DGi1hIMK.d.ts → authority-C_fWaxAu.d.ts} +1 -1
- package/dist/{authority-DgVV80bI.d.cts → authority-DJdbZM6k.d.cts} +1 -1
- package/dist/core.cjs +375 -40
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +5 -4
- package/dist/core.d.ts +5 -4
- package/dist/core.js +370 -35
- package/dist/core.js.map +1 -1
- package/dist/credentials-core.d.cts +1 -1
- package/dist/credentials-core.d.ts +1 -1
- package/dist/credentials.d.cts +1 -1
- package/dist/credentials.d.ts +1 -1
- package/dist/{delegation-0LKZkmP2.d.cts → delegation-Ckc3UETl.d.cts} +1 -1
- package/dist/{delegation-0LKZkmP2.d.ts → delegation-Ckc3UETl.d.ts} +1 -1
- package/dist/encryption-keys.d.cts +2 -2
- package/dist/encryption-keys.d.ts +2 -2
- package/dist/index.cjs +343 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +333 -38
- package/dist/index.js.map +1 -1
- package/dist/replication/authority.cjs +3 -0
- package/dist/replication/authority.cjs.map +1 -1
- package/dist/replication/authority.d.cts +4 -3
- package/dist/replication/authority.d.ts +4 -3
- package/dist/replication/authority.js +3 -0
- package/dist/replication/authority.js.map +1 -1
- package/dist/replication/runtime.cjs +1 -0
- package/dist/replication/runtime.cjs.map +1 -1
- package/dist/replication/runtime.js +1 -0
- package/dist/replication/runtime.js.map +1 -1
- package/dist/share-receive.cjs +775 -0
- package/dist/share-receive.cjs.map +1 -0
- package/dist/share-receive.d.cts +32 -0
- package/dist/share-receive.d.ts +32 -0
- package/dist/share-receive.js +777 -0
- package/dist/share-receive.js.map +1 -0
- 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.
|
|
@@ -2,8 +2,9 @@ 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
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,
|
|
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
|
|
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)
|
|
@@ -567,13 +587,13 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
567
587
|
/**
|
|
568
588
|
* Build SIWE overrides from the top-level nonce and siweConfig.
|
|
569
589
|
* - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
|
|
570
|
-
* -
|
|
571
|
-
* - resources are appended to the default resources
|
|
590
|
+
* - resources are inserted after WASM preparation, before the final ReCap
|
|
572
591
|
* - uri triggers a warning (overwriting delegation target)
|
|
573
592
|
* - all other fields override directly
|
|
574
593
|
* - per-call nonce overrides siweConfig.nonce when provided
|
|
575
594
|
*/
|
|
576
595
|
private buildSiweOverrides;
|
|
596
|
+
private prepareSessionWithResources;
|
|
577
597
|
/**
|
|
578
598
|
* Add an extension to the authorization flow.
|
|
579
599
|
*/
|
|
@@ -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
|
|
@@ -1167,6 +1191,8 @@ interface DelegateToResult {
|
|
|
1167
1191
|
interface RuntimePermissionGrantOptions {
|
|
1168
1192
|
/** Override expiry. ms-format string ("7d", "1h") or raw milliseconds. */
|
|
1169
1193
|
expiry?: string | number;
|
|
1194
|
+
/** In-memory key snapshot captured when exact Share-key consent opened. */
|
|
1195
|
+
expectedSessionKey?: Readonly<TinyCloudSession["jwk"]>;
|
|
1170
1196
|
}
|
|
1171
1197
|
interface EnsureEncryptionNetworkOptions {
|
|
1172
1198
|
/**
|
|
@@ -1276,6 +1302,7 @@ declare class TinyCloudNode {
|
|
|
1276
1302
|
private readonly explicitHost?;
|
|
1277
1303
|
private signer;
|
|
1278
1304
|
private auth;
|
|
1305
|
+
private readonly consumedOpenKeyPendings;
|
|
1279
1306
|
private tc;
|
|
1280
1307
|
private _address?;
|
|
1281
1308
|
private _chainId;
|
|
@@ -1301,6 +1328,8 @@ declare class TinyCloudNode {
|
|
|
1301
1328
|
private _hooks?;
|
|
1302
1329
|
private _vault?;
|
|
1303
1330
|
private _encryption?;
|
|
1331
|
+
private _namedKeyClient?;
|
|
1332
|
+
private _keysUnavailable;
|
|
1304
1333
|
private _baseVaults;
|
|
1305
1334
|
private _baseSecrets;
|
|
1306
1335
|
private _secrets;
|
|
@@ -1650,6 +1679,10 @@ declare class TinyCloudNode {
|
|
|
1650
1679
|
* bytes before the network session or replica stamp is committed.
|
|
1651
1680
|
*/
|
|
1652
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>;
|
|
1653
1686
|
private signInWith;
|
|
1654
1687
|
private establishSignIn;
|
|
1655
1688
|
/**
|
|
@@ -1954,6 +1987,12 @@ declare class TinyCloudNode {
|
|
|
1954
1987
|
invokeAny(entries: Parameters<InvokeAnyFunction$1>[1], facts?: Parameters<InvokeAnyFunction$1>[2]): ReturnType<InvokeAnyFunction$1>;
|
|
1955
1988
|
/** Sign protocol bytes with the established in-memory session key. */
|
|
1956
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;
|
|
1957
1996
|
/** Author a proofless Policy/v3 owner root with the authenticated holder key. */
|
|
1958
1997
|
createUnifiedOwnerRoot(input: UnifiedOwnerRootInput): Promise<UnifiedOwnerRootReceipt>;
|
|
1959
1998
|
/** Apply only an already-enabled signing policy to the exact credential request. */
|
|
@@ -2080,7 +2119,7 @@ declare class TinyCloudNode {
|
|
|
2080
2119
|
* Sign a wallet (CACAO) revocation of the delegation `cid` for the node's
|
|
2081
2120
|
* `POST /revoke`, and return its Authorization header value. The node
|
|
2082
2121
|
* accepts it when the owner delegated `cid` or owns a space its abilities
|
|
2083
|
-
* target, whichever key issued it. Valid for
|
|
2122
|
+
* target, whichever key issued it. Valid for 10 minutes. Requires the
|
|
2084
2123
|
* owner wallet signer.
|
|
2085
2124
|
*/
|
|
2086
2125
|
signOwnerRevocation(cid: string): Promise<string>;
|
|
@@ -2162,6 +2201,10 @@ declare class TinyCloudNode {
|
|
|
2162
2201
|
* Network-scoped encryption/decrypt service.
|
|
2163
2202
|
*/
|
|
2164
2203
|
get encryption(): IEncryptionService;
|
|
2204
|
+
/** Named keys bound to the current session. */
|
|
2205
|
+
get keys(): NamedKeyClient;
|
|
2206
|
+
/** Manifest key paths unavailable during the latest `signIn()` attempt. */
|
|
2207
|
+
get keysUnavailable(): readonly string[];
|
|
2165
2208
|
getEncryptionNetwork(nameOrNetworkId?: string): Promise<NetworkDescriptor | null>;
|
|
2166
2209
|
createEncryptionNetwork(name?: string): Promise<NetworkDescriptor>;
|
|
2167
2210
|
/**
|
|
@@ -2698,4 +2741,4 @@ declare class TinyCloudNode {
|
|
|
2698
2741
|
}): Promise<PortableDelegation>;
|
|
2699
2742
|
}
|
|
2700
2743
|
|
|
2701
|
-
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
|
|
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 };
|
|
@@ -2,8 +2,9 @@ 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
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,
|
|
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
|
|
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)
|
|
@@ -567,13 +587,13 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
567
587
|
/**
|
|
568
588
|
* Build SIWE overrides from the top-level nonce and siweConfig.
|
|
569
589
|
* - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
|
|
570
|
-
* -
|
|
571
|
-
* - resources are appended to the default resources
|
|
590
|
+
* - resources are inserted after WASM preparation, before the final ReCap
|
|
572
591
|
* - uri triggers a warning (overwriting delegation target)
|
|
573
592
|
* - all other fields override directly
|
|
574
593
|
* - per-call nonce overrides siweConfig.nonce when provided
|
|
575
594
|
*/
|
|
576
595
|
private buildSiweOverrides;
|
|
596
|
+
private prepareSessionWithResources;
|
|
577
597
|
/**
|
|
578
598
|
* Add an extension to the authorization flow.
|
|
579
599
|
*/
|
|
@@ -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
|
|
@@ -1167,6 +1191,8 @@ interface DelegateToResult {
|
|
|
1167
1191
|
interface RuntimePermissionGrantOptions {
|
|
1168
1192
|
/** Override expiry. ms-format string ("7d", "1h") or raw milliseconds. */
|
|
1169
1193
|
expiry?: string | number;
|
|
1194
|
+
/** In-memory key snapshot captured when exact Share-key consent opened. */
|
|
1195
|
+
expectedSessionKey?: Readonly<TinyCloudSession["jwk"]>;
|
|
1170
1196
|
}
|
|
1171
1197
|
interface EnsureEncryptionNetworkOptions {
|
|
1172
1198
|
/**
|
|
@@ -1276,6 +1302,7 @@ declare class TinyCloudNode {
|
|
|
1276
1302
|
private readonly explicitHost?;
|
|
1277
1303
|
private signer;
|
|
1278
1304
|
private auth;
|
|
1305
|
+
private readonly consumedOpenKeyPendings;
|
|
1279
1306
|
private tc;
|
|
1280
1307
|
private _address?;
|
|
1281
1308
|
private _chainId;
|
|
@@ -1301,6 +1328,8 @@ declare class TinyCloudNode {
|
|
|
1301
1328
|
private _hooks?;
|
|
1302
1329
|
private _vault?;
|
|
1303
1330
|
private _encryption?;
|
|
1331
|
+
private _namedKeyClient?;
|
|
1332
|
+
private _keysUnavailable;
|
|
1304
1333
|
private _baseVaults;
|
|
1305
1334
|
private _baseSecrets;
|
|
1306
1335
|
private _secrets;
|
|
@@ -1650,6 +1679,10 @@ declare class TinyCloudNode {
|
|
|
1650
1679
|
* bytes before the network session or replica stamp is committed.
|
|
1651
1680
|
*/
|
|
1652
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>;
|
|
1653
1686
|
private signInWith;
|
|
1654
1687
|
private establishSignIn;
|
|
1655
1688
|
/**
|
|
@@ -1954,6 +1987,12 @@ declare class TinyCloudNode {
|
|
|
1954
1987
|
invokeAny(entries: Parameters<InvokeAnyFunction$1>[1], facts?: Parameters<InvokeAnyFunction$1>[2]): ReturnType<InvokeAnyFunction$1>;
|
|
1955
1988
|
/** Sign protocol bytes with the established in-memory session key. */
|
|
1956
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;
|
|
1957
1996
|
/** Author a proofless Policy/v3 owner root with the authenticated holder key. */
|
|
1958
1997
|
createUnifiedOwnerRoot(input: UnifiedOwnerRootInput): Promise<UnifiedOwnerRootReceipt>;
|
|
1959
1998
|
/** Apply only an already-enabled signing policy to the exact credential request. */
|
|
@@ -2080,7 +2119,7 @@ declare class TinyCloudNode {
|
|
|
2080
2119
|
* Sign a wallet (CACAO) revocation of the delegation `cid` for the node's
|
|
2081
2120
|
* `POST /revoke`, and return its Authorization header value. The node
|
|
2082
2121
|
* accepts it when the owner delegated `cid` or owns a space its abilities
|
|
2083
|
-
* target, whichever key issued it. Valid for
|
|
2122
|
+
* target, whichever key issued it. Valid for 10 minutes. Requires the
|
|
2084
2123
|
* owner wallet signer.
|
|
2085
2124
|
*/
|
|
2086
2125
|
signOwnerRevocation(cid: string): Promise<string>;
|
|
@@ -2162,6 +2201,10 @@ declare class TinyCloudNode {
|
|
|
2162
2201
|
* Network-scoped encryption/decrypt service.
|
|
2163
2202
|
*/
|
|
2164
2203
|
get encryption(): IEncryptionService;
|
|
2204
|
+
/** Named keys bound to the current session. */
|
|
2205
|
+
get keys(): NamedKeyClient;
|
|
2206
|
+
/** Manifest key paths unavailable during the latest `signIn()` attempt. */
|
|
2207
|
+
get keysUnavailable(): readonly string[];
|
|
2165
2208
|
getEncryptionNetwork(nameOrNetworkId?: string): Promise<NetworkDescriptor | null>;
|
|
2166
2209
|
createEncryptionNetwork(name?: string): Promise<NetworkDescriptor>;
|
|
2167
2210
|
/**
|
|
@@ -2698,4 +2741,4 @@ declare class TinyCloudNode {
|
|
|
2698
2741
|
}): Promise<PortableDelegation>;
|
|
2699
2742
|
}
|
|
2700
2743
|
|
|
2701
|
-
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
|
|
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-
|
|
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-
|
|
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 & {
|