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