@tinycloud/node-sdk 2.0.3-beta.2 → 2.0.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/dist/index.cjs CHANGED
@@ -17303,6 +17303,7 @@ var NodeUserAuthorization = class {
17303
17303
  this.spaceCreationHandler = config.spaceCreationHandler;
17304
17304
  this.tinycloudHosts = config.tinycloudHosts ?? ["https://node.tinycloud.xyz"];
17305
17305
  this.enablePublicSpace = config.enablePublicSpace ?? true;
17306
+ this.nonce = config.nonce;
17306
17307
  this.siweConfig = config.siweConfig;
17307
17308
  this.sessionManager = this.wasm.createSessionManager();
17308
17309
  }
@@ -17323,16 +17324,21 @@ var NodeUserAuthorization = class {
17323
17324
  return this._nodeFeatures;
17324
17325
  }
17325
17326
  /**
17326
- * Build SIWE overrides from siweConfig.
17327
+ * Build SIWE overrides from the top-level nonce and siweConfig.
17328
+ * - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
17327
17329
  * - statement is prepended to the default statement
17328
17330
  * - resources are appended to the default resources
17329
17331
  * - uri triggers a warning (overwriting delegation target)
17330
17332
  * - all other fields override directly
17331
17333
  */
17332
17334
  buildSiweOverrides() {
17333
- if (!this.siweConfig) return { uri: this.uri };
17335
+ const base2 = { uri: this.uri };
17336
+ if (this.nonce !== void 0) {
17337
+ base2.nonce = this.nonce;
17338
+ }
17339
+ if (!this.siweConfig) return base2;
17334
17340
  const { statement, resources, uri, ...rest } = this.siweConfig;
17335
- const overrides = { uri: this.uri, ...rest };
17341
+ const overrides = { ...base2, ...rest };
17336
17342
  if (statement) {
17337
17343
  overrides.statement = this.statement ? `${statement} ${this.statement}` : statement;
17338
17344
  }
@@ -18085,6 +18091,7 @@ var TinyCloudNode = class _TinyCloudNode {
18085
18091
  autoCreateSpace: config.autoCreateSpace,
18086
18092
  enablePublicSpace: config.enablePublicSpace ?? true,
18087
18093
  spaceCreationHandler: config.spaceCreationHandler,
18094
+ nonce: config.nonce,
18088
18095
  siweConfig: config.siweConfig
18089
18096
  });
18090
18097
  this.tc = new import_sdk_core3.TinyCloud(this.auth);
@@ -18291,7 +18298,9 @@ var TinyCloudNode = class _TinyCloudNode {
18291
18298
  tinycloudHosts: [host],
18292
18299
  autoCreateSpace: this.config.autoCreateSpace,
18293
18300
  enablePublicSpace: this.config.enablePublicSpace ?? true,
18294
- spaceCreationHandler: this.config.spaceCreationHandler
18301
+ spaceCreationHandler: this.config.spaceCreationHandler,
18302
+ nonce: this.config.nonce,
18303
+ siweConfig: this.config.siweConfig
18295
18304
  });
18296
18305
  this.tc = new import_sdk_core3.TinyCloud(this.auth);
18297
18306
  this.config.prefix = prefix;
@@ -18327,7 +18336,9 @@ var TinyCloudNode = class _TinyCloudNode {
18327
18336
  tinycloudHosts: [host],
18328
18337
  autoCreateSpace: this.config.autoCreateSpace,
18329
18338
  enablePublicSpace: this.config.enablePublicSpace ?? true,
18330
- spaceCreationHandler: this.config.spaceCreationHandler
18339
+ spaceCreationHandler: this.config.spaceCreationHandler,
18340
+ nonce: this.config.nonce,
18341
+ siweConfig: this.config.siweConfig
18331
18342
  });
18332
18343
  this.tc = new import_sdk_core3.TinyCloud(this.auth);
18333
18344
  this.config.prefix = prefix;