@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.d.cts
CHANGED
|
@@ -196,6 +196,11 @@ interface NodeUserAuthorizationConfig {
|
|
|
196
196
|
enablePublicSpace?: boolean;
|
|
197
197
|
/** WASM bindings for cryptographic operations. Required. */
|
|
198
198
|
wasmBindings: IWasmBindings;
|
|
199
|
+
/**
|
|
200
|
+
* SIWE nonce override. If omitted, the WASM layer generates a random nonce.
|
|
201
|
+
* If `siweConfig.nonce` is also provided, `siweConfig.nonce` wins.
|
|
202
|
+
*/
|
|
203
|
+
nonce?: string;
|
|
199
204
|
/** Optional SIWE configuration overrides (e.g., nonce for server-provided nonces) */
|
|
200
205
|
siweConfig?: SiweConfig;
|
|
201
206
|
}
|
|
@@ -245,6 +250,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
245
250
|
private readonly spaceCreationHandler?;
|
|
246
251
|
private readonly tinycloudHosts;
|
|
247
252
|
private readonly enablePublicSpace;
|
|
253
|
+
private readonly nonce?;
|
|
248
254
|
private readonly siweConfig?;
|
|
249
255
|
private readonly wasm;
|
|
250
256
|
private sessionManager;
|
|
@@ -266,7 +272,8 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
266
272
|
get tinyCloudSession(): TinyCloudSession | undefined;
|
|
267
273
|
get nodeFeatures(): string[];
|
|
268
274
|
/**
|
|
269
|
-
* Build SIWE overrides from siweConfig.
|
|
275
|
+
* Build SIWE overrides from the top-level nonce and siweConfig.
|
|
276
|
+
* - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
|
|
270
277
|
* - statement is prepended to the default statement
|
|
271
278
|
* - resources are appended to the default resources
|
|
272
279
|
* - uri triggers a warning (overwriting delegation target)
|
|
@@ -530,6 +537,11 @@ interface TinyCloudNodeConfig {
|
|
|
530
537
|
ensResolver?: IENSResolver;
|
|
531
538
|
/** Custom space creation handler (default: auto-approve when autoCreateSpace is true) */
|
|
532
539
|
spaceCreationHandler?: ISpaceCreationHandler;
|
|
540
|
+
/**
|
|
541
|
+
* SIWE nonce override. If omitted, the WASM layer generates a random nonce.
|
|
542
|
+
* If `siweConfig.nonce` is also provided, `siweConfig.nonce` wins.
|
|
543
|
+
*/
|
|
544
|
+
nonce?: string;
|
|
533
545
|
/** Optional SIWE configuration overrides (e.g., nonce for server-provided nonces) */
|
|
534
546
|
siweConfig?: SiweConfig;
|
|
535
547
|
}
|
package/dist/core.d.ts
CHANGED
|
@@ -196,6 +196,11 @@ interface NodeUserAuthorizationConfig {
|
|
|
196
196
|
enablePublicSpace?: boolean;
|
|
197
197
|
/** WASM bindings for cryptographic operations. Required. */
|
|
198
198
|
wasmBindings: IWasmBindings;
|
|
199
|
+
/**
|
|
200
|
+
* SIWE nonce override. If omitted, the WASM layer generates a random nonce.
|
|
201
|
+
* If `siweConfig.nonce` is also provided, `siweConfig.nonce` wins.
|
|
202
|
+
*/
|
|
203
|
+
nonce?: string;
|
|
199
204
|
/** Optional SIWE configuration overrides (e.g., nonce for server-provided nonces) */
|
|
200
205
|
siweConfig?: SiweConfig;
|
|
201
206
|
}
|
|
@@ -245,6 +250,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
245
250
|
private readonly spaceCreationHandler?;
|
|
246
251
|
private readonly tinycloudHosts;
|
|
247
252
|
private readonly enablePublicSpace;
|
|
253
|
+
private readonly nonce?;
|
|
248
254
|
private readonly siweConfig?;
|
|
249
255
|
private readonly wasm;
|
|
250
256
|
private sessionManager;
|
|
@@ -266,7 +272,8 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
266
272
|
get tinyCloudSession(): TinyCloudSession | undefined;
|
|
267
273
|
get nodeFeatures(): string[];
|
|
268
274
|
/**
|
|
269
|
-
* Build SIWE overrides from siweConfig.
|
|
275
|
+
* Build SIWE overrides from the top-level nonce and siweConfig.
|
|
276
|
+
* - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
|
|
270
277
|
* - statement is prepended to the default statement
|
|
271
278
|
* - resources are appended to the default resources
|
|
272
279
|
* - uri triggers a warning (overwriting delegation target)
|
|
@@ -530,6 +537,11 @@ interface TinyCloudNodeConfig {
|
|
|
530
537
|
ensResolver?: IENSResolver;
|
|
531
538
|
/** Custom space creation handler (default: auto-approve when autoCreateSpace is true) */
|
|
532
539
|
spaceCreationHandler?: ISpaceCreationHandler;
|
|
540
|
+
/**
|
|
541
|
+
* SIWE nonce override. If omitted, the WASM layer generates a random nonce.
|
|
542
|
+
* If `siweConfig.nonce` is also provided, `siweConfig.nonce` wins.
|
|
543
|
+
*/
|
|
544
|
+
nonce?: string;
|
|
533
545
|
/** Optional SIWE configuration overrides (e.g., nonce for server-provided nonces) */
|
|
534
546
|
siweConfig?: SiweConfig;
|
|
535
547
|
}
|
package/dist/core.js
CHANGED
|
@@ -260,6 +260,7 @@ var NodeUserAuthorization = class {
|
|
|
260
260
|
this.spaceCreationHandler = config.spaceCreationHandler;
|
|
261
261
|
this.tinycloudHosts = config.tinycloudHosts ?? ["https://node.tinycloud.xyz"];
|
|
262
262
|
this.enablePublicSpace = config.enablePublicSpace ?? true;
|
|
263
|
+
this.nonce = config.nonce;
|
|
263
264
|
this.siweConfig = config.siweConfig;
|
|
264
265
|
this.sessionManager = this.wasm.createSessionManager();
|
|
265
266
|
}
|
|
@@ -280,16 +281,21 @@ var NodeUserAuthorization = class {
|
|
|
280
281
|
return this._nodeFeatures;
|
|
281
282
|
}
|
|
282
283
|
/**
|
|
283
|
-
* Build SIWE overrides from siweConfig.
|
|
284
|
+
* Build SIWE overrides from the top-level nonce and siweConfig.
|
|
285
|
+
* - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
|
|
284
286
|
* - statement is prepended to the default statement
|
|
285
287
|
* - resources are appended to the default resources
|
|
286
288
|
* - uri triggers a warning (overwriting delegation target)
|
|
287
289
|
* - all other fields override directly
|
|
288
290
|
*/
|
|
289
291
|
buildSiweOverrides() {
|
|
290
|
-
|
|
292
|
+
const base = { uri: this.uri };
|
|
293
|
+
if (this.nonce !== void 0) {
|
|
294
|
+
base.nonce = this.nonce;
|
|
295
|
+
}
|
|
296
|
+
if (!this.siweConfig) return base;
|
|
291
297
|
const { statement, resources, uri, ...rest } = this.siweConfig;
|
|
292
|
-
const overrides = {
|
|
298
|
+
const overrides = { ...base, ...rest };
|
|
293
299
|
if (statement) {
|
|
294
300
|
overrides.statement = this.statement ? `${statement} ${this.statement}` : statement;
|
|
295
301
|
}
|
|
@@ -1066,6 +1072,7 @@ var TinyCloudNode = class _TinyCloudNode {
|
|
|
1066
1072
|
autoCreateSpace: config.autoCreateSpace,
|
|
1067
1073
|
enablePublicSpace: config.enablePublicSpace ?? true,
|
|
1068
1074
|
spaceCreationHandler: config.spaceCreationHandler,
|
|
1075
|
+
nonce: config.nonce,
|
|
1069
1076
|
siweConfig: config.siweConfig
|
|
1070
1077
|
});
|
|
1071
1078
|
this.tc = new TinyCloud(this.auth);
|
|
@@ -1272,7 +1279,9 @@ var TinyCloudNode = class _TinyCloudNode {
|
|
|
1272
1279
|
tinycloudHosts: [host],
|
|
1273
1280
|
autoCreateSpace: this.config.autoCreateSpace,
|
|
1274
1281
|
enablePublicSpace: this.config.enablePublicSpace ?? true,
|
|
1275
|
-
spaceCreationHandler: this.config.spaceCreationHandler
|
|
1282
|
+
spaceCreationHandler: this.config.spaceCreationHandler,
|
|
1283
|
+
nonce: this.config.nonce,
|
|
1284
|
+
siweConfig: this.config.siweConfig
|
|
1276
1285
|
});
|
|
1277
1286
|
this.tc = new TinyCloud(this.auth);
|
|
1278
1287
|
this.config.prefix = prefix;
|
|
@@ -1308,7 +1317,9 @@ var TinyCloudNode = class _TinyCloudNode {
|
|
|
1308
1317
|
tinycloudHosts: [host],
|
|
1309
1318
|
autoCreateSpace: this.config.autoCreateSpace,
|
|
1310
1319
|
enablePublicSpace: this.config.enablePublicSpace ?? true,
|
|
1311
|
-
spaceCreationHandler: this.config.spaceCreationHandler
|
|
1320
|
+
spaceCreationHandler: this.config.spaceCreationHandler,
|
|
1321
|
+
nonce: this.config.nonce,
|
|
1322
|
+
siweConfig: this.config.siweConfig
|
|
1312
1323
|
});
|
|
1313
1324
|
this.tc = new TinyCloud(this.auth);
|
|
1314
1325
|
this.config.prefix = prefix;
|