@tinycloud/node-sdk 2.8.0 → 2.9.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.
@@ -1,4 +1,4 @@
1
- import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, INotificationHandler, IENSResolver, AccountService, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
1
+ import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, INotificationHandler, IENSResolver, AccountService, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
2
2
  import { EventEmitter } from 'events';
3
3
  import { InvokeFunction, InvokeAnyFunction } from '@tinycloud/sdk-services';
4
4
 
@@ -195,6 +195,16 @@ interface NodeUserAuthorizationConfig {
195
195
  tinycloudRegistryUrl?: string | null;
196
196
  /** Fallback TinyCloud hosts. Default: hosted TinyCloud node. */
197
197
  tinycloudFallbackHosts?: string[] | null;
198
+ /** Probe for a locally-running TinyCloud node before registry/fallback resolution. Default: true. */
199
+ autoDiscoverLocalNode?: boolean;
200
+ /** Local loopback node URL to probe. Default: http://127.0.0.1:8000. */
201
+ localNodeUrl?: string;
202
+ /** Known `*.local.tinycloud.link` subdomain name, probed directly. */
203
+ localLinkName?: string;
204
+ /** Expected local node DID. A locally-discovered node whose DID differs is rejected. */
205
+ expectedNodeDid?: string;
206
+ /** Pin store for trust-on-first-use local node identity verification. Defaults to an in-memory store. */
207
+ localNodeIdentityStore?: LocalNodeIdentityStore;
198
208
  /** Whether to include public space capabilities in the session (default: true) */
199
209
  enablePublicSpace?: boolean;
200
210
  /** WASM bindings for cryptographic operations. Required. */
@@ -284,6 +294,11 @@ declare class NodeUserAuthorization implements IUserAuthorization {
284
294
  private tinycloudHosts?;
285
295
  private readonly tinycloudRegistryUrl?;
286
296
  private readonly tinycloudFallbackHosts?;
297
+ private readonly autoDiscoverLocalNode?;
298
+ private readonly localNodeUrl?;
299
+ private readonly localLinkName?;
300
+ private readonly expectedNodeDid?;
301
+ private readonly localNodeIdentityStore?;
287
302
  private readonly enablePublicSpace;
288
303
  private readonly nonce?;
289
304
  private readonly siweConfig?;
@@ -882,6 +897,16 @@ interface TinyCloudNodeConfig {
882
897
  tinycloudRegistryUrl?: string | null;
883
898
  /** Fallback TinyCloud hosts. Default: hosted TinyCloud node. */
884
899
  tinycloudFallbackHosts?: string[] | null;
900
+ /** Probe for a locally-running TinyCloud node before registry/fallback resolution. Default: true. */
901
+ autoDiscoverLocalNode?: boolean;
902
+ /** Local loopback node URL to probe. Default: http://127.0.0.1:8000. */
903
+ localNodeUrl?: string;
904
+ /** Known `*.local.tinycloud.link` subdomain name, probed directly. */
905
+ localLinkName?: string;
906
+ /** Expected local node DID. A locally-discovered node whose DID differs is rejected. */
907
+ expectedNodeDid?: string;
908
+ /** Pin store for trust-on-first-use local node identity verification. Defaults to an in-memory store. */
909
+ localNodeIdentityStore?: LocalNodeIdentityStore;
885
910
  /** Space prefix for this user's space. Optional - only needed for signIn() */
886
911
  prefix?: string;
887
912
  /** Domain for SIWE messages (default: derived from host) */
@@ -1,4 +1,4 @@
1
- import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, INotificationHandler, IENSResolver, AccountService, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
1
+ import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, INotificationHandler, IENSResolver, AccountService, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
2
2
  import { EventEmitter } from 'events';
3
3
  import { InvokeFunction, InvokeAnyFunction } from '@tinycloud/sdk-services';
4
4
 
@@ -195,6 +195,16 @@ interface NodeUserAuthorizationConfig {
195
195
  tinycloudRegistryUrl?: string | null;
196
196
  /** Fallback TinyCloud hosts. Default: hosted TinyCloud node. */
197
197
  tinycloudFallbackHosts?: string[] | null;
198
+ /** Probe for a locally-running TinyCloud node before registry/fallback resolution. Default: true. */
199
+ autoDiscoverLocalNode?: boolean;
200
+ /** Local loopback node URL to probe. Default: http://127.0.0.1:8000. */
201
+ localNodeUrl?: string;
202
+ /** Known `*.local.tinycloud.link` subdomain name, probed directly. */
203
+ localLinkName?: string;
204
+ /** Expected local node DID. A locally-discovered node whose DID differs is rejected. */
205
+ expectedNodeDid?: string;
206
+ /** Pin store for trust-on-first-use local node identity verification. Defaults to an in-memory store. */
207
+ localNodeIdentityStore?: LocalNodeIdentityStore;
198
208
  /** Whether to include public space capabilities in the session (default: true) */
199
209
  enablePublicSpace?: boolean;
200
210
  /** WASM bindings for cryptographic operations. Required. */
@@ -284,6 +294,11 @@ declare class NodeUserAuthorization implements IUserAuthorization {
284
294
  private tinycloudHosts?;
285
295
  private readonly tinycloudRegistryUrl?;
286
296
  private readonly tinycloudFallbackHosts?;
297
+ private readonly autoDiscoverLocalNode?;
298
+ private readonly localNodeUrl?;
299
+ private readonly localLinkName?;
300
+ private readonly expectedNodeDid?;
301
+ private readonly localNodeIdentityStore?;
287
302
  private readonly enablePublicSpace;
288
303
  private readonly nonce?;
289
304
  private readonly siweConfig?;
@@ -882,6 +897,16 @@ interface TinyCloudNodeConfig {
882
897
  tinycloudRegistryUrl?: string | null;
883
898
  /** Fallback TinyCloud hosts. Default: hosted TinyCloud node. */
884
899
  tinycloudFallbackHosts?: string[] | null;
900
+ /** Probe for a locally-running TinyCloud node before registry/fallback resolution. Default: true. */
901
+ autoDiscoverLocalNode?: boolean;
902
+ /** Local loopback node URL to probe. Default: http://127.0.0.1:8000. */
903
+ localNodeUrl?: string;
904
+ /** Known `*.local.tinycloud.link` subdomain name, probed directly. */
905
+ localLinkName?: string;
906
+ /** Expected local node DID. A locally-discovered node whose DID differs is rejected. */
907
+ expectedNodeDid?: string;
908
+ /** Pin store for trust-on-first-use local node identity verification. Defaults to an in-memory store. */
909
+ localNodeIdentityStore?: LocalNodeIdentityStore;
885
910
  /** Space prefix for this user's space. Optional - only needed for signIn() */
886
911
  prefix?: string;
887
912
  /** Domain for SIWE messages (default: derived from host) */
package/dist/core.cjs CHANGED
@@ -393,6 +393,11 @@ var NodeUserAuthorization = class {
393
393
  this.tinycloudHosts = config.tinycloudHosts;
394
394
  this.tinycloudRegistryUrl = config.tinycloudRegistryUrl;
395
395
  this.tinycloudFallbackHosts = config.tinycloudFallbackHosts;
396
+ this.autoDiscoverLocalNode = config.autoDiscoverLocalNode;
397
+ this.localNodeUrl = config.localNodeUrl;
398
+ this.localLinkName = config.localLinkName;
399
+ this.expectedNodeDid = config.expectedNodeDid;
400
+ this.localNodeIdentityStore = config.localNodeIdentityStore;
396
401
  this.enablePublicSpace = config.enablePublicSpace ?? true;
397
402
  this.nonce = config.nonce;
398
403
  this.siweConfig = config.siweConfig;
@@ -525,7 +530,12 @@ var NodeUserAuthorization = class {
525
530
  const subject = (0, import_sdk_core3.pkhDid)(address, chainId);
526
531
  const resolved = await (0, import_sdk_core3.resolveTinyCloudHosts)(subject, {
527
532
  registryUrl: this.tinycloudRegistryUrl,
528
- fallbackHosts: this.tinycloudFallbackHosts
533
+ fallbackHosts: this.tinycloudFallbackHosts,
534
+ autoDiscoverLocalNode: this.autoDiscoverLocalNode,
535
+ localNodeUrl: this.localNodeUrl,
536
+ localLinkName: this.localLinkName,
537
+ expectedNodeDid: this.expectedNodeDid,
538
+ localNodeIdentityStore: this.localNodeIdentityStore
529
539
  });
530
540
  this.tinycloudHosts = resolved.hosts;
531
541
  }
@@ -2189,6 +2199,11 @@ var _TinyCloudNode = class _TinyCloudNode {
2189
2199
  tinycloudHosts: this.explicitHost ? [this.explicitHost] : void 0,
2190
2200
  tinycloudRegistryUrl: config.tinycloudRegistryUrl,
2191
2201
  tinycloudFallbackHosts: config.tinycloudFallbackHosts,
2202
+ autoDiscoverLocalNode: config.autoDiscoverLocalNode,
2203
+ localNodeUrl: config.localNodeUrl,
2204
+ localLinkName: config.localLinkName,
2205
+ expectedNodeDid: config.expectedNodeDid,
2206
+ localNodeIdentityStore: config.localNodeIdentityStore,
2192
2207
  autoCreateSpace: useBootstrapSignInRequest ? false : config.autoCreateSpace,
2193
2208
  enablePublicSpace: config.enablePublicSpace ?? true,
2194
2209
  spaceCreationHandler: useBootstrapSignInRequest ? void 0 : config.spaceCreationHandler,
@@ -3515,7 +3530,12 @@ var _TinyCloudNode = class _TinyCloudNode {
3515
3530
  }
3516
3531
  const resolved = await (0, import_sdk_core8.resolveTinyCloudHosts)((0, import_sdk_core8.pkhDid)(address, chainId), {
3517
3532
  registryUrl: this.config.tinycloudRegistryUrl,
3518
- fallbackHosts: this.config.tinycloudFallbackHosts
3533
+ fallbackHosts: this.config.tinycloudFallbackHosts,
3534
+ autoDiscoverLocalNode: this.config.autoDiscoverLocalNode,
3535
+ localNodeUrl: this.config.localNodeUrl,
3536
+ localLinkName: this.config.localLinkName,
3537
+ expectedNodeDid: this.config.expectedNodeDid,
3538
+ localNodeIdentityStore: this.config.localNodeIdentityStore
3519
3539
  });
3520
3540
  return resolved.hosts[0];
3521
3541
  }
@@ -3577,6 +3597,11 @@ var _TinyCloudNode = class _TinyCloudNode {
3577
3597
  tinycloudHosts: this.explicitHost ? [this.explicitHost] : void 0,
3578
3598
  tinycloudRegistryUrl: this.config.tinycloudRegistryUrl,
3579
3599
  tinycloudFallbackHosts: this.config.tinycloudFallbackHosts,
3600
+ autoDiscoverLocalNode: this.config.autoDiscoverLocalNode,
3601
+ localNodeUrl: this.config.localNodeUrl,
3602
+ localLinkName: this.config.localLinkName,
3603
+ expectedNodeDid: this.config.expectedNodeDid,
3604
+ localNodeIdentityStore: this.config.localNodeIdentityStore,
3580
3605
  autoCreateSpace: useBootstrapSignInRequest ? false : this.config.autoCreateSpace,
3581
3606
  enablePublicSpace: this.config.enablePublicSpace ?? true,
3582
3607
  spaceCreationHandler: useBootstrapSignInRequest ? void 0 : this.config.spaceCreationHandler,
@@ -3625,6 +3650,11 @@ var _TinyCloudNode = class _TinyCloudNode {
3625
3650
  tinycloudHosts: this.explicitHost ? [this.explicitHost] : void 0,
3626
3651
  tinycloudRegistryUrl: this.config.tinycloudRegistryUrl,
3627
3652
  tinycloudFallbackHosts: this.config.tinycloudFallbackHosts,
3653
+ autoDiscoverLocalNode: this.config.autoDiscoverLocalNode,
3654
+ localNodeUrl: this.config.localNodeUrl,
3655
+ localLinkName: this.config.localLinkName,
3656
+ expectedNodeDid: this.config.expectedNodeDid,
3657
+ localNodeIdentityStore: this.config.localNodeIdentityStore,
3628
3658
  autoCreateSpace: useBootstrapSignInRequest ? false : this.config.autoCreateSpace,
3629
3659
  enablePublicSpace: this.config.enablePublicSpace ?? true,
3630
3660
  spaceCreationHandler: useBootstrapSignInRequest ? void 0 : this.config.spaceCreationHandler,