@tinycloud/node-sdk 1.2.0 → 1.3.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.
package/dist/index.cjs CHANGED
@@ -17025,40 +17025,44 @@ var require_utils2 = __commonJS({
17025
17025
  // src/index.ts
17026
17026
  var index_exports = {};
17027
17027
  __export(index_exports, {
17028
- CapabilityKeyRegistry: () => import_sdk_core9.CapabilityKeyRegistry,
17029
- CapabilityKeyRegistryErrorCodes: () => import_sdk_core9.CapabilityKeyRegistryErrorCodes,
17028
+ CapabilityKeyRegistry: () => import_sdk_core10.CapabilityKeyRegistry,
17029
+ CapabilityKeyRegistryErrorCodes: () => import_sdk_core10.CapabilityKeyRegistryErrorCodes,
17030
+ DataVaultService: () => import_sdk_core8.DataVaultService,
17030
17031
  DatabaseHandle: () => import_sdk_core7.DatabaseHandle,
17031
17032
  DelegatedAccess: () => DelegatedAccess,
17032
- DelegationErrorCodes: () => import_sdk_core8.DelegationErrorCodes,
17033
- DelegationManager: () => import_sdk_core8.DelegationManager,
17033
+ DelegationErrorCodes: () => import_sdk_core9.DelegationErrorCodes,
17034
+ DelegationManager: () => import_sdk_core9.DelegationManager,
17034
17035
  FileSessionStorage: () => FileSessionStorage,
17035
17036
  KVService: () => import_sdk_core6.KVService,
17036
17037
  MemorySessionStorage: () => MemorySessionStorage,
17037
17038
  NodeUserAuthorization: () => NodeUserAuthorization,
17038
17039
  PrefixedKVService: () => import_sdk_core6.PrefixedKVService,
17039
17040
  PrivateKeySigner: () => PrivateKeySigner,
17040
- ProtocolMismatchError: () => import_sdk_core11.ProtocolMismatchError,
17041
+ ProtocolMismatchError: () => import_sdk_core12.ProtocolMismatchError,
17041
17042
  SQLAction: () => import_sdk_core7.SQLAction,
17042
17043
  SQLService: () => import_sdk_core7.SQLService,
17043
- ServiceContext: () => import_sdk_core12.ServiceContext,
17044
- SharingService: () => import_sdk_core8.SharingService,
17045
- Space: () => import_sdk_core10.Space,
17046
- SpaceErrorCodes: () => import_sdk_core10.SpaceErrorCodes,
17047
- SpaceService: () => import_sdk_core10.SpaceService,
17044
+ ServiceContext: () => import_sdk_core13.ServiceContext,
17045
+ SharingService: () => import_sdk_core9.SharingService,
17046
+ Space: () => import_sdk_core11.Space,
17047
+ SpaceErrorCodes: () => import_sdk_core11.SpaceErrorCodes,
17048
+ SpaceService: () => import_sdk_core11.SpaceService,
17048
17049
  TinyCloud: () => import_sdk_core5.TinyCloud,
17049
17050
  TinyCloudNode: () => TinyCloudNode,
17050
- VersionCheckError: () => import_sdk_core11.VersionCheckError,
17051
+ VaultAction: () => import_sdk_core8.VaultAction,
17052
+ VaultHeaders: () => import_sdk_core8.VaultHeaders,
17053
+ VersionCheckError: () => import_sdk_core12.VersionCheckError,
17051
17054
  WasmKeyProvider: () => WasmKeyProvider,
17052
- buildSpaceUri: () => import_sdk_core10.buildSpaceUri,
17053
- checkNodeVersion: () => import_sdk_core11.checkNodeVersion,
17054
- createCapabilityKeyRegistry: () => import_sdk_core9.createCapabilityKeyRegistry,
17055
- createSharingService: () => import_sdk_core8.createSharingService,
17056
- createSpaceService: () => import_sdk_core10.createSpaceService,
17055
+ buildSpaceUri: () => import_sdk_core11.buildSpaceUri,
17056
+ checkNodeVersion: () => import_sdk_core12.checkNodeVersion,
17057
+ createCapabilityKeyRegistry: () => import_sdk_core10.createCapabilityKeyRegistry,
17058
+ createSharingService: () => import_sdk_core9.createSharingService,
17059
+ createSpaceService: () => import_sdk_core11.createSpaceService,
17060
+ createVaultCrypto: () => import_sdk_core8.createVaultCrypto,
17057
17061
  createWasmKeyProvider: () => createWasmKeyProvider,
17058
17062
  defaultSignStrategy: () => defaultSignStrategy,
17059
17063
  deserializeDelegation: () => deserializeDelegation,
17060
- makePublicSpaceId: () => import_sdk_core10.makePublicSpaceId,
17061
- parseSpaceUri: () => import_sdk_core10.parseSpaceUri,
17064
+ makePublicSpaceId: () => import_sdk_core11.makePublicSpaceId,
17065
+ parseSpaceUri: () => import_sdk_core11.parseSpaceUri,
17062
17066
  serializeDelegation: () => serializeDelegation
17063
17067
  });
17064
17068
  module.exports = __toCommonJS(index_exports);
@@ -17365,6 +17369,7 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17365
17369
  this.sessionExpirationMs = config.sessionExpirationMs ?? 60 * 60 * 1e3;
17366
17370
  this.autoCreateSpace = config.autoCreateSpace ?? false;
17367
17371
  this.tinycloudHosts = config.tinycloudHosts ?? ["https://node.tinycloud.xyz"];
17372
+ this.enablePublicSpace = config.enablePublicSpace ?? true;
17368
17373
  this.sessionManager = new import_node_sdk_wasm2.TCWSessionManager();
17369
17374
  }
17370
17375
  /**
@@ -17396,12 +17401,12 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17396
17401
  * Create the space on the TinyCloud server (host delegation).
17397
17402
  * This registers the user as the owner of the space.
17398
17403
  */
17399
- async hostSpace() {
17404
+ async hostSpace(targetSpaceId) {
17400
17405
  if (!this._tinyCloudSession || !this._address || !this._chainId) {
17401
17406
  throw new Error("Must be signed in to host space");
17402
17407
  }
17403
17408
  const host = this.tinycloudHosts[0];
17404
- const spaceId = this._tinyCloudSession.spaceId;
17409
+ const spaceId = targetSpaceId ?? this._tinyCloudSession.spaceId;
17405
17410
  const peerId = await (0, import_sdk_core2.fetchPeerId)(host, spaceId);
17406
17411
  const siwe = (0, import_node_sdk_wasm2.generateHostSIWEMessage)({
17407
17412
  address: this._address,
@@ -17416,6 +17421,13 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17416
17421
  const result = await (0, import_sdk_core2.submitHostDelegation)(host, headers);
17417
17422
  return result.success;
17418
17423
  }
17424
+ /**
17425
+ * Create a specific space on the server via host delegation.
17426
+ * Used for lazy creation of additional spaces (e.g., public).
17427
+ */
17428
+ async hostPublicSpace(spaceId) {
17429
+ return this.hostSpace(spaceId);
17430
+ }
17419
17431
  /**
17420
17432
  * Ensure the user's space exists on the TinyCloud server.
17421
17433
  * Creates the space if it doesn't exist and autoCreateSpace is enabled.
@@ -17429,11 +17441,33 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17429
17441
  throw new Error("Must be signed in to ensure space exists");
17430
17442
  }
17431
17443
  const host = this.tinycloudHosts[0];
17444
+ const primarySpaceId = this._tinyCloudSession.spaceId;
17432
17445
  const result = await (0, import_sdk_core2.activateSessionWithHost)(
17433
17446
  host,
17434
17447
  this._tinyCloudSession.delegationHeader
17435
17448
  );
17436
17449
  if (result.success) {
17450
+ const primarySkipped = result.skipped?.includes(primarySpaceId);
17451
+ if (!primarySkipped) {
17452
+ return;
17453
+ }
17454
+ if (!this.autoCreateSpace) {
17455
+ return;
17456
+ }
17457
+ const created = await this.hostSpace();
17458
+ if (!created) {
17459
+ throw new Error(`Failed to create space: ${primarySpaceId}`);
17460
+ }
17461
+ await new Promise((resolve) => setTimeout(resolve, 100));
17462
+ const retryResult = await (0, import_sdk_core2.activateSessionWithHost)(
17463
+ host,
17464
+ this._tinyCloudSession.delegationHeader
17465
+ );
17466
+ if (!retryResult.success) {
17467
+ throw new Error(
17468
+ `Failed to activate session after creating space: ${retryResult.error}`
17469
+ );
17470
+ }
17437
17471
  return;
17438
17472
  }
17439
17473
  if (result.status === 404) {
@@ -17442,9 +17476,7 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17442
17476
  }
17443
17477
  const created = await this.hostSpace();
17444
17478
  if (!created) {
17445
- throw new Error(
17446
- `Failed to create space: ${this._tinyCloudSession.spaceId}`
17447
- );
17479
+ throw new Error(`Failed to create space: ${primarySpaceId}`);
17448
17480
  }
17449
17481
  await new Promise((resolve) => setTimeout(resolve, 100));
17450
17482
  const retryResult = await (0, import_sdk_core2.activateSessionWithHost)(
@@ -17512,11 +17544,13 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17512
17544
  siwe: prepared.siwe,
17513
17545
  signature: signature2
17514
17546
  };
17547
+ const spacesMetadata = this.enablePublicSpace ? { public: (0, import_node_sdk_wasm2.makeSpaceId)(address, chainId, "public") } : void 0;
17515
17548
  const tinyCloudSession = {
17516
17549
  address,
17517
17550
  chainId,
17518
17551
  sessionKey: keyId,
17519
17552
  spaceId,
17553
+ spaces: spacesMetadata,
17520
17554
  delegationCid: session.delegationCid,
17521
17555
  delegationHeader: session.delegationHeader,
17522
17556
  verificationMethod: this.sessionManager.getDID(keyId),
@@ -17534,6 +17568,7 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17534
17568
  delegationHeader: session.delegationHeader,
17535
17569
  delegationCid: session.delegationCid,
17536
17570
  spaceId,
17571
+ spaces: spacesMetadata,
17537
17572
  verificationMethod: this.sessionManager.getDID(keyId)
17538
17573
  },
17539
17574
  expiresAt: expirationTime.toISOString(),
@@ -17663,11 +17698,13 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17663
17698
  siwe: prepared.siwe,
17664
17699
  signature: signature2
17665
17700
  };
17701
+ const spacesMetadata = this.enablePublicSpace ? { public: (0, import_node_sdk_wasm2.makeSpaceId)(address, chainId, "public") } : void 0;
17666
17702
  const tinyCloudSession = {
17667
17703
  address,
17668
17704
  chainId,
17669
17705
  sessionKey: keyId,
17670
17706
  spaceId: prepared.spaceId,
17707
+ spaces: spacesMetadata,
17671
17708
  delegationCid: session.delegationCid,
17672
17709
  delegationHeader: session.delegationHeader,
17673
17710
  verificationMethod: this.sessionManager.getDID(keyId),
@@ -17689,6 +17726,7 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17689
17726
  delegationHeader: session.delegationHeader,
17690
17727
  delegationCid: session.delegationCid,
17691
17728
  spaceId: prepared.spaceId,
17729
+ spaces: spacesMetadata,
17692
17730
  verificationMethod: this.sessionManager.getDID(keyId)
17693
17731
  },
17694
17732
  expiresAt,
@@ -18009,7 +18047,8 @@ var _TinyCloudNode = class _TinyCloudNode {
18009
18047
  spacePrefix: config.prefix,
18010
18048
  sessionExpirationMs: config.sessionExpirationMs ?? 60 * 60 * 1e3,
18011
18049
  tinycloudHosts: [host],
18012
- autoCreateSpace: config.autoCreateSpace
18050
+ autoCreateSpace: config.autoCreateSpace,
18051
+ enablePublicSpace: config.enablePublicSpace ?? true
18013
18052
  });
18014
18053
  this.tc = new import_sdk_core4.TinyCloud(this.auth);
18015
18054
  }
@@ -18124,7 +18163,8 @@ var _TinyCloudNode = class _TinyCloudNode {
18124
18163
  spacePrefix: prefix,
18125
18164
  sessionExpirationMs: this.config.sessionExpirationMs ?? 60 * 60 * 1e3,
18126
18165
  tinycloudHosts: [host],
18127
- autoCreateSpace: this.config.autoCreateSpace
18166
+ autoCreateSpace: this.config.autoCreateSpace,
18167
+ enablePublicSpace: this.config.enablePublicSpace ?? true
18128
18168
  });
18129
18169
  this.tc = new import_sdk_core4.TinyCloud(this.auth);
18130
18170
  this.config.prefix = prefix;
@@ -18138,6 +18178,7 @@ var _TinyCloudNode = class _TinyCloudNode {
18138
18178
  if (!session) {
18139
18179
  return;
18140
18180
  }
18181
+ this.tc.initializeServices(import_node_sdk_wasm4.invoke, [this.config.host]);
18141
18182
  this._serviceContext = new import_sdk_core4.ServiceContext({
18142
18183
  invoke: import_node_sdk_wasm4.invoke,
18143
18184
  fetch: globalThis.fetch.bind(globalThis),
@@ -18157,6 +18198,43 @@ var _TinyCloudNode = class _TinyCloudNode {
18157
18198
  jwk: session.jwk
18158
18199
  };
18159
18200
  this._serviceContext.setSession(serviceSession);
18201
+ this.tc.serviceContext.setSession(serviceSession);
18202
+ const vaultCrypto = (0, import_sdk_core4.createVaultCrypto)({
18203
+ vault_encrypt: import_node_sdk_wasm4.vault_encrypt,
18204
+ vault_decrypt: import_node_sdk_wasm4.vault_decrypt,
18205
+ vault_derive_key: import_node_sdk_wasm4.vault_derive_key,
18206
+ vault_x25519_from_seed: import_node_sdk_wasm4.vault_x25519_from_seed,
18207
+ vault_x25519_dh: import_node_sdk_wasm4.vault_x25519_dh,
18208
+ vault_random_bytes: import_node_sdk_wasm4.vault_random_bytes,
18209
+ vault_sha256: import_node_sdk_wasm4.vault_sha256
18210
+ });
18211
+ const self2 = this;
18212
+ this._vault = new import_sdk_core4.DataVaultService({
18213
+ spaceId: session.spaceId,
18214
+ crypto: vaultCrypto,
18215
+ tc: {
18216
+ kv: this._kv,
18217
+ ensurePublicSpace: async () => {
18218
+ try {
18219
+ await self2.ensurePublicSpace();
18220
+ return { ok: true, data: void 0 };
18221
+ } catch (error) {
18222
+ return { ok: false, error: { code: "STORAGE_ERROR", message: error instanceof Error ? error.message : String(error), service: "vault" } };
18223
+ }
18224
+ },
18225
+ get publicKV() {
18226
+ return self2._publicKV ?? self2.tc.publicKV;
18227
+ },
18228
+ readPublicSpace: (host, spaceId, key2) => import_sdk_core4.TinyCloud.readPublicSpace(host, spaceId, key2),
18229
+ makePublicSpaceId: import_sdk_core4.TinyCloud.makePublicSpaceId,
18230
+ did: this.did,
18231
+ address: this._address,
18232
+ chainId: this._chainId,
18233
+ hosts: [this.config.host]
18234
+ }
18235
+ });
18236
+ this._vault.initialize(this._serviceContext);
18237
+ this._serviceContext.registerService("vault", this._vault);
18160
18238
  this.initializeV2Services(serviceSession);
18161
18239
  }
18162
18240
  /**
@@ -18197,7 +18275,32 @@ var _TinyCloudNode = class _TinyCloudNode {
18197
18275
  isRevoked: false,
18198
18276
  allowSubDelegation: true
18199
18277
  };
18200
- this._capabilityRegistry.registerKey(sessionKey, [rootDelegation]);
18278
+ const delegations = [rootDelegation];
18279
+ if (tcSession.spaces) {
18280
+ for (const [spaceName, spaceId] of Object.entries(tcSession.spaces)) {
18281
+ delegations.push({
18282
+ cid: tcSession.delegationCid,
18283
+ delegateDID: tcSession.verificationMethod,
18284
+ spaceId,
18285
+ path: "",
18286
+ actions: [
18287
+ "tinycloud.kv/put",
18288
+ "tinycloud.kv/get",
18289
+ "tinycloud.kv/del",
18290
+ "tinycloud.kv/list",
18291
+ "tinycloud.kv/metadata",
18292
+ "tinycloud.sql/read",
18293
+ "tinycloud.sql/write",
18294
+ "tinycloud.sql/admin",
18295
+ "tinycloud.sql/*"
18296
+ ],
18297
+ expiry: this.getSessionExpiry(),
18298
+ isRevoked: false,
18299
+ allowSubDelegation: true
18300
+ });
18301
+ }
18302
+ }
18303
+ this._capabilityRegistry.registerKey(sessionKey, delegations);
18201
18304
  }
18202
18305
  this._delegationManager = new import_sdk_core4.DelegationManager({
18203
18306
  hosts: [this.config.host],
@@ -18215,7 +18318,16 @@ var _TinyCloudNode = class _TinyCloudNode {
18215
18318
  createKVService: (spaceId) => {
18216
18319
  const kvService = new import_sdk_core4.KVService({});
18217
18320
  if (this._serviceContext) {
18218
- kvService.initialize(this._serviceContext);
18321
+ const spaceScopedContext = new import_sdk_core4.ServiceContext({
18322
+ invoke: this._serviceContext.invoke,
18323
+ fetch: this._serviceContext.fetch,
18324
+ hosts: this._serviceContext.hosts
18325
+ });
18326
+ const session = this._serviceContext.session;
18327
+ if (session) {
18328
+ spaceScopedContext.setSession({ ...session, spaceId });
18329
+ }
18330
+ kvService.initialize(spaceScopedContext);
18219
18331
  }
18220
18332
  return kvService;
18221
18333
  },
@@ -18350,6 +18462,16 @@ var _TinyCloudNode = class _TinyCloudNode {
18350
18462
  }
18351
18463
  return this._sql;
18352
18464
  }
18465
+ /**
18466
+ * Data Vault operations - client-side encrypted KV storage.
18467
+ * Call `vault.unlock(signer)` after signIn() to derive encryption keys.
18468
+ */
18469
+ get vault() {
18470
+ if (!this._vault) {
18471
+ throw new Error("Not signed in. Call signIn() first.");
18472
+ }
18473
+ return this._vault;
18474
+ }
18353
18475
  // ===========================================================================
18354
18476
  // v2 Service Accessors
18355
18477
  // ===========================================================================
@@ -18523,21 +18645,99 @@ var _TinyCloudNode = class _TinyCloudNode {
18523
18645
  // Public Space Methods
18524
18646
  // ===========================================================================
18525
18647
  /**
18526
- * Ensure the user's public space exists.
18527
- * Creates it via spaces.create('public') if it doesn't.
18528
- * Requires the user to be signed in.
18648
+ * Ensure the user's public space exists and is accessible.
18649
+ * Creates the space and activates a session delegation for it.
18650
+ * This is the trigger for lazy public space creation — call it
18651
+ * before writing to spaces.get('public').kv.
18529
18652
  */
18530
18653
  async ensurePublicSpace() {
18531
- if (!this.tc) {
18654
+ if (!this.auth || !this.session || !this.signer) {
18532
18655
  throw new Error("Not signed in. Call signIn() first.");
18533
18656
  }
18534
- return this.tc.ensurePublicSpace();
18657
+ const publicSpaceId = this.session.spaces?.public;
18658
+ if (!publicSpaceId) {
18659
+ throw new Error("Public space not enabled. Set enablePublicSpace: true in config.");
18660
+ }
18661
+ await this.auth.hostPublicSpace(publicSpaceId);
18662
+ const kvActions = [
18663
+ "tinycloud.kv/put",
18664
+ "tinycloud.kv/get",
18665
+ "tinycloud.kv/del",
18666
+ "tinycloud.kv/list",
18667
+ "tinycloud.kv/metadata"
18668
+ ];
18669
+ const abilities = { kv: { "": kvActions } };
18670
+ const now = /* @__PURE__ */ new Date();
18671
+ const expiryMs = 60 * 60 * 1e3;
18672
+ const expirationTime = new Date(now.getTime() + expiryMs);
18673
+ const prepared = (0, import_node_sdk_wasm4.prepareSession)({
18674
+ abilities,
18675
+ address: (0, import_node_sdk_wasm4.ensureEip55)(this.session.address),
18676
+ chainId: this.session.chainId,
18677
+ domain: new URL(this.config.host).hostname,
18678
+ issuedAt: now.toISOString(),
18679
+ expirationTime: expirationTime.toISOString(),
18680
+ spaceId: publicSpaceId,
18681
+ jwk: this.session.jwk,
18682
+ parents: [this.session.delegationCid]
18683
+ });
18684
+ const signature2 = await this.signer.signMessage(prepared.siwe);
18685
+ const delegationSession = (0, import_node_sdk_wasm4.completeSessionSetup)({
18686
+ ...prepared,
18687
+ signature: signature2
18688
+ });
18689
+ const activateResult = await (0, import_sdk_core4.activateSessionWithHost)(
18690
+ this.config.host,
18691
+ delegationSession.delegationHeader
18692
+ );
18693
+ if (!activateResult.success) {
18694
+ throw new Error(`Failed to activate public space delegation: ${activateResult.error}`);
18695
+ }
18696
+ if (this._capabilityRegistry && this.session) {
18697
+ const sessionKey = {
18698
+ id: this.session.sessionKey,
18699
+ did: this.session.verificationMethod,
18700
+ type: "session",
18701
+ jwk: this.session.jwk,
18702
+ priority: 0
18703
+ };
18704
+ this._capabilityRegistry.registerKey(sessionKey, [{
18705
+ cid: delegationSession.delegationCid,
18706
+ delegateDID: this.session.verificationMethod,
18707
+ spaceId: publicSpaceId,
18708
+ path: "",
18709
+ actions: kvActions,
18710
+ expiry: expirationTime,
18711
+ isRevoked: false,
18712
+ allowSubDelegation: true
18713
+ }]);
18714
+ }
18715
+ if (this._serviceContext) {
18716
+ const publicKV = new import_sdk_core4.KVService({ prefix: "" });
18717
+ const publicContext = new import_sdk_core4.ServiceContext({
18718
+ invoke: import_node_sdk_wasm4.invoke,
18719
+ fetch: this._serviceContext.fetch,
18720
+ hosts: this._serviceContext.hosts
18721
+ });
18722
+ publicContext.setSession({
18723
+ delegationHeader: delegationSession.delegationHeader,
18724
+ delegationCid: delegationSession.delegationCid,
18725
+ spaceId: publicSpaceId,
18726
+ verificationMethod: this.session.verificationMethod,
18727
+ jwk: this.session.jwk
18728
+ });
18729
+ publicKV.initialize(publicContext);
18730
+ this._publicKV = publicKV;
18731
+ }
18535
18732
  }
18536
18733
  /**
18537
18734
  * Get a KVService scoped to the user's own public space.
18538
18735
  * Writes require authentication (owner/delegate).
18539
18736
  */
18540
18737
  get publicKV() {
18738
+ if (this._publicKV) {
18739
+ return this._publicKV;
18740
+ }
18541
18741
  if (!this.tc) {
18542
18742
  throw new Error("Not signed in. Call signIn() first.");
18543
18743
  }
@@ -18635,7 +18835,7 @@ var _TinyCloudNode = class _TinyCloudNode {
18635
18835
  domain: new URL(this.config.host).hostname,
18636
18836
  issuedAt: now.toISOString(),
18637
18837
  expirationTime: expirationTime.toISOString(),
18638
- spaceId: session.spaceId,
18838
+ spaceId: params.spaceIdOverride ?? session.spaceId,
18639
18839
  delegateUri: params.delegateDID,
18640
18840
  parents: [session.delegationCid]
18641
18841
  });
@@ -18654,7 +18854,7 @@ var _TinyCloudNode = class _TinyCloudNode {
18654
18854
  return {
18655
18855
  cid: delegationSession.delegationCid,
18656
18856
  delegationHeader: delegationSession.delegationHeader,
18657
- spaceId: session.spaceId,
18857
+ spaceId: params.spaceIdOverride ?? session.spaceId,
18658
18858
  path: params.path,
18659
18859
  actions: params.actions,
18660
18860
  disableSubDelegation: params.disableSubDelegation ?? false,
@@ -18873,10 +19073,12 @@ var import_sdk_core9 = require("@tinycloud/sdk-core");
18873
19073
  var import_sdk_core10 = require("@tinycloud/sdk-core");
18874
19074
  var import_sdk_core11 = require("@tinycloud/sdk-core");
18875
19075
  var import_sdk_core12 = require("@tinycloud/sdk-core");
19076
+ var import_sdk_core13 = require("@tinycloud/sdk-core");
18876
19077
  // Annotate the CommonJS export names for ESM import in node:
18877
19078
  0 && (module.exports = {
18878
19079
  CapabilityKeyRegistry,
18879
19080
  CapabilityKeyRegistryErrorCodes,
19081
+ DataVaultService,
18880
19082
  DatabaseHandle,
18881
19083
  DelegatedAccess,
18882
19084
  DelegationErrorCodes,
@@ -18897,6 +19099,8 @@ var import_sdk_core12 = require("@tinycloud/sdk-core");
18897
19099
  SpaceService,
18898
19100
  TinyCloud,
18899
19101
  TinyCloudNode,
19102
+ VaultAction,
19103
+ VaultHeaders,
18900
19104
  VersionCheckError,
18901
19105
  WasmKeyProvider,
18902
19106
  buildSpaceUri,
@@ -18904,6 +19108,7 @@ var import_sdk_core12 = require("@tinycloud/sdk-core");
18904
19108
  createCapabilityKeyRegistry,
18905
19109
  createSharingService,
18906
19110
  createSpaceService,
19111
+ createVaultCrypto,
18907
19112
  createWasmKeyProvider,
18908
19113
  defaultSignStrategy,
18909
19114
  deserializeDelegation,