@dynamic-labs-wallet/node 1.0.56 → 1.0.58
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 +12 -17
- package/index.esm.js +12 -17
- package/package.json +3 -3
- package/src/utils.d.ts.map +1 -1
package/index.cjs
CHANGED
|
@@ -7,8 +7,7 @@ var node = require('#internal/node');
|
|
|
7
7
|
var logger = require('@dynamic-labs/logger');
|
|
8
8
|
var forwardMpcClient = require('@dynamic-labs-wallet/forward-mpc-client');
|
|
9
9
|
var uuid = require('uuid');
|
|
10
|
-
var crypto = require('crypto');
|
|
11
|
-
var crypto$1 = require('node:crypto');
|
|
10
|
+
var crypto = require('node:crypto');
|
|
12
11
|
|
|
13
12
|
// Removed duplicate exports - these are already exported from #internal/core
|
|
14
13
|
const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = core$1.MPC_RELAY_PROD_API_URL })=>{
|
|
@@ -61,7 +60,7 @@ const logError = ({ message, error, context, clientTag = 'node' })=>{
|
|
|
61
60
|
});
|
|
62
61
|
};
|
|
63
62
|
const bytesToBase64 = (arr)=>{
|
|
64
|
-
return
|
|
63
|
+
return Buffer.from(arr).toString('base64');
|
|
65
64
|
};
|
|
66
65
|
const stringToBytes = (str)=>{
|
|
67
66
|
return new TextEncoder().encode(str);
|
|
@@ -116,7 +115,7 @@ const getExternalServerKeyShareBackupInfo = (params)=>{
|
|
|
116
115
|
*/ const mergeUniqueKeyShares = (existingKeyShares, newKeyShares)=>{
|
|
117
116
|
const uniqueKeyShares = newKeyShares.filter((newShare)=>!existingKeyShares.some((existingShare)=>{
|
|
118
117
|
if (!(newShare == null ? void 0 : newShare.pubkey) || !(existingShare == null ? void 0 : existingShare.pubkey)) return false;
|
|
119
|
-
return newShare.pubkey
|
|
118
|
+
return String(newShare.pubkey) === String(existingShare.pubkey) && newShare.secretShare === existingShare.secretShare;
|
|
120
119
|
}));
|
|
121
120
|
return [
|
|
122
121
|
...existingKeyShares,
|
|
@@ -158,25 +157,21 @@ const formatEvmMessage = (message)=>{
|
|
|
158
157
|
};
|
|
159
158
|
const formatSolanaMessage = (message)=>{
|
|
160
159
|
if (typeof message === 'string') {
|
|
161
|
-
if (
|
|
162
|
-
return Buffer.from(message).toString('hex');
|
|
163
|
-
} else {
|
|
160
|
+
if (isHexString(message)) {
|
|
164
161
|
return new Uint8Array(Buffer.from(message, 'hex'));
|
|
165
162
|
}
|
|
166
|
-
|
|
167
|
-
return message;
|
|
163
|
+
return Buffer.from(message).toString('hex');
|
|
168
164
|
}
|
|
165
|
+
return message;
|
|
169
166
|
};
|
|
170
167
|
const formatTonMessage = (message)=>{
|
|
171
168
|
if (typeof message === 'string') {
|
|
172
|
-
if (
|
|
173
|
-
return Buffer.from(message).toString('hex');
|
|
174
|
-
} else {
|
|
169
|
+
if (isHexString(message)) {
|
|
175
170
|
return new Uint8Array(Buffer.from(message, 'hex'));
|
|
176
171
|
}
|
|
177
|
-
|
|
178
|
-
return message;
|
|
172
|
+
return Buffer.from(message).toString('hex');
|
|
179
173
|
}
|
|
174
|
+
return message;
|
|
180
175
|
};
|
|
181
176
|
const formatMessage = (chainName, message)=>{
|
|
182
177
|
switch(chainName){
|
|
@@ -2012,7 +2007,7 @@ function decryptAesGcm(key, ivB64, ctB64, tagB64) {
|
|
|
2012
2007
|
const iv = Buffer.from(ivB64, 'base64url');
|
|
2013
2008
|
const ciphertext = Buffer.from(ctB64, 'base64url');
|
|
2014
2009
|
const tag = Buffer.from(tagB64, 'base64url');
|
|
2015
|
-
const decipher = crypto
|
|
2010
|
+
const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);
|
|
2016
2011
|
decipher.setAuthTag(tag);
|
|
2017
2012
|
const updateResult = decipher.update(ciphertext);
|
|
2018
2013
|
const finalResult = decipher.final();
|
|
@@ -2023,10 +2018,10 @@ function decryptAesGcm(key, ivB64, ctB64, tagB64) {
|
|
|
2023
2018
|
return plaintext;
|
|
2024
2019
|
}
|
|
2025
2020
|
function rsaOaepDecryptEk(privateKeyPem, ekB64) {
|
|
2026
|
-
return crypto
|
|
2021
|
+
return crypto.privateDecrypt({
|
|
2027
2022
|
key: privateKeyPem,
|
|
2028
2023
|
oaepHash: 'sha256',
|
|
2029
|
-
padding: crypto
|
|
2024
|
+
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING
|
|
2030
2025
|
}, Buffer.from(ekB64, 'base64url'));
|
|
2031
2026
|
}
|
|
2032
2027
|
function decryptDelegatedWebhookData({ privateKeyPem, encryptedDelegatedKeyShare, encryptedWalletApiKey }) {
|
package/index.esm.js
CHANGED
|
@@ -6,8 +6,7 @@ import { BIP340, ExportableEd25519, Ecdsa, MessageHash, EcdsaSignature, EcdsaKey
|
|
|
6
6
|
import { Logger as Logger$1 } from '@dynamic-labs/logger';
|
|
7
7
|
import { ForwardMPCClientV2 } from '@dynamic-labs-wallet/forward-mpc-client';
|
|
8
8
|
import { v4 } from 'uuid';
|
|
9
|
-
import crypto from 'crypto';
|
|
10
|
-
import crypto$1 from 'node:crypto';
|
|
9
|
+
import crypto from 'node:crypto';
|
|
11
10
|
|
|
12
11
|
// Removed duplicate exports - these are already exported from #internal/core
|
|
13
12
|
const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = MPC_RELAY_PROD_API_URL })=>{
|
|
@@ -60,7 +59,7 @@ const logError = ({ message, error, context, clientTag = 'node' })=>{
|
|
|
60
59
|
});
|
|
61
60
|
};
|
|
62
61
|
const bytesToBase64 = (arr)=>{
|
|
63
|
-
return
|
|
62
|
+
return Buffer.from(arr).toString('base64');
|
|
64
63
|
};
|
|
65
64
|
const stringToBytes = (str)=>{
|
|
66
65
|
return new TextEncoder().encode(str);
|
|
@@ -115,7 +114,7 @@ const getExternalServerKeyShareBackupInfo = (params)=>{
|
|
|
115
114
|
*/ const mergeUniqueKeyShares = (existingKeyShares, newKeyShares)=>{
|
|
116
115
|
const uniqueKeyShares = newKeyShares.filter((newShare)=>!existingKeyShares.some((existingShare)=>{
|
|
117
116
|
if (!(newShare == null ? void 0 : newShare.pubkey) || !(existingShare == null ? void 0 : existingShare.pubkey)) return false;
|
|
118
|
-
return newShare.pubkey
|
|
117
|
+
return String(newShare.pubkey) === String(existingShare.pubkey) && newShare.secretShare === existingShare.secretShare;
|
|
119
118
|
}));
|
|
120
119
|
return [
|
|
121
120
|
...existingKeyShares,
|
|
@@ -157,25 +156,21 @@ const formatEvmMessage = (message)=>{
|
|
|
157
156
|
};
|
|
158
157
|
const formatSolanaMessage = (message)=>{
|
|
159
158
|
if (typeof message === 'string') {
|
|
160
|
-
if (
|
|
161
|
-
return Buffer.from(message).toString('hex');
|
|
162
|
-
} else {
|
|
159
|
+
if (isHexString(message)) {
|
|
163
160
|
return new Uint8Array(Buffer.from(message, 'hex'));
|
|
164
161
|
}
|
|
165
|
-
|
|
166
|
-
return message;
|
|
162
|
+
return Buffer.from(message).toString('hex');
|
|
167
163
|
}
|
|
164
|
+
return message;
|
|
168
165
|
};
|
|
169
166
|
const formatTonMessage = (message)=>{
|
|
170
167
|
if (typeof message === 'string') {
|
|
171
|
-
if (
|
|
172
|
-
return Buffer.from(message).toString('hex');
|
|
173
|
-
} else {
|
|
168
|
+
if (isHexString(message)) {
|
|
174
169
|
return new Uint8Array(Buffer.from(message, 'hex'));
|
|
175
170
|
}
|
|
176
|
-
|
|
177
|
-
return message;
|
|
171
|
+
return Buffer.from(message).toString('hex');
|
|
178
172
|
}
|
|
173
|
+
return message;
|
|
179
174
|
};
|
|
180
175
|
const formatMessage = (chainName, message)=>{
|
|
181
176
|
switch(chainName){
|
|
@@ -2011,7 +2006,7 @@ function decryptAesGcm(key, ivB64, ctB64, tagB64) {
|
|
|
2011
2006
|
const iv = Buffer.from(ivB64, 'base64url');
|
|
2012
2007
|
const ciphertext = Buffer.from(ctB64, 'base64url');
|
|
2013
2008
|
const tag = Buffer.from(tagB64, 'base64url');
|
|
2014
|
-
const decipher = crypto
|
|
2009
|
+
const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);
|
|
2015
2010
|
decipher.setAuthTag(tag);
|
|
2016
2011
|
const updateResult = decipher.update(ciphertext);
|
|
2017
2012
|
const finalResult = decipher.final();
|
|
@@ -2022,10 +2017,10 @@ function decryptAesGcm(key, ivB64, ctB64, tagB64) {
|
|
|
2022
2017
|
return plaintext;
|
|
2023
2018
|
}
|
|
2024
2019
|
function rsaOaepDecryptEk(privateKeyPem, ekB64) {
|
|
2025
|
-
return crypto
|
|
2020
|
+
return crypto.privateDecrypt({
|
|
2026
2021
|
key: privateKeyPem,
|
|
2027
2022
|
oaepHash: 'sha256',
|
|
2028
|
-
padding: crypto
|
|
2023
|
+
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING
|
|
2029
2024
|
}, Buffer.from(ekB64, 'base64url'));
|
|
2030
2025
|
}
|
|
2031
2026
|
function decryptDelegatedWebhookData({ privateKeyPem, encryptedDelegatedKeyShare, encryptedWalletApiKey }) {
|
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.58",
|
|
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.58",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.1",
|
|
9
|
-
"@dynamic-labs-wallet/primitives": "1.0.
|
|
9
|
+
"@dynamic-labs-wallet/primitives": "1.0.58",
|
|
10
10
|
"@dynamic-labs/logger": "^4.81.0",
|
|
11
11
|
"@dynamic-labs/sdk-api-core": "^0.0.984",
|
|
12
12
|
"uuid": "11.1.0",
|
package/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAI1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,cAAc,cACb,MAAM,mCACY;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,KAAG,IAClD,CAAC;AAErD,eAAO,MAAM,QAAQ,4CAKlB;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,KAAG,IAUH,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,UAAU,WAE5C,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,MAAM,eAExC,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,MAAM,eAE3C,CAAC;AAGF,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,MAEjD,CAAC;AAEF,eAAO,MAAM,cAAc,QAAS,MAAM,WAAgD,CAAC;AAE3F,eAAO,MAAM,WAAW,QAAS,MAAM,YAA+C,CAAC;AAEvF,eAAO,MAAM,mCAAmC,YAAa;IAC3D,gBAAgB,EAAE,oBAAoB,CAAC;CACxC,KAAG,kBA2CH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,sBACZ,cAAc,EAAE,gBACrB,cAAc,EAAE,KAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAA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