@dynamic-labs-wallet/node 1.0.115 → 1.0.116
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 +32 -0
- package/index.esm.js +28 -1
- package/package.json +3 -3
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -1
- package/src/signingContext.d.ts +23 -0
- package/src/signingContext.d.ts.map +1 -0
package/index.cjs
CHANGED
|
@@ -2424,6 +2424,32 @@ function decryptDelegatedWebhookData({ privateKeyPem, encryptedDelegatedKeyShare
|
|
|
2424
2424
|
}
|
|
2425
2425
|
}
|
|
2426
2426
|
|
|
2427
|
+
const ERROR_RAW_SIGN_CONTEXT_REQUIRED = 'Raw digest signing requires a rawSign pre-image ({ payload, hashFunction }) or an explicit context. A bare digest carries no policy meaning, so a policy-enabled wallet rejects it with missing_context.';
|
|
2428
|
+
/**
|
|
2429
|
+
* Resolves the signing context for a raw (already-hashed) message. An explicit
|
|
2430
|
+
* `context` always wins; otherwise the `rawSign` pre-image is turned into a
|
|
2431
|
+
* `rawSign` context. Throws when neither is available rather than sending a
|
|
2432
|
+
* context-less request the server can only reject.
|
|
2433
|
+
*/ const resolveRawSignContext = (context, rawSign)=>{
|
|
2434
|
+
if ((context == null ? void 0 : context.rawSign) !== undefined) {
|
|
2435
|
+
return context;
|
|
2436
|
+
}
|
|
2437
|
+
if (rawSign === undefined) {
|
|
2438
|
+
if (context !== undefined) {
|
|
2439
|
+
return context;
|
|
2440
|
+
}
|
|
2441
|
+
throw new Error(ERROR_RAW_SIGN_CONTEXT_REQUIRED);
|
|
2442
|
+
}
|
|
2443
|
+
return _extends({}, context, {
|
|
2444
|
+
rawSign: _extends({
|
|
2445
|
+
hashFunction: rawSign.hashFunction,
|
|
2446
|
+
payload: rawSign.payload
|
|
2447
|
+
}, rawSign.prefix === undefined ? {} : {
|
|
2448
|
+
prefix: rawSign.prefix
|
|
2449
|
+
})
|
|
2450
|
+
});
|
|
2451
|
+
};
|
|
2452
|
+
|
|
2427
2453
|
/** Formats an EIP-4361-style sign-in message in the exact shape Dynamic's verifier accepts. */ function formatSiweMessage(params) {
|
|
2428
2454
|
var _params_blockchainName;
|
|
2429
2455
|
const header = `${params.domain} wants you to sign in with your ${(_params_blockchainName = params.blockchainName) != null ? _params_blockchainName : 'Ethereum'} account:`;
|
|
@@ -2664,7 +2690,12 @@ Object.defineProperty(exports, "getMPCChainConfig", {
|
|
|
2664
2690
|
enumerable: true,
|
|
2665
2691
|
get: function () { return core$1.getMPCChainConfig; }
|
|
2666
2692
|
});
|
|
2693
|
+
Object.defineProperty(exports, "SignMessageRawSignHashFunctionEnum", {
|
|
2694
|
+
enumerable: true,
|
|
2695
|
+
get: function () { return sdkApiCore.SignMessageRawSignHashFunctionEnum; }
|
|
2696
|
+
});
|
|
2667
2697
|
exports.DynamicWalletClient = DynamicWalletClient;
|
|
2698
|
+
exports.ERROR_RAW_SIGN_CONTEXT_REQUIRED = ERROR_RAW_SIGN_CONTEXT_REQUIRED;
|
|
2668
2699
|
exports.base64ToBytes = base64ToBytes;
|
|
2669
2700
|
exports.bytesToBase64 = bytesToBase64;
|
|
2670
2701
|
exports.createAuthClient = createAuthClient;
|
|
@@ -2683,6 +2714,7 @@ exports.isHexString = isHexString;
|
|
|
2683
2714
|
exports.logError = logError;
|
|
2684
2715
|
exports.mergeUniqueKeyShares = mergeUniqueKeyShares;
|
|
2685
2716
|
exports.parseIndexMapDerivationPath = parseIndexMapDerivationPath;
|
|
2717
|
+
exports.resolveRawSignContext = resolveRawSignContext;
|
|
2686
2718
|
exports.retryPromise = retryPromise;
|
|
2687
2719
|
exports.revokeDelegation = revokeDelegation;
|
|
2688
2720
|
exports.signSessionMessage = signSessionMessage;
|
package/index.esm.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ForwardMPCClientV2 } from '@dynamic-labs-wallet/forward-mpc-client';
|
|
|
8
8
|
import { v4 } from 'uuid';
|
|
9
9
|
import crypto, { webcrypto } from 'node:crypto';
|
|
10
10
|
import { SDKApi, Configuration, WalletProviderEnum, ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
11
|
+
export { SignMessageRawSignHashFunctionEnum } from '@dynamic-labs/sdk-api-core';
|
|
11
12
|
|
|
12
13
|
// Removed duplicate exports - these are already exported from #internal/core
|
|
13
14
|
const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = MPC_RELAY_PROD_API_URL, variant = DEFAULT_ED25519_VARIANT })=>{
|
|
@@ -2423,6 +2424,32 @@ function decryptDelegatedWebhookData({ privateKeyPem, encryptedDelegatedKeyShare
|
|
|
2423
2424
|
}
|
|
2424
2425
|
}
|
|
2425
2426
|
|
|
2427
|
+
const ERROR_RAW_SIGN_CONTEXT_REQUIRED = 'Raw digest signing requires a rawSign pre-image ({ payload, hashFunction }) or an explicit context. A bare digest carries no policy meaning, so a policy-enabled wallet rejects it with missing_context.';
|
|
2428
|
+
/**
|
|
2429
|
+
* Resolves the signing context for a raw (already-hashed) message. An explicit
|
|
2430
|
+
* `context` always wins; otherwise the `rawSign` pre-image is turned into a
|
|
2431
|
+
* `rawSign` context. Throws when neither is available rather than sending a
|
|
2432
|
+
* context-less request the server can only reject.
|
|
2433
|
+
*/ const resolveRawSignContext = (context, rawSign)=>{
|
|
2434
|
+
if ((context == null ? void 0 : context.rawSign) !== undefined) {
|
|
2435
|
+
return context;
|
|
2436
|
+
}
|
|
2437
|
+
if (rawSign === undefined) {
|
|
2438
|
+
if (context !== undefined) {
|
|
2439
|
+
return context;
|
|
2440
|
+
}
|
|
2441
|
+
throw new Error(ERROR_RAW_SIGN_CONTEXT_REQUIRED);
|
|
2442
|
+
}
|
|
2443
|
+
return _extends({}, context, {
|
|
2444
|
+
rawSign: _extends({
|
|
2445
|
+
hashFunction: rawSign.hashFunction,
|
|
2446
|
+
payload: rawSign.payload
|
|
2447
|
+
}, rawSign.prefix === undefined ? {} : {
|
|
2448
|
+
prefix: rawSign.prefix
|
|
2449
|
+
})
|
|
2450
|
+
});
|
|
2451
|
+
};
|
|
2452
|
+
|
|
2426
2453
|
/** Formats an EIP-4361-style sign-in message in the exact shape Dynamic's verifier accepts. */ function formatSiweMessage(params) {
|
|
2427
2454
|
var _params_blockchainName;
|
|
2428
2455
|
const header = `${params.domain} wants you to sign in with your ${(_params_blockchainName = params.blockchainName) != null ? _params_blockchainName : 'Ethereum'} account:`;
|
|
@@ -2647,4 +2674,4 @@ const asAuthError = async (error, operation)=>{
|
|
|
2647
2674
|
};
|
|
2648
2675
|
}
|
|
2649
2676
|
|
|
2650
|
-
export { DynamicWalletClient, base64ToBytes, bytesToBase64, createAuthClient, createDelegatedWalletClient, createLogError, decryptDelegatedWebhookData, delegatedSignMessage, ensureBase64Padding, formatEvmMessage, formatMessage, generateSessionKeyPair, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, logError, mergeUniqueKeyShares, parseIndexMapDerivationPath, retryPromise, revokeDelegation, signSessionMessage, stringToBytes, stripHexPrefix, withDelegatedServerAuth };
|
|
2677
|
+
export { DynamicWalletClient, ERROR_RAW_SIGN_CONTEXT_REQUIRED, base64ToBytes, bytesToBase64, createAuthClient, createDelegatedWalletClient, createLogError, decryptDelegatedWebhookData, delegatedSignMessage, ensureBase64Padding, formatEvmMessage, formatMessage, generateSessionKeyPair, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, logError, mergeUniqueKeyShares, parseIndexMapDerivationPath, resolveRawSignContext, retryPromise, revokeDelegation, signSessionMessage, stringToBytes, stripHexPrefix, withDelegatedServerAuth };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.116",
|
|
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.0.
|
|
7
|
+
"@dynamic-labs-wallet/core": "1.0.116",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
9
|
-
"@dynamic-labs-wallet/primitives": "1.0.
|
|
9
|
+
"@dynamic-labs-wallet/primitives": "1.0.116",
|
|
10
10
|
"@dynamic-labs/logger": "^5.0.0",
|
|
11
11
|
"@dynamic-labs/sdk-api-core": "^0.16.0",
|
|
12
12
|
"uuid": "11.1.0",
|
package/src/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export { generateSessionKeyPair, signSessionMessage } from './sessionKeys.js';
|
|
|
11
11
|
export * from './mpc/index.js';
|
|
12
12
|
export { createDelegatedWalletClient, delegatedSignMessage, revokeDelegation, decryptDelegatedWebhookData, withDelegatedServerAuth, } from './delegatedClient/index.js';
|
|
13
13
|
export type { DelegatedWalletClient, DelegatedClientConfig, EncryptedDelegatedPayload, } from './delegatedClient/index.js';
|
|
14
|
+
export { ERROR_RAW_SIGN_CONTEXT_REQUIRED, SignMessageRawSignHashFunctionEnum, resolveRawSignContext, } from './signingContext.js';
|
|
15
|
+
export type { RawSignPreImage } from './signingContext.js';
|
|
14
16
|
export { createAuthClient } from './authClient.js';
|
|
15
17
|
export type { AuthResult, CreateAuthClientOptions, DynamicAuthClient } from './authClient.js';
|
|
16
18
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG/F,OAAO,EAAE,qBA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AAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,gBAAgB,EAChB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SignMessageRawSignHashFunctionEnum, type SignMessageContext } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
export declare const ERROR_RAW_SIGN_CONTEXT_REQUIRED = "Raw digest signing requires a rawSign pre-image ({ payload, hashFunction }) or an explicit context. A bare digest carries no policy meaning, so a policy-enabled wallet rejects it with missing_context.";
|
|
3
|
+
/**
|
|
4
|
+
* Pre-image a raw digest is derived from: the signed digest must equal
|
|
5
|
+
* `hashFunction(prefix ‖ payload)`, which is what binds a chain-agnostic raw
|
|
6
|
+
* sign to something policy can evaluate.
|
|
7
|
+
*/
|
|
8
|
+
export type RawSignPreImage = {
|
|
9
|
+
hashFunction: SignMessageRawSignHashFunctionEnum;
|
|
10
|
+
/** Pre-image the digest is derived from, as a hex string. */
|
|
11
|
+
payload: string;
|
|
12
|
+
/** Optional hex prefix hashed ahead of the payload, e.g. XRPL's `STX\0` (`53545800`). */
|
|
13
|
+
prefix?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the signing context for a raw (already-hashed) message. An explicit
|
|
17
|
+
* `context` always wins; otherwise the `rawSign` pre-image is turned into a
|
|
18
|
+
* `rawSign` context. Throws when neither is available rather than sending a
|
|
19
|
+
* context-less request the server can only reject.
|
|
20
|
+
*/
|
|
21
|
+
export declare const resolveRawSignContext: (context: SignMessageContext | undefined, rawSign: RawSignPreImage | undefined) => SignMessageContext;
|
|
22
|
+
export { SignMessageRawSignHashFunctionEnum };
|
|
23
|
+
//# sourceMappingURL=signingContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signingContext.d.ts","sourceRoot":"","sources":["../../packages/src/signingContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEzG,eAAO,MAAM,+BAA+B,6MACgK,CAAC;AAE7M;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,kCAAkC,CAAC;IACjD,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,YACvB,kBAAkB,GAAG,SAAS,WAC9B,eAAe,GAAG,SAAS,KACnC,kBAoBF,CAAC;AAEF,OAAO,EAAE,kCAAkC,EAAE,CAAC"}
|