@tinycloud/node-sdk 2.1.0-beta.4 → 2.1.0-beta.5
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 +17 -7
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +9 -4
- package/dist/core.d.ts +9 -4
- package/dist/core.js +17 -7
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +17 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -17402,14 +17402,17 @@ var NodeUserAuthorization = class {
|
|
|
17402
17402
|
* - resources are appended to the default resources
|
|
17403
17403
|
* - uri triggers a warning (overwriting delegation target)
|
|
17404
17404
|
* - all other fields override directly
|
|
17405
|
+
* - per-call nonce overrides siweConfig.nonce when provided
|
|
17405
17406
|
*/
|
|
17406
|
-
buildSiweOverrides() {
|
|
17407
|
+
buildSiweOverrides(options) {
|
|
17407
17408
|
const base2 = { uri: this.uri };
|
|
17408
17409
|
if (this.nonce !== void 0) {
|
|
17409
17410
|
base2.nonce = this.nonce;
|
|
17410
17411
|
}
|
|
17411
|
-
if (!this.siweConfig)
|
|
17412
|
-
|
|
17412
|
+
if (!this.siweConfig && !options?.nonce) {
|
|
17413
|
+
return base2;
|
|
17414
|
+
}
|
|
17415
|
+
const { statement, resources, uri, ...rest } = this.siweConfig ?? {};
|
|
17413
17416
|
const overrides = { ...base2, ...rest };
|
|
17414
17417
|
if (statement) {
|
|
17415
17418
|
overrides.statement = this.statement ? `${statement} ${this.statement}` : statement;
|
|
@@ -17423,6 +17426,9 @@ var NodeUserAuthorization = class {
|
|
|
17423
17426
|
);
|
|
17424
17427
|
overrides.uri = uri;
|
|
17425
17428
|
}
|
|
17429
|
+
if (options?.nonce) {
|
|
17430
|
+
overrides.nonce = options.nonce;
|
|
17431
|
+
}
|
|
17426
17432
|
return overrides;
|
|
17427
17433
|
}
|
|
17428
17434
|
/**
|
|
@@ -17581,8 +17587,10 @@ var NodeUserAuthorization = class {
|
|
|
17581
17587
|
* 2. Call prepareSession() which generates the SIWE with ReCap capabilities
|
|
17582
17588
|
* 3. Sign the SIWE string from prepareSession
|
|
17583
17589
|
* 4. Call completeSessionSetup() with the prepared session + signature
|
|
17590
|
+
*
|
|
17591
|
+
* @param options - Optional per-call SIWE overrides for this sign-in only
|
|
17584
17592
|
*/
|
|
17585
|
-
async signIn() {
|
|
17593
|
+
async signIn(options) {
|
|
17586
17594
|
this._address = await this.signer.getAddress();
|
|
17587
17595
|
this._chainId = await this.signer.getChainId();
|
|
17588
17596
|
const address = this.wasm.ensureEip55(this._address);
|
|
@@ -17606,7 +17614,7 @@ var NodeUserAuthorization = class {
|
|
|
17606
17614
|
expirationTime: expirationTime.toISOString(),
|
|
17607
17615
|
spaceId,
|
|
17608
17616
|
jwk,
|
|
17609
|
-
...this.buildSiweOverrides()
|
|
17617
|
+
...this.buildSiweOverrides(options)
|
|
17610
17618
|
});
|
|
17611
17619
|
const signature2 = await this.requestSignature({
|
|
17612
17620
|
address,
|
|
@@ -18330,8 +18338,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18330
18338
|
* Sign in and create a new session.
|
|
18331
18339
|
* This creates the user's space if it doesn't exist.
|
|
18332
18340
|
* Requires wallet mode (privateKey in config).
|
|
18341
|
+
*
|
|
18342
|
+
* @param options - Optional per-call SIWE overrides for this sign-in only
|
|
18333
18343
|
*/
|
|
18334
|
-
async signIn() {
|
|
18344
|
+
async signIn(options) {
|
|
18335
18345
|
if (!this.signer || !this.tc) {
|
|
18336
18346
|
throw new Error(
|
|
18337
18347
|
"Cannot signIn() in session-only mode. Provide a privateKey in config to create your own space."
|
|
@@ -18345,7 +18355,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18345
18355
|
this._duckdb = void 0;
|
|
18346
18356
|
this._hooks = void 0;
|
|
18347
18357
|
this._serviceContext = void 0;
|
|
18348
|
-
await this.tc.signIn();
|
|
18358
|
+
await this.tc.signIn(options);
|
|
18349
18359
|
this.initializeServices();
|
|
18350
18360
|
this.notificationHandler.success("Successfully signed in");
|
|
18351
18361
|
}
|