@tinycloud/node-sdk 3.12.0-beta.2 → 3.12.0-beta.3
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 +39 -0
- package/dist/{NodeUserAuthorization-B05Wjjpb.d.cts → NodeUserAuthorization-B_TFUlua.d.cts} +18 -52
- package/dist/{NodeUserAuthorization-B05Wjjpb.d.ts → NodeUserAuthorization-B_TFUlua.d.ts} +18 -52
- package/dist/{TinyCloudNode-CEFGtSWn.d.ts → TinyCloudNode-Brcu8QoX.d.cts} +31 -59
- package/dist/{TinyCloudNode-6_IumWu0.d.cts → TinyCloudNode-DBJUnsMN.d.ts} +31 -59
- package/dist/{authority-DXpnuId1.d.ts → authority-BFc5lesl.d.ts} +1 -1
- package/dist/{authority-DODDXxoP.d.cts → authority-DQ6R1HEG.d.cts} +1 -1
- package/dist/core.cjs +500 -283
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +5 -5
- package/dist/core.d.ts +5 -5
- package/dist/core.js +526 -287
- 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-BQbAuKad.d.cts → delegation-CeOWDnBB.d.cts} +7 -0
- package/dist/{delegation-BQbAuKad.d.ts → delegation-CeOWDnBB.d.ts} +7 -0
- package/dist/encryption-keys.d.cts +3 -3
- package/dist/encryption-keys.d.ts +3 -3
- package/dist/index.cjs +517 -300
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +527 -288
- package/dist/index.js.map +1 -1
- package/dist/replication/authority.d.cts +4 -4
- package/dist/replication/authority.d.ts +4 -4
- package/dist/space-hosting.d.cts +1 -1
- package/dist/space-hosting.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tinycloud_sdk_core from '@tinycloud/sdk-core';
|
|
2
|
-
import { TinyCloudSession, TelemetryConfig, ServiceContext, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, Delegation, IWasmBindings, ISigner, StorageFullEvent, IStorageService, RegistryPolicy, RegistrySequenceStore, OnNodeNotFound, LocalNodeIdentityStore, ISessionStorage, INotificationHandler, IENSResolver, ISpaceCreationHandler, SiweConfig, Manifest, ComposedManifestRequest, RetryPolicy, ReplicationOptions, KVReplicaStorage, PermissionEntry, AccountService, SignInOptions, 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';
|
|
2
|
+
import { TinyCloudSession, TelemetryConfig, ServiceContext, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, Delegation, IWasmBindings, ISigner, StorageFullEvent, IStorageService, RegistryPolicy, RegistrySequenceStore, RegistryCacheStore, RegistryFallbackReason, OnNodeNotFound, LocalNodeIdentityStore, ISessionStorage, INotificationHandler, IENSResolver, ISpaceCreationHandler, SiweConfig, Manifest, ComposedManifestRequest, RetryPolicy, ReplicationOptions, KVReplicaStorage, PermissionEntry, AccountService, SignInOptions, 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
5
|
import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
|
|
6
|
-
import { S as SpaceHosting, c as SignStrategy, a as NodeUserAuthorization, P as PreparedOpenKeyAuthorization } from './NodeUserAuthorization-
|
|
7
|
-
import { P as PortableDelegation, S as SessionGrantProof, e as VerifiedSessionGrant } from './delegation-
|
|
6
|
+
import { S as SpaceHosting, c as SignStrategy, a as NodeUserAuthorization, P as PreparedOpenKeyAuthorization } from './NodeUserAuthorization-B_TFUlua.js';
|
|
7
|
+
import { P as PortableDelegation, S as SessionGrantProof, e as VerifiedSessionGrant } from './delegation-CeOWDnBB.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The handles needed to rehydrate this delegation activation in a fresh
|
|
@@ -192,32 +192,15 @@ interface TinyCloudNodeConfig {
|
|
|
192
192
|
signer?: ISigner;
|
|
193
193
|
/** Strategy for root signature requests. Defaults to auto-sign for local keys. */
|
|
194
194
|
signStrategy?: SignStrategy;
|
|
195
|
-
/**
|
|
195
|
+
/** Host hint for genuine no-entry onboarding; a signed registry entry takes precedence. */
|
|
196
196
|
host?: string;
|
|
197
197
|
/** Build a developer request log (sanitized, in-memory, bounded). Off by default. */
|
|
198
198
|
requestLog?: boolean;
|
|
199
199
|
/** TinyCloud location registry URL. Default: https://registry.tinycloud.xyz. */
|
|
200
200
|
tinycloudRegistryUrl?: string | null;
|
|
201
|
-
/**
|
|
202
|
-
* Fallback TinyCloud hosts. Default: hosted TinyCloud node. Used only by the
|
|
203
|
-
* default `registryPolicy` ("legacy-fallback"), whose silent fallback is
|
|
204
|
-
* deprecated and will be removed in a future major release.
|
|
205
|
-
*/
|
|
201
|
+
/** Host hints for genuine no-entry onboarding. Never used for registered or unavailable owners. */
|
|
206
202
|
tinycloudFallbackHosts?: string[] | null;
|
|
207
|
-
/**
|
|
208
|
-
* How sign-in uses the location registry when no `host` is configured.
|
|
209
|
-
* Default `"legacy-fallback"` (deprecated): a registry miss or failure
|
|
210
|
-
* silently uses `tinycloudFallbackHosts`, with a one-time warning.
|
|
211
|
-
* `"fail-closed"`: routing acts on the registry verdict for the signer
|
|
212
|
-
* address, an unavailable registry is `RegistryUnavailableError` (never a
|
|
213
|
-
* new account), record hosts are used only if HTTPS or loopback, and
|
|
214
|
-
* automatic space creation (sign-in, account bootstrap, owned-space
|
|
215
|
-
* hosting, the public space the vault creates) is refused on a host the
|
|
216
|
-
* owner's registry record does not list (`NodeRegistryEntryExistsError`)
|
|
217
|
-
* or when the registry gives no verdict. An explicit `hostOwnedSpace()`
|
|
218
|
-
* call is not guarded. `newUserHost` governs routing only: a pinned host
|
|
219
|
-
* may still create spaces for an unregistered owner.
|
|
220
|
-
*/
|
|
203
|
+
/** Registry routing is always v2-first and fail-closed. */
|
|
221
204
|
registryPolicy?: RegistryPolicy;
|
|
222
205
|
/** `fail-closed` only: host for owners with no registry record. Default https://node.tinycloud.xyz; `null` refuses them with `NodeNotFoundError`. */
|
|
223
206
|
newUserHost?: string | null;
|
|
@@ -225,9 +208,13 @@ interface TinyCloudNodeConfig {
|
|
|
225
208
|
registryChainId?: number;
|
|
226
209
|
/** `fail-closed` only: highest registry sequence seen per owner. Default: in-memory for this client. */
|
|
227
210
|
registrySequenceStore?: RegistrySequenceStore;
|
|
228
|
-
/**
|
|
211
|
+
/** Exact signed-v2 responses; pass a persistent adapter to survive restarts. */
|
|
212
|
+
registryCacheStore?: RegistryCacheStore;
|
|
213
|
+
/** Value-free warning after an actual cached-settings or default-node fallback. */
|
|
214
|
+
onRegistryFallback?: (reason: string, code?: RegistryFallbackReason) => void;
|
|
215
|
+
/** Retry or abort when registry resolution fails; `use-host` is accepted only for genuine no-entry onboarding. */
|
|
229
216
|
onNodeNotFound?: OnNodeNotFound;
|
|
230
|
-
/** Probe configured
|
|
217
|
+
/** Probe configured local nodes only for genuine no-entry onboarding. Default: true. */
|
|
231
218
|
autoDiscoverLocalNode?: boolean;
|
|
232
219
|
/** Local loopback node URL to probe. Omit to avoid probing loopback. */
|
|
233
220
|
localNodeUrl?: string;
|
|
@@ -487,6 +474,7 @@ declare class TinyCloudNode {
|
|
|
487
474
|
static registerNodeDefaults(defaults: NodeDefaults): void;
|
|
488
475
|
private config;
|
|
489
476
|
private readonly explicitHost?;
|
|
477
|
+
private readonly registryRefreshOwners;
|
|
490
478
|
private signer;
|
|
491
479
|
private auth;
|
|
492
480
|
private readonly consumedOpenKeyPendings;
|
|
@@ -758,7 +746,12 @@ declare class TinyCloudNode {
|
|
|
758
746
|
private shouldUseBootstrapSignInRequest;
|
|
759
747
|
/** Sanitized developer request events; undefined unless the node was built with `requestLog: true`. */
|
|
760
748
|
get requests(): RequestLogReader | undefined;
|
|
749
|
+
private throwRegistryRefusal;
|
|
761
750
|
private createServiceGraphLifetime;
|
|
751
|
+
private routingDestinations;
|
|
752
|
+
/** Transport hints cannot override verified full-resource registry routing. */
|
|
753
|
+
resolveRegisteredDelegationHost(permissions: readonly PermissionEntry[], noEntryHost: string): Promise<string | undefined>;
|
|
754
|
+
private bindRoutedAudience;
|
|
762
755
|
private syncResolvedHostFromAuth;
|
|
763
756
|
/**
|
|
764
757
|
* Install or replace the manifest that drives the SIWE recap at
|
|
@@ -811,6 +804,9 @@ declare class TinyCloudNode {
|
|
|
811
804
|
* rather than treating a malformed session as unrestricted authority.
|
|
812
805
|
*/
|
|
813
806
|
getVerifiedSessionCapabilities(): PermissionEntry[];
|
|
807
|
+
/** Start one background refresh for each owner derived from verified authority. */
|
|
808
|
+
refreshRegistryForCapabilities(permissions: readonly PermissionEntry[]): void;
|
|
809
|
+
private refreshRegistryOwner;
|
|
814
810
|
/** Normalize signed capabilities without collapsing nested encryption into raw authority. */
|
|
815
811
|
private projectSignedRecapCapabilities;
|
|
816
812
|
/**
|
|
@@ -1053,23 +1049,15 @@ declare class TinyCloudNode {
|
|
|
1053
1049
|
* session's recap doesn't cover it and the registry has no record; the host
|
|
1054
1050
|
* SIWE is idempotent server-side. Must be called after {@link signIn}.
|
|
1055
1051
|
*
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1058
|
-
*
|
|
1059
|
-
* verdict. {@link hostOwnedSpace} itself is an explicit action and is not
|
|
1060
|
-
* guarded.
|
|
1052
|
+
* Current signed per-space membership is checked before both automatic and
|
|
1053
|
+
* explicit hosting. Registered replicas use the session grant; no-entry
|
|
1054
|
+
* onboarding retains the host-SIWE flow.
|
|
1061
1055
|
*
|
|
1062
1056
|
* @param name - The owned space name (e.g. `"secrets"`).
|
|
1063
1057
|
* @returns The hosted owned-space URI.
|
|
1064
1058
|
*/
|
|
1065
1059
|
ensureOwnedSpaceHosted(name: string): Promise<string>;
|
|
1066
|
-
/**
|
|
1067
|
-
* Space-creation guard (TC-1443) for the automatic hosting paths: sign-in's
|
|
1068
|
-
* owned spaces, account bootstrap, {@link ensureOwnedSpaceHosted} and
|
|
1069
|
-
* {@link ensurePublicSpace}. Only `registryPolicy: "fail-closed"` consults
|
|
1070
|
-
* the registry ({@link NodeUserAuthorization.assertMayCreateSpace}); the
|
|
1071
|
-
* default policy performs no lookup.
|
|
1072
|
-
*/
|
|
1060
|
+
/** Refresh full-space membership before any automatic or explicit hosting. */
|
|
1073
1061
|
private assertMayCreateSpace;
|
|
1074
1062
|
/** Registry-policy settings shared by every authorization this client creates. */
|
|
1075
1063
|
private registryPolicyConfig;
|
|
@@ -1151,13 +1139,8 @@ declare class TinyCloudNode {
|
|
|
1151
1139
|
*/
|
|
1152
1140
|
expiresAt?: string;
|
|
1153
1141
|
/**
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
1156
|
-
* adopted so the restored session targets the same node as the
|
|
1157
|
-
* original sign-in — without this, service calls fall back to the
|
|
1158
|
-
* default host and the auth layer throws "TinyCloud hosts have not
|
|
1159
|
-
* been resolved". When absent (old persisted session) hosts resolve
|
|
1160
|
-
* lazily via the registry/fallback on the first host-needing call.
|
|
1142
|
+
* Persisted node origins are no-entry hints only. Restore resolves the
|
|
1143
|
+
* current signed entry before selecting any data destination.
|
|
1161
1144
|
*/
|
|
1162
1145
|
tinycloudHosts?: string[];
|
|
1163
1146
|
/**
|
|
@@ -1173,21 +1156,6 @@ declare class TinyCloudNode {
|
|
|
1173
1156
|
}): Promise<void>;
|
|
1174
1157
|
private stagePrimarySessionState;
|
|
1175
1158
|
private stageRestoredServiceGraph;
|
|
1176
|
-
/**
|
|
1177
|
-
* Resolve the host a restored session should target.
|
|
1178
|
-
*
|
|
1179
|
-
* Mirrors fresh sign-in host resolution but for the restore path:
|
|
1180
|
-
* an explicit/pinned host always wins, then the hosts the session was
|
|
1181
|
-
* persisted with, then a lazy registry/fallback resolution for sessions
|
|
1182
|
-
* that predate the persisted `tinycloudHosts` field. Returns `undefined`
|
|
1183
|
-
* only when there's nothing to resolve from (no explicit host, no
|
|
1184
|
-
* persisted hosts, and no address/chainId) — in which case the existing
|
|
1185
|
-
* `config.host` (default) is left in place.
|
|
1186
|
-
*
|
|
1187
|
-
* Resolution failures are surfaced, not swallowed: a genuinely broken
|
|
1188
|
-
* registry lookup throws rather than silently falling back to a wrong host.
|
|
1189
|
-
*/
|
|
1190
|
-
private resolveRestoredHost;
|
|
1191
1159
|
/**
|
|
1192
1160
|
* Resolve the currently-active TinyCloudSession, preferring the auth
|
|
1193
1161
|
* layer's value (wallet mode) and falling back to the node-level
|
|
@@ -1290,6 +1258,7 @@ declare class TinyCloudNode {
|
|
|
1290
1258
|
*/
|
|
1291
1259
|
private fetchNodeId;
|
|
1292
1260
|
private signRawNetworkAuthorization;
|
|
1261
|
+
private encryptionDestination;
|
|
1293
1262
|
private fetchEncryptionNetworkAt;
|
|
1294
1263
|
private createEncryptionService;
|
|
1295
1264
|
private getEncryptionService;
|
|
@@ -1536,6 +1505,9 @@ declare class TinyCloudNode {
|
|
|
1536
1505
|
* which also refuses decrypt-only grants.
|
|
1537
1506
|
*/
|
|
1538
1507
|
verifySessionGrant(grant: SessionGrantProof): VerifiedSessionGrant;
|
|
1508
|
+
private activateResourceSession;
|
|
1509
|
+
private activateRoutedDelegation;
|
|
1510
|
+
private activateSignedSession;
|
|
1539
1511
|
/**
|
|
1540
1512
|
* Install a portable runtime permission delegation into this SDK instance so
|
|
1541
1513
|
* matching service calls and downstream `delegateTo()` calls can use it.
|
|
@@ -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-DBJUnsMN.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-Brcu8QoX.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 & {
|