@tinycloud/node-sdk 2.0.3-beta.2 → 2.0.4-beta.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/core.cjs +16 -5
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +13 -1
- package/dist/core.d.ts +13 -1
- package/dist/core.js +16 -5
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +16 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/core.cjs
CHANGED
|
@@ -318,6 +318,7 @@ var NodeUserAuthorization = class {
|
|
|
318
318
|
this.spaceCreationHandler = config.spaceCreationHandler;
|
|
319
319
|
this.tinycloudHosts = config.tinycloudHosts ?? ["https://node.tinycloud.xyz"];
|
|
320
320
|
this.enablePublicSpace = config.enablePublicSpace ?? true;
|
|
321
|
+
this.nonce = config.nonce;
|
|
321
322
|
this.siweConfig = config.siweConfig;
|
|
322
323
|
this.sessionManager = this.wasm.createSessionManager();
|
|
323
324
|
}
|
|
@@ -338,16 +339,21 @@ var NodeUserAuthorization = class {
|
|
|
338
339
|
return this._nodeFeatures;
|
|
339
340
|
}
|
|
340
341
|
/**
|
|
341
|
-
* Build SIWE overrides from siweConfig.
|
|
342
|
+
* Build SIWE overrides from the top-level nonce and siweConfig.
|
|
343
|
+
* - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
|
|
342
344
|
* - statement is prepended to the default statement
|
|
343
345
|
* - resources are appended to the default resources
|
|
344
346
|
* - uri triggers a warning (overwriting delegation target)
|
|
345
347
|
* - all other fields override directly
|
|
346
348
|
*/
|
|
347
349
|
buildSiweOverrides() {
|
|
348
|
-
|
|
350
|
+
const base = { uri: this.uri };
|
|
351
|
+
if (this.nonce !== void 0) {
|
|
352
|
+
base.nonce = this.nonce;
|
|
353
|
+
}
|
|
354
|
+
if (!this.siweConfig) return base;
|
|
349
355
|
const { statement, resources, uri, ...rest } = this.siweConfig;
|
|
350
|
-
const overrides = {
|
|
356
|
+
const overrides = { ...base, ...rest };
|
|
351
357
|
if (statement) {
|
|
352
358
|
overrides.statement = this.statement ? `${statement} ${this.statement}` : statement;
|
|
353
359
|
}
|
|
@@ -1103,6 +1109,7 @@ var TinyCloudNode = class _TinyCloudNode {
|
|
|
1103
1109
|
autoCreateSpace: config.autoCreateSpace,
|
|
1104
1110
|
enablePublicSpace: config.enablePublicSpace ?? true,
|
|
1105
1111
|
spaceCreationHandler: config.spaceCreationHandler,
|
|
1112
|
+
nonce: config.nonce,
|
|
1106
1113
|
siweConfig: config.siweConfig
|
|
1107
1114
|
});
|
|
1108
1115
|
this.tc = new import_sdk_core4.TinyCloud(this.auth);
|
|
@@ -1309,7 +1316,9 @@ var TinyCloudNode = class _TinyCloudNode {
|
|
|
1309
1316
|
tinycloudHosts: [host],
|
|
1310
1317
|
autoCreateSpace: this.config.autoCreateSpace,
|
|
1311
1318
|
enablePublicSpace: this.config.enablePublicSpace ?? true,
|
|
1312
|
-
spaceCreationHandler: this.config.spaceCreationHandler
|
|
1319
|
+
spaceCreationHandler: this.config.spaceCreationHandler,
|
|
1320
|
+
nonce: this.config.nonce,
|
|
1321
|
+
siweConfig: this.config.siweConfig
|
|
1313
1322
|
});
|
|
1314
1323
|
this.tc = new import_sdk_core4.TinyCloud(this.auth);
|
|
1315
1324
|
this.config.prefix = prefix;
|
|
@@ -1345,7 +1354,9 @@ var TinyCloudNode = class _TinyCloudNode {
|
|
|
1345
1354
|
tinycloudHosts: [host],
|
|
1346
1355
|
autoCreateSpace: this.config.autoCreateSpace,
|
|
1347
1356
|
enablePublicSpace: this.config.enablePublicSpace ?? true,
|
|
1348
|
-
spaceCreationHandler: this.config.spaceCreationHandler
|
|
1357
|
+
spaceCreationHandler: this.config.spaceCreationHandler,
|
|
1358
|
+
nonce: this.config.nonce,
|
|
1359
|
+
siweConfig: this.config.siweConfig
|
|
1349
1360
|
});
|
|
1350
1361
|
this.tc = new import_sdk_core4.TinyCloud(this.auth);
|
|
1351
1362
|
this.config.prefix = prefix;
|