@dynamic-labs-wallet/node 1.1.21 → 1.1.22
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/index.cjs +6 -6
- package/index.esm.js +6 -6
- package/package.json +3 -3
- package/src/client.d.ts +3 -3
package/index.cjs
CHANGED
|
@@ -530,16 +530,16 @@ class DynamicWalletClient {
|
|
|
530
530
|
* Resolves the session key to bind into `authenticateApiToken`'s JWT.
|
|
531
531
|
*
|
|
532
532
|
* Defaults to generating a fresh session key per call (never persisted),
|
|
533
|
-
* mirroring the browser's rotate-on-reauth behavior. Pass `
|
|
533
|
+
* mirroring the browser's rotate-on-reauth behavior. Pass `signingPublicKey`
|
|
534
534
|
* + `getSessionSignature` together to supply your own instead — e.g. a
|
|
535
535
|
* stable key reused across calls, or one backed by a KMS/HSM/enclave signer.
|
|
536
536
|
*/ async resolveSessionKey(options) {
|
|
537
|
-
if ((options == null ? void 0 : options.
|
|
538
|
-
if (!options.
|
|
539
|
-
throw new Error('authenticateApiToken:
|
|
537
|
+
if ((options == null ? void 0 : options.signingPublicKey) || (options == null ? void 0 : options.getSessionSignature)) {
|
|
538
|
+
if (!options.signingPublicKey || !options.getSessionSignature) {
|
|
539
|
+
throw new Error('authenticateApiToken: signingPublicKey and getSessionSignature must be supplied together, or both omitted to auto-generate a session key.');
|
|
540
540
|
}
|
|
541
541
|
return {
|
|
542
|
-
publicKeyHex: options.
|
|
542
|
+
publicKeyHex: options.signingPublicKey,
|
|
543
543
|
getSessionSignature: options.getSessionSignature
|
|
544
544
|
};
|
|
545
545
|
}
|
|
@@ -561,7 +561,7 @@ class DynamicWalletClient {
|
|
|
561
561
|
const { publicKeyHex, getSessionSignature } = await this.resolveSessionKey(options);
|
|
562
562
|
const response = await tmpClient.authenticateApiToken({
|
|
563
563
|
environmentId: this.environmentId,
|
|
564
|
-
|
|
564
|
+
signingPublicKey: publicKeyHex
|
|
565
565
|
});
|
|
566
566
|
this.setAuthenticatedJwt(response.data.encodedJwts.minifiedJwt);
|
|
567
567
|
this.getSessionSignature = getSessionSignature;
|
package/index.esm.js
CHANGED
|
@@ -530,16 +530,16 @@ class DynamicWalletClient {
|
|
|
530
530
|
* Resolves the session key to bind into `authenticateApiToken`'s JWT.
|
|
531
531
|
*
|
|
532
532
|
* Defaults to generating a fresh session key per call (never persisted),
|
|
533
|
-
* mirroring the browser's rotate-on-reauth behavior. Pass `
|
|
533
|
+
* mirroring the browser's rotate-on-reauth behavior. Pass `signingPublicKey`
|
|
534
534
|
* + `getSessionSignature` together to supply your own instead — e.g. a
|
|
535
535
|
* stable key reused across calls, or one backed by a KMS/HSM/enclave signer.
|
|
536
536
|
*/ async resolveSessionKey(options) {
|
|
537
|
-
if ((options == null ? void 0 : options.
|
|
538
|
-
if (!options.
|
|
539
|
-
throw new Error('authenticateApiToken:
|
|
537
|
+
if ((options == null ? void 0 : options.signingPublicKey) || (options == null ? void 0 : options.getSessionSignature)) {
|
|
538
|
+
if (!options.signingPublicKey || !options.getSessionSignature) {
|
|
539
|
+
throw new Error('authenticateApiToken: signingPublicKey and getSessionSignature must be supplied together, or both omitted to auto-generate a session key.');
|
|
540
540
|
}
|
|
541
541
|
return {
|
|
542
|
-
publicKeyHex: options.
|
|
542
|
+
publicKeyHex: options.signingPublicKey,
|
|
543
543
|
getSessionSignature: options.getSessionSignature
|
|
544
544
|
};
|
|
545
545
|
}
|
|
@@ -561,7 +561,7 @@ class DynamicWalletClient {
|
|
|
561
561
|
const { publicKeyHex, getSessionSignature } = await this.resolveSessionKey(options);
|
|
562
562
|
const response = await tmpClient.authenticateApiToken({
|
|
563
563
|
environmentId: this.environmentId,
|
|
564
|
-
|
|
564
|
+
signingPublicKey: publicKeyHex
|
|
565
565
|
});
|
|
566
566
|
this.setAuthenticatedJwt(response.data.encodedJwts.minifiedJwt);
|
|
567
567
|
this.getSessionSignature = getSessionSignature;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/core": "1.1.
|
|
7
|
+
"@dynamic-labs-wallet/core": "1.1.22",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "2.0.2",
|
|
9
|
-
"@dynamic-labs-wallet/primitives": "1.1.
|
|
9
|
+
"@dynamic-labs-wallet/primitives": "1.1.22",
|
|
10
10
|
"@dynamic-labs/logger": "^5.0.0",
|
|
11
11
|
"@dynamic-labs/sdk-api-core": "0.50.0",
|
|
12
12
|
"uuid": "11.1.0",
|
package/src/client.d.ts
CHANGED
|
@@ -44,15 +44,15 @@ export declare class DynamicWalletClient {
|
|
|
44
44
|
* Resolves the session key to bind into `authenticateApiToken`'s JWT.
|
|
45
45
|
*
|
|
46
46
|
* Defaults to generating a fresh session key per call (never persisted),
|
|
47
|
-
* mirroring the browser's rotate-on-reauth behavior. Pass `
|
|
47
|
+
* mirroring the browser's rotate-on-reauth behavior. Pass `signingPublicKey`
|
|
48
48
|
* + `getSessionSignature` together to supply your own instead — e.g. a
|
|
49
49
|
* stable key reused across calls, or one backed by a KMS/HSM/enclave signer.
|
|
50
50
|
*/
|
|
51
51
|
private resolveSessionKey;
|
|
52
52
|
authenticateApiToken(authToken: string, options?: {
|
|
53
53
|
/** Compressed P-256 public key hex, bound into the JWT's `session_public_key` claim. Must be supplied together with `getSessionSignature`. */
|
|
54
|
-
|
|
55
|
-
/** Signs with the private key backing `
|
|
54
|
+
signingPublicKey?: string;
|
|
55
|
+
/** Signs with the private key backing `signingPublicKey` (see `signSessionMessage`, or your own KMS/HSM/enclave signer). Must be supplied together with `signingPublicKey`. */
|
|
56
56
|
getSessionSignature?: (message: string) => Promise<string>;
|
|
57
57
|
}): Promise<void>;
|
|
58
58
|
/**
|