@dynamic-labs-wallet/node 0.0.122 → 0.0.123
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.js +84 -65
- package/index.esm.js +79 -62
- package/package.json +3 -2
- package/src/client.d.ts +19 -13
- package/src/client.d.ts.map +1 -1
- package/src/mpc/mpc.d.ts +4 -4
- package/src/mpc/mpc.d.ts.map +1 -1
- package/src/utils.d.ts +3 -0
- package/src/utils.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@dynamic-labs-wallet/core');
|
|
4
4
|
var node = require('./internal/node');
|
|
5
|
+
var uuid = require('uuid');
|
|
5
6
|
var logger$1 = require('@dynamic-labs/logger');
|
|
6
7
|
var crypto = require('crypto');
|
|
7
8
|
|
|
@@ -10,7 +11,7 @@ const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = core.MPC_RELAY
|
|
|
10
11
|
case core.SigningAlgorithm.ECDSA:
|
|
11
12
|
return new node.Ecdsa(baseRelayUrl);
|
|
12
13
|
case core.SigningAlgorithm.ED25519:
|
|
13
|
-
return new node.
|
|
14
|
+
return new node.ExportableEd25519(baseRelayUrl);
|
|
14
15
|
case core.SigningAlgorithm.BIP340:
|
|
15
16
|
return new node.BIP340(baseRelayUrl);
|
|
16
17
|
default:
|
|
@@ -125,6 +126,36 @@ const getExternalServerKeyShareBackupInfo = (params)=>{
|
|
|
125
126
|
// TypeScript needs this even though it's unreachable
|
|
126
127
|
throw new Error('Unreachable code');
|
|
127
128
|
}
|
|
129
|
+
const formatEvmMessage = (message)=>{
|
|
130
|
+
if (typeof message === 'string' && message.startsWith('0x')) {
|
|
131
|
+
const serializedTxBytes = Uint8Array.from(Buffer.from(message.slice(2), 'hex'));
|
|
132
|
+
return node.MessageHash.keccak256(serializedTxBytes);
|
|
133
|
+
}
|
|
134
|
+
return node.MessageHash.keccak256(message);
|
|
135
|
+
};
|
|
136
|
+
const formatSolanaMessage = (message)=>{
|
|
137
|
+
if (typeof message === 'string') {
|
|
138
|
+
if (!isHexString(message)) {
|
|
139
|
+
return Buffer.from(message).toString('hex');
|
|
140
|
+
} else {
|
|
141
|
+
return new Uint8Array(Buffer.from(message, 'hex'));
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
return message;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const formatMessage = (chainName, message)=>{
|
|
148
|
+
switch(chainName){
|
|
149
|
+
case 'EVM':
|
|
150
|
+
return formatEvmMessage(message);
|
|
151
|
+
case 'SVM':
|
|
152
|
+
return formatSolanaMessage(message);
|
|
153
|
+
case 'SUI':
|
|
154
|
+
return message;
|
|
155
|
+
default:
|
|
156
|
+
throw new Error('Unsupported chain name');
|
|
157
|
+
}
|
|
158
|
+
};
|
|
128
159
|
|
|
129
160
|
const PBKDF2_ALGORITHM = 'PBKDF2';
|
|
130
161
|
const PBKDF2_ITERATIONS = 100000;
|
|
@@ -227,13 +258,14 @@ class DynamicWalletClient {
|
|
|
227
258
|
});
|
|
228
259
|
this.isApiClientAuthenticated = true;
|
|
229
260
|
}
|
|
230
|
-
async dynamicServerInitializeKeyGen({ chainName, externalServerKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete }) {
|
|
261
|
+
async dynamicServerInitializeKeyGen({ chainName, externalServerKeygenIds, thresholdSignatureScheme, dynamicRequestId, onError, onCeremonyComplete }) {
|
|
231
262
|
this.ensureApiClientAuthenticated();
|
|
232
263
|
try {
|
|
233
264
|
const data = await this.apiClient.createWalletAccount({
|
|
234
265
|
chainName,
|
|
235
266
|
clientKeygenIds: externalServerKeygenIds,
|
|
236
267
|
thresholdSignatureScheme,
|
|
268
|
+
dynamicRequestId,
|
|
237
269
|
onError,
|
|
238
270
|
onCeremonyComplete
|
|
239
271
|
});
|
|
@@ -267,8 +299,8 @@ class DynamicWalletClient {
|
|
|
267
299
|
let publicKey;
|
|
268
300
|
if (mpcSigner instanceof node.Ecdsa) {
|
|
269
301
|
publicKey = await mpcSigner.derivePubkey(keyShare, derivationPath);
|
|
270
|
-
} else if (mpcSigner instanceof node.
|
|
271
|
-
publicKey = await mpcSigner.
|
|
302
|
+
} else if (mpcSigner instanceof node.ExportableEd25519) {
|
|
303
|
+
publicKey = await mpcSigner.getPubkey(keyShare);
|
|
272
304
|
}
|
|
273
305
|
return publicKey;
|
|
274
306
|
} catch (error) {
|
|
@@ -294,7 +326,13 @@ class DynamicWalletClient {
|
|
|
294
326
|
...dynamicServerKeygenIds,
|
|
295
327
|
...otherExternalServerKeygenIds
|
|
296
328
|
];
|
|
297
|
-
|
|
329
|
+
if (!(mpcSigner instanceof node.ExportableEd25519)) {
|
|
330
|
+
return mpcSigner.keygen(roomId, mpcConfig.numberOfParties, mpcConfig.threshold, currentInit, allOtherKeygenIds);
|
|
331
|
+
} else {
|
|
332
|
+
// One party joins the keygen room using acting as the sampler: (wallet-service)
|
|
333
|
+
// The remaining parties join the key sampling ceremony using: (browser)
|
|
334
|
+
return mpcSigner.receiveKey(roomId, mpcConfig.numberOfParties, mpcConfig.threshold, currentInit, allOtherKeygenIds);
|
|
335
|
+
}
|
|
298
336
|
}));
|
|
299
337
|
// only need one client keygen result to derive the public key
|
|
300
338
|
const [serverKeygenResult] = serverKeygenResults;
|
|
@@ -315,6 +353,7 @@ class DynamicWalletClient {
|
|
|
315
353
|
}
|
|
316
354
|
}
|
|
317
355
|
async keyGen({ chainName, thresholdSignatureScheme, onError, onCeremonyComplete }) {
|
|
356
|
+
const dynamicRequestId = uuid.v4();
|
|
318
357
|
try {
|
|
319
358
|
const externalServerInitKeygenResults = await this.externalServerInitializeKeyGen({
|
|
320
359
|
chainName,
|
|
@@ -324,6 +363,7 @@ class DynamicWalletClient {
|
|
|
324
363
|
const { roomId, serverKeygenIds: dynamicServerKeygenIds } = await this.dynamicServerInitializeKeyGen({
|
|
325
364
|
chainName,
|
|
326
365
|
externalServerKeygenIds,
|
|
366
|
+
dynamicRequestId,
|
|
327
367
|
thresholdSignatureScheme,
|
|
328
368
|
onCeremonyComplete
|
|
329
369
|
});
|
|
@@ -345,6 +385,7 @@ class DynamicWalletClient {
|
|
|
345
385
|
}
|
|
346
386
|
async importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError, onCeremonyComplete }) {
|
|
347
387
|
this.ensureApiClientAuthenticated();
|
|
388
|
+
const dynamicRequestId = uuid.v4();
|
|
348
389
|
const mpcSigner = getMPCSigner({
|
|
349
390
|
chainName,
|
|
350
391
|
baseRelayUrl: this.baseMPCRelayApiUrl
|
|
@@ -358,6 +399,7 @@ class DynamicWalletClient {
|
|
|
358
399
|
chainName,
|
|
359
400
|
clientKeygenIds: externalServerKeygenIds,
|
|
360
401
|
thresholdSignatureScheme,
|
|
402
|
+
dynamicRequestId,
|
|
361
403
|
onError,
|
|
362
404
|
onCeremonyComplete
|
|
363
405
|
});
|
|
@@ -390,7 +432,8 @@ class DynamicWalletClient {
|
|
|
390
432
|
externalServerKeyShares: externalServerKeygenResults
|
|
391
433
|
};
|
|
392
434
|
}
|
|
393
|
-
async dynamicServerSign({ walletId, message }) {
|
|
435
|
+
async dynamicServerSign({ walletId, message, isFormatted }) {
|
|
436
|
+
const dynamicRequestId = uuid.v4();
|
|
394
437
|
this.ensureApiClientAuthenticated();
|
|
395
438
|
// Create the room and sign the message
|
|
396
439
|
if (typeof message !== 'string') {
|
|
@@ -398,35 +441,19 @@ class DynamicWalletClient {
|
|
|
398
441
|
}
|
|
399
442
|
const data = await this.apiClient.signMessage({
|
|
400
443
|
walletId,
|
|
401
|
-
message
|
|
444
|
+
message,
|
|
445
|
+
isFormatted,
|
|
446
|
+
dynamicRequestId
|
|
402
447
|
});
|
|
403
448
|
return data;
|
|
404
449
|
}
|
|
405
|
-
async externalServerSign({ chainName, message, roomId, keyShare, derivationPath }) {
|
|
450
|
+
async externalServerSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted }) {
|
|
406
451
|
try {
|
|
407
452
|
const mpcSigner = getMPCSigner({
|
|
408
453
|
chainName,
|
|
409
454
|
baseRelayUrl: this.baseMPCRelayApiUrl
|
|
410
455
|
});
|
|
411
|
-
|
|
412
|
-
//note: Ecdsa can also be used by bitcoin, but only keccak256 is used by ethereum
|
|
413
|
-
if (mpcSigner instanceof node.Ecdsa) {
|
|
414
|
-
formattedMessage = node.MessageHash.keccak256(message);
|
|
415
|
-
} else if (mpcSigner instanceof node.Ed25519) {
|
|
416
|
-
if (typeof message === 'string') {
|
|
417
|
-
if (!isHexString(message)) {
|
|
418
|
-
formattedMessage = Buffer.from(message).toString('hex');
|
|
419
|
-
} else {
|
|
420
|
-
formattedMessage = Buffer.from(message, 'hex');
|
|
421
|
-
}
|
|
422
|
-
} else {
|
|
423
|
-
formattedMessage = message;
|
|
424
|
-
}
|
|
425
|
-
} else if (mpcSigner instanceof node.BIP340 && typeof message === 'string') {
|
|
426
|
-
formattedMessage = new TextEncoder().encode(message);
|
|
427
|
-
} else {
|
|
428
|
-
throw new Error('Unsupported signer type');
|
|
429
|
-
}
|
|
456
|
+
const formattedMessage = isFormatted ? new node.MessageHash(message) : formatMessage(chainName, message);
|
|
430
457
|
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
431
458
|
return signature;
|
|
432
459
|
} catch (error) {
|
|
@@ -435,7 +462,7 @@ class DynamicWalletClient {
|
|
|
435
462
|
}
|
|
436
463
|
}
|
|
437
464
|
//todo: need to modify with imported flag
|
|
438
|
-
async sign({ accountAddress, message, chainName, password = undefined, signedSessionId }) {
|
|
465
|
+
async sign({ accountAddress, externalServerKeyShares, message, chainName, password = undefined, isFormatted = false, signedSessionId }) {
|
|
439
466
|
await this.verifyPassword({
|
|
440
467
|
accountAddress,
|
|
441
468
|
password,
|
|
@@ -451,7 +478,8 @@ class DynamicWalletClient {
|
|
|
451
478
|
// Perform the dynamic server sign
|
|
452
479
|
const data = await this.dynamicServerSign({
|
|
453
480
|
walletId: wallet.walletId,
|
|
454
|
-
message
|
|
481
|
+
message,
|
|
482
|
+
isFormatted
|
|
455
483
|
});
|
|
456
484
|
const derivationPath = wallet.derivationPath && wallet.derivationPath != '' ? new Uint32Array(Object.values(JSON.parse(wallet.derivationPath))) : undefined;
|
|
457
485
|
// Perform the external server sign and return the signature
|
|
@@ -459,8 +487,9 @@ class DynamicWalletClient {
|
|
|
459
487
|
chainName,
|
|
460
488
|
message,
|
|
461
489
|
roomId: data.roomId,
|
|
462
|
-
keyShare:
|
|
463
|
-
derivationPath
|
|
490
|
+
keyShare: externalServerKeyShares[0],
|
|
491
|
+
derivationPath,
|
|
492
|
+
isFormatted
|
|
464
493
|
});
|
|
465
494
|
return signature;
|
|
466
495
|
}
|
|
@@ -612,7 +641,7 @@ class DynamicWalletClient {
|
|
|
612
641
|
});
|
|
613
642
|
return reshareResults;
|
|
614
643
|
}
|
|
615
|
-
async exportKey({ accountAddress, chainName, password = undefined, signedSessionId }) {
|
|
644
|
+
async exportKey({ accountAddress, chainName, password = undefined, signedSessionId, externalServerKeyShares }) {
|
|
616
645
|
this.ensureApiClientAuthenticated();
|
|
617
646
|
await this.verifyPassword({
|
|
618
647
|
accountAddress,
|
|
@@ -632,13 +661,13 @@ class DynamicWalletClient {
|
|
|
632
661
|
});
|
|
633
662
|
const exportId = await this.getExportId({
|
|
634
663
|
chainName,
|
|
635
|
-
serverKeyShare:
|
|
664
|
+
serverKeyShare: externalServerKeyShares[0]
|
|
636
665
|
});
|
|
637
666
|
const data = await this.apiClient.exportKey({
|
|
638
667
|
walletId: wallet.walletId,
|
|
639
668
|
exportId
|
|
640
669
|
});
|
|
641
|
-
const keyExportRaw = await mpcSigner.exportFullPrivateKey(data.roomId,
|
|
670
|
+
const keyExportRaw = await mpcSigner.exportFullPrivateKey(data.roomId, externalServerKeyShares[0], exportId);
|
|
642
671
|
if (!keyExportRaw) {
|
|
643
672
|
throw new Error('Error exporting private key');
|
|
644
673
|
}
|
|
@@ -646,7 +675,7 @@ class DynamicWalletClient {
|
|
|
646
675
|
let derivedPrivateKey;
|
|
647
676
|
if (mpcSigner instanceof node.Ecdsa) {
|
|
648
677
|
derivedPrivateKey = await mpcSigner.derivePrivateKeyFromXpriv(keyExportRaw, derivationPath);
|
|
649
|
-
} else if (mpcSigner instanceof node.
|
|
678
|
+
} else if (mpcSigner instanceof node.ExportableEd25519) {
|
|
650
679
|
derivedPrivateKey = keyExportRaw;
|
|
651
680
|
} else if (mpcSigner instanceof node.BIP340) {
|
|
652
681
|
derivedPrivateKey = await mpcSigner.derivePrivateKeyFromXpriv(keyExportRaw, derivationPath);
|
|
@@ -665,7 +694,7 @@ class DynamicWalletClient {
|
|
|
665
694
|
baseRelayUrl: this.baseMPCRelayApiUrl
|
|
666
695
|
});
|
|
667
696
|
const walletKeyShares = keyShares.map((keyShare)=>{
|
|
668
|
-
return mpcSigner instanceof node.Ecdsa ? new node.EcdsaKeygenResult(keyShare.pubkey, keyShare.secretShare) : mpcSigner instanceof node.
|
|
697
|
+
return mpcSigner instanceof node.Ecdsa ? new node.EcdsaKeygenResult(keyShare.pubkey, keyShare.secretShare) : mpcSigner instanceof node.ExportableEd25519 ? new node.ExportableEd25519KeygenResult(keyShare.pubkey, keyShare.secretShare) : new node.BIP340KeygenResult(keyShare.pubkey, keyShare.secretShare);
|
|
669
698
|
});
|
|
670
699
|
const keyExportRaw = await mpcSigner.offlineExportFullPrivateKey(walletKeyShares);
|
|
671
700
|
if (!keyExportRaw) {
|
|
@@ -676,7 +705,7 @@ class DynamicWalletClient {
|
|
|
676
705
|
let derivedPrivateKey;
|
|
677
706
|
if (mpcSigner instanceof node.Ecdsa) {
|
|
678
707
|
derivedPrivateKey = await mpcSigner.derivePrivateKeyFromXpriv(keyExportRaw, walletDerivationPath);
|
|
679
|
-
} else if (mpcSigner instanceof node.
|
|
708
|
+
} else if (mpcSigner instanceof node.ExportableEd25519) {
|
|
680
709
|
derivedPrivateKey = keyExportRaw;
|
|
681
710
|
} else if (mpcSigner instanceof node.BIP340) {
|
|
682
711
|
derivedPrivateKey = await mpcSigner.derivePrivateKeyFromXpriv(keyExportRaw, walletDerivationPath);
|
|
@@ -731,23 +760,25 @@ class DynamicWalletClient {
|
|
|
731
760
|
if (!this.walletMap[accountAddress] || !this.walletMap[accountAddress].walletId) {
|
|
732
761
|
throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
|
|
733
762
|
}
|
|
734
|
-
|
|
735
|
-
const data = await this.apiClient.storeEncryptedBackupByWallet({
|
|
763
|
+
await this.apiClient.markKeySharesAsBackedUp({
|
|
736
764
|
walletId: this.walletMap[accountAddress].walletId,
|
|
737
|
-
|
|
738
|
-
passwordEncrypted: Boolean(password) && password !== this.environmentId,
|
|
739
|
-
signedSessionId
|
|
765
|
+
location: core.BackupLocation.EXTERNAL
|
|
740
766
|
});
|
|
741
767
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
|
|
742
768
|
externalServerKeySharesBackupInfo: getExternalServerKeyShareBackupInfo({
|
|
743
769
|
walletProperties: {
|
|
744
770
|
derivationPath: this.walletMap[accountAddress].derivationPath,
|
|
745
|
-
keyShares:
|
|
771
|
+
keyShares: encryptedKeyShares.map((encryptedKeyShare)=>({
|
|
772
|
+
id: uuid.v4(),
|
|
773
|
+
encryptedKeyShare,
|
|
774
|
+
backupLocation: core.BackupLocation.EXTERNAL,
|
|
775
|
+
passwordEncrypted: Boolean(password) && password !== this.environmentId
|
|
776
|
+
})),
|
|
746
777
|
thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme
|
|
747
778
|
}
|
|
748
779
|
})
|
|
749
780
|
});
|
|
750
|
-
return
|
|
781
|
+
return encryptedKeyShares;
|
|
751
782
|
} catch (error) {
|
|
752
783
|
this.logger.error('Error in storeEncryptedBackupByWallet:', error);
|
|
753
784
|
throw error;
|
|
@@ -1008,7 +1039,7 @@ class DynamicWalletClient {
|
|
|
1008
1039
|
walletProperties: wallet == null ? void 0 : wallet.walletProperties
|
|
1009
1040
|
});
|
|
1010
1041
|
}
|
|
1011
|
-
async getWallet({ accountAddress, walletOperation = core.WalletOperation.NO_OPERATION,
|
|
1042
|
+
async getWallet({ accountAddress, walletOperation = core.WalletOperation.NO_OPERATION, shareCount = undefined }) {
|
|
1012
1043
|
var _user_verifiedCredentials;
|
|
1013
1044
|
this.ensureApiClientAuthenticated();
|
|
1014
1045
|
const existingWalletCheck = await this.checkWalletFields({
|
|
@@ -1036,20 +1067,6 @@ class DynamicWalletClient {
|
|
|
1036
1067
|
walletProperties
|
|
1037
1068
|
})
|
|
1038
1069
|
});
|
|
1039
|
-
if (walletOperation !== core.WalletOperation.NO_OPERATION && await this.requiresRestoreBackupSharesForOperation({
|
|
1040
|
-
accountAddress,
|
|
1041
|
-
walletOperation
|
|
1042
|
-
})) {
|
|
1043
|
-
// TODO(zfaizal2): throw error if signedSessionId is not provided after service deploy
|
|
1044
|
-
const decryptedKeyShares = await this.recoverEncryptedBackupByWallet({
|
|
1045
|
-
accountAddress,
|
|
1046
|
-
password: password != null ? password : this.environmentId,
|
|
1047
|
-
walletOperation: walletOperation,
|
|
1048
|
-
signedSessionId,
|
|
1049
|
-
shareCount
|
|
1050
|
-
});
|
|
1051
|
-
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1052
|
-
}
|
|
1053
1070
|
const walletCount = Object.keys(this.walletMap).length;
|
|
1054
1071
|
if (walletCount === 0) {
|
|
1055
1072
|
throw new Error('No wallets found');
|
|
@@ -1141,17 +1158,17 @@ Object.defineProperty(exports, "EcdsaSignature", {
|
|
|
1141
1158
|
enumerable: true,
|
|
1142
1159
|
get: function () { return node.EcdsaSignature; }
|
|
1143
1160
|
});
|
|
1144
|
-
Object.defineProperty(exports, "
|
|
1161
|
+
Object.defineProperty(exports, "ExportableEd25519", {
|
|
1145
1162
|
enumerable: true,
|
|
1146
|
-
get: function () { return node.
|
|
1163
|
+
get: function () { return node.ExportableEd25519; }
|
|
1147
1164
|
});
|
|
1148
|
-
Object.defineProperty(exports, "
|
|
1165
|
+
Object.defineProperty(exports, "ExportableEd25519InitKeygenResult", {
|
|
1149
1166
|
enumerable: true,
|
|
1150
|
-
get: function () { return node.
|
|
1167
|
+
get: function () { return node.ExportableEd25519InitKeygenResult; }
|
|
1151
1168
|
});
|
|
1152
|
-
Object.defineProperty(exports, "
|
|
1169
|
+
Object.defineProperty(exports, "ExportableEd25519KeygenResult", {
|
|
1153
1170
|
enumerable: true,
|
|
1154
|
-
get: function () { return node.
|
|
1171
|
+
get: function () { return node.ExportableEd25519KeygenResult; }
|
|
1155
1172
|
});
|
|
1156
1173
|
Object.defineProperty(exports, "MessageHash", {
|
|
1157
1174
|
enumerable: true,
|
|
@@ -1161,6 +1178,8 @@ exports.DynamicWalletClient = DynamicWalletClient;
|
|
|
1161
1178
|
exports.base64ToBytes = base64ToBytes;
|
|
1162
1179
|
exports.bytesToBase64 = bytesToBase64;
|
|
1163
1180
|
exports.ensureBase64Padding = ensureBase64Padding;
|
|
1181
|
+
exports.formatEvmMessage = formatEvmMessage;
|
|
1182
|
+
exports.formatMessage = formatMessage;
|
|
1164
1183
|
exports.getExternalServerKeyShareBackupInfo = getExternalServerKeyShareBackupInfo;
|
|
1165
1184
|
exports.getMPCSignatureScheme = getMPCSignatureScheme;
|
|
1166
1185
|
exports.getMPCSigner = getMPCSigner;
|
package/index.esm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, BackupLocation, DynamicApiClient, getClientThreshold, MPC_CONFIG, getTSSConfig, WalletOperation, getServerWalletReshareConfig } from '@dynamic-labs-wallet/core';
|
|
2
2
|
export * from '@dynamic-labs-wallet/core';
|
|
3
|
-
import { BIP340,
|
|
4
|
-
export { BIP340, BIP340InitKeygenResult, BIP340KeygenResult, Ecdsa, EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature,
|
|
3
|
+
import { BIP340, ExportableEd25519, Ecdsa, MessageHash, EcdsaKeygenResult, ExportableEd25519KeygenResult, BIP340KeygenResult } from './internal/node';
|
|
4
|
+
export { BIP340, BIP340InitKeygenResult, BIP340KeygenResult, Ecdsa, EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, ExportableEd25519, ExportableEd25519InitKeygenResult, ExportableEd25519KeygenResult, MessageHash } from './internal/node';
|
|
5
|
+
import { v4 } from 'uuid';
|
|
5
6
|
import { Logger } from '@dynamic-labs/logger';
|
|
6
7
|
import crypto from 'crypto';
|
|
7
8
|
|
|
@@ -10,7 +11,7 @@ const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = MPC_RELAY_PROD
|
|
|
10
11
|
case SigningAlgorithm.ECDSA:
|
|
11
12
|
return new Ecdsa(baseRelayUrl);
|
|
12
13
|
case SigningAlgorithm.ED25519:
|
|
13
|
-
return new
|
|
14
|
+
return new ExportableEd25519(baseRelayUrl);
|
|
14
15
|
case SigningAlgorithm.BIP340:
|
|
15
16
|
return new BIP340(baseRelayUrl);
|
|
16
17
|
default:
|
|
@@ -125,6 +126,36 @@ const getExternalServerKeyShareBackupInfo = (params)=>{
|
|
|
125
126
|
// TypeScript needs this even though it's unreachable
|
|
126
127
|
throw new Error('Unreachable code');
|
|
127
128
|
}
|
|
129
|
+
const formatEvmMessage = (message)=>{
|
|
130
|
+
if (typeof message === 'string' && message.startsWith('0x')) {
|
|
131
|
+
const serializedTxBytes = Uint8Array.from(Buffer.from(message.slice(2), 'hex'));
|
|
132
|
+
return MessageHash.keccak256(serializedTxBytes);
|
|
133
|
+
}
|
|
134
|
+
return MessageHash.keccak256(message);
|
|
135
|
+
};
|
|
136
|
+
const formatSolanaMessage = (message)=>{
|
|
137
|
+
if (typeof message === 'string') {
|
|
138
|
+
if (!isHexString(message)) {
|
|
139
|
+
return Buffer.from(message).toString('hex');
|
|
140
|
+
} else {
|
|
141
|
+
return new Uint8Array(Buffer.from(message, 'hex'));
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
return message;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const formatMessage = (chainName, message)=>{
|
|
148
|
+
switch(chainName){
|
|
149
|
+
case 'EVM':
|
|
150
|
+
return formatEvmMessage(message);
|
|
151
|
+
case 'SVM':
|
|
152
|
+
return formatSolanaMessage(message);
|
|
153
|
+
case 'SUI':
|
|
154
|
+
return message;
|
|
155
|
+
default:
|
|
156
|
+
throw new Error('Unsupported chain name');
|
|
157
|
+
}
|
|
158
|
+
};
|
|
128
159
|
|
|
129
160
|
const PBKDF2_ALGORITHM = 'PBKDF2';
|
|
130
161
|
const PBKDF2_ITERATIONS = 100000;
|
|
@@ -227,13 +258,14 @@ class DynamicWalletClient {
|
|
|
227
258
|
});
|
|
228
259
|
this.isApiClientAuthenticated = true;
|
|
229
260
|
}
|
|
230
|
-
async dynamicServerInitializeKeyGen({ chainName, externalServerKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete }) {
|
|
261
|
+
async dynamicServerInitializeKeyGen({ chainName, externalServerKeygenIds, thresholdSignatureScheme, dynamicRequestId, onError, onCeremonyComplete }) {
|
|
231
262
|
this.ensureApiClientAuthenticated();
|
|
232
263
|
try {
|
|
233
264
|
const data = await this.apiClient.createWalletAccount({
|
|
234
265
|
chainName,
|
|
235
266
|
clientKeygenIds: externalServerKeygenIds,
|
|
236
267
|
thresholdSignatureScheme,
|
|
268
|
+
dynamicRequestId,
|
|
237
269
|
onError,
|
|
238
270
|
onCeremonyComplete
|
|
239
271
|
});
|
|
@@ -267,8 +299,8 @@ class DynamicWalletClient {
|
|
|
267
299
|
let publicKey;
|
|
268
300
|
if (mpcSigner instanceof Ecdsa) {
|
|
269
301
|
publicKey = await mpcSigner.derivePubkey(keyShare, derivationPath);
|
|
270
|
-
} else if (mpcSigner instanceof
|
|
271
|
-
publicKey = await mpcSigner.
|
|
302
|
+
} else if (mpcSigner instanceof ExportableEd25519) {
|
|
303
|
+
publicKey = await mpcSigner.getPubkey(keyShare);
|
|
272
304
|
}
|
|
273
305
|
return publicKey;
|
|
274
306
|
} catch (error) {
|
|
@@ -294,7 +326,13 @@ class DynamicWalletClient {
|
|
|
294
326
|
...dynamicServerKeygenIds,
|
|
295
327
|
...otherExternalServerKeygenIds
|
|
296
328
|
];
|
|
297
|
-
|
|
329
|
+
if (!(mpcSigner instanceof ExportableEd25519)) {
|
|
330
|
+
return mpcSigner.keygen(roomId, mpcConfig.numberOfParties, mpcConfig.threshold, currentInit, allOtherKeygenIds);
|
|
331
|
+
} else {
|
|
332
|
+
// One party joins the keygen room using acting as the sampler: (wallet-service)
|
|
333
|
+
// The remaining parties join the key sampling ceremony using: (browser)
|
|
334
|
+
return mpcSigner.receiveKey(roomId, mpcConfig.numberOfParties, mpcConfig.threshold, currentInit, allOtherKeygenIds);
|
|
335
|
+
}
|
|
298
336
|
}));
|
|
299
337
|
// only need one client keygen result to derive the public key
|
|
300
338
|
const [serverKeygenResult] = serverKeygenResults;
|
|
@@ -315,6 +353,7 @@ class DynamicWalletClient {
|
|
|
315
353
|
}
|
|
316
354
|
}
|
|
317
355
|
async keyGen({ chainName, thresholdSignatureScheme, onError, onCeremonyComplete }) {
|
|
356
|
+
const dynamicRequestId = v4();
|
|
318
357
|
try {
|
|
319
358
|
const externalServerInitKeygenResults = await this.externalServerInitializeKeyGen({
|
|
320
359
|
chainName,
|
|
@@ -324,6 +363,7 @@ class DynamicWalletClient {
|
|
|
324
363
|
const { roomId, serverKeygenIds: dynamicServerKeygenIds } = await this.dynamicServerInitializeKeyGen({
|
|
325
364
|
chainName,
|
|
326
365
|
externalServerKeygenIds,
|
|
366
|
+
dynamicRequestId,
|
|
327
367
|
thresholdSignatureScheme,
|
|
328
368
|
onCeremonyComplete
|
|
329
369
|
});
|
|
@@ -345,6 +385,7 @@ class DynamicWalletClient {
|
|
|
345
385
|
}
|
|
346
386
|
async importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError, onCeremonyComplete }) {
|
|
347
387
|
this.ensureApiClientAuthenticated();
|
|
388
|
+
const dynamicRequestId = v4();
|
|
348
389
|
const mpcSigner = getMPCSigner({
|
|
349
390
|
chainName,
|
|
350
391
|
baseRelayUrl: this.baseMPCRelayApiUrl
|
|
@@ -358,6 +399,7 @@ class DynamicWalletClient {
|
|
|
358
399
|
chainName,
|
|
359
400
|
clientKeygenIds: externalServerKeygenIds,
|
|
360
401
|
thresholdSignatureScheme,
|
|
402
|
+
dynamicRequestId,
|
|
361
403
|
onError,
|
|
362
404
|
onCeremonyComplete
|
|
363
405
|
});
|
|
@@ -390,7 +432,8 @@ class DynamicWalletClient {
|
|
|
390
432
|
externalServerKeyShares: externalServerKeygenResults
|
|
391
433
|
};
|
|
392
434
|
}
|
|
393
|
-
async dynamicServerSign({ walletId, message }) {
|
|
435
|
+
async dynamicServerSign({ walletId, message, isFormatted }) {
|
|
436
|
+
const dynamicRequestId = v4();
|
|
394
437
|
this.ensureApiClientAuthenticated();
|
|
395
438
|
// Create the room and sign the message
|
|
396
439
|
if (typeof message !== 'string') {
|
|
@@ -398,35 +441,19 @@ class DynamicWalletClient {
|
|
|
398
441
|
}
|
|
399
442
|
const data = await this.apiClient.signMessage({
|
|
400
443
|
walletId,
|
|
401
|
-
message
|
|
444
|
+
message,
|
|
445
|
+
isFormatted,
|
|
446
|
+
dynamicRequestId
|
|
402
447
|
});
|
|
403
448
|
return data;
|
|
404
449
|
}
|
|
405
|
-
async externalServerSign({ chainName, message, roomId, keyShare, derivationPath }) {
|
|
450
|
+
async externalServerSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted }) {
|
|
406
451
|
try {
|
|
407
452
|
const mpcSigner = getMPCSigner({
|
|
408
453
|
chainName,
|
|
409
454
|
baseRelayUrl: this.baseMPCRelayApiUrl
|
|
410
455
|
});
|
|
411
|
-
|
|
412
|
-
//note: Ecdsa can also be used by bitcoin, but only keccak256 is used by ethereum
|
|
413
|
-
if (mpcSigner instanceof Ecdsa) {
|
|
414
|
-
formattedMessage = MessageHash.keccak256(message);
|
|
415
|
-
} else if (mpcSigner instanceof Ed25519) {
|
|
416
|
-
if (typeof message === 'string') {
|
|
417
|
-
if (!isHexString(message)) {
|
|
418
|
-
formattedMessage = Buffer.from(message).toString('hex');
|
|
419
|
-
} else {
|
|
420
|
-
formattedMessage = Buffer.from(message, 'hex');
|
|
421
|
-
}
|
|
422
|
-
} else {
|
|
423
|
-
formattedMessage = message;
|
|
424
|
-
}
|
|
425
|
-
} else if (mpcSigner instanceof BIP340 && typeof message === 'string') {
|
|
426
|
-
formattedMessage = new TextEncoder().encode(message);
|
|
427
|
-
} else {
|
|
428
|
-
throw new Error('Unsupported signer type');
|
|
429
|
-
}
|
|
456
|
+
const formattedMessage = isFormatted ? new MessageHash(message) : formatMessage(chainName, message);
|
|
430
457
|
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
431
458
|
return signature;
|
|
432
459
|
} catch (error) {
|
|
@@ -435,7 +462,7 @@ class DynamicWalletClient {
|
|
|
435
462
|
}
|
|
436
463
|
}
|
|
437
464
|
//todo: need to modify with imported flag
|
|
438
|
-
async sign({ accountAddress, message, chainName, password = undefined, signedSessionId }) {
|
|
465
|
+
async sign({ accountAddress, externalServerKeyShares, message, chainName, password = undefined, isFormatted = false, signedSessionId }) {
|
|
439
466
|
await this.verifyPassword({
|
|
440
467
|
accountAddress,
|
|
441
468
|
password,
|
|
@@ -451,7 +478,8 @@ class DynamicWalletClient {
|
|
|
451
478
|
// Perform the dynamic server sign
|
|
452
479
|
const data = await this.dynamicServerSign({
|
|
453
480
|
walletId: wallet.walletId,
|
|
454
|
-
message
|
|
481
|
+
message,
|
|
482
|
+
isFormatted
|
|
455
483
|
});
|
|
456
484
|
const derivationPath = wallet.derivationPath && wallet.derivationPath != '' ? new Uint32Array(Object.values(JSON.parse(wallet.derivationPath))) : undefined;
|
|
457
485
|
// Perform the external server sign and return the signature
|
|
@@ -459,8 +487,9 @@ class DynamicWalletClient {
|
|
|
459
487
|
chainName,
|
|
460
488
|
message,
|
|
461
489
|
roomId: data.roomId,
|
|
462
|
-
keyShare:
|
|
463
|
-
derivationPath
|
|
490
|
+
keyShare: externalServerKeyShares[0],
|
|
491
|
+
derivationPath,
|
|
492
|
+
isFormatted
|
|
464
493
|
});
|
|
465
494
|
return signature;
|
|
466
495
|
}
|
|
@@ -612,7 +641,7 @@ class DynamicWalletClient {
|
|
|
612
641
|
});
|
|
613
642
|
return reshareResults;
|
|
614
643
|
}
|
|
615
|
-
async exportKey({ accountAddress, chainName, password = undefined, signedSessionId }) {
|
|
644
|
+
async exportKey({ accountAddress, chainName, password = undefined, signedSessionId, externalServerKeyShares }) {
|
|
616
645
|
this.ensureApiClientAuthenticated();
|
|
617
646
|
await this.verifyPassword({
|
|
618
647
|
accountAddress,
|
|
@@ -632,13 +661,13 @@ class DynamicWalletClient {
|
|
|
632
661
|
});
|
|
633
662
|
const exportId = await this.getExportId({
|
|
634
663
|
chainName,
|
|
635
|
-
serverKeyShare:
|
|
664
|
+
serverKeyShare: externalServerKeyShares[0]
|
|
636
665
|
});
|
|
637
666
|
const data = await this.apiClient.exportKey({
|
|
638
667
|
walletId: wallet.walletId,
|
|
639
668
|
exportId
|
|
640
669
|
});
|
|
641
|
-
const keyExportRaw = await mpcSigner.exportFullPrivateKey(data.roomId,
|
|
670
|
+
const keyExportRaw = await mpcSigner.exportFullPrivateKey(data.roomId, externalServerKeyShares[0], exportId);
|
|
642
671
|
if (!keyExportRaw) {
|
|
643
672
|
throw new Error('Error exporting private key');
|
|
644
673
|
}
|
|
@@ -646,7 +675,7 @@ class DynamicWalletClient {
|
|
|
646
675
|
let derivedPrivateKey;
|
|
647
676
|
if (mpcSigner instanceof Ecdsa) {
|
|
648
677
|
derivedPrivateKey = await mpcSigner.derivePrivateKeyFromXpriv(keyExportRaw, derivationPath);
|
|
649
|
-
} else if (mpcSigner instanceof
|
|
678
|
+
} else if (mpcSigner instanceof ExportableEd25519) {
|
|
650
679
|
derivedPrivateKey = keyExportRaw;
|
|
651
680
|
} else if (mpcSigner instanceof BIP340) {
|
|
652
681
|
derivedPrivateKey = await mpcSigner.derivePrivateKeyFromXpriv(keyExportRaw, derivationPath);
|
|
@@ -665,7 +694,7 @@ class DynamicWalletClient {
|
|
|
665
694
|
baseRelayUrl: this.baseMPCRelayApiUrl
|
|
666
695
|
});
|
|
667
696
|
const walletKeyShares = keyShares.map((keyShare)=>{
|
|
668
|
-
return mpcSigner instanceof Ecdsa ? new EcdsaKeygenResult(keyShare.pubkey, keyShare.secretShare) : mpcSigner instanceof
|
|
697
|
+
return mpcSigner instanceof Ecdsa ? new EcdsaKeygenResult(keyShare.pubkey, keyShare.secretShare) : mpcSigner instanceof ExportableEd25519 ? new ExportableEd25519KeygenResult(keyShare.pubkey, keyShare.secretShare) : new BIP340KeygenResult(keyShare.pubkey, keyShare.secretShare);
|
|
669
698
|
});
|
|
670
699
|
const keyExportRaw = await mpcSigner.offlineExportFullPrivateKey(walletKeyShares);
|
|
671
700
|
if (!keyExportRaw) {
|
|
@@ -676,7 +705,7 @@ class DynamicWalletClient {
|
|
|
676
705
|
let derivedPrivateKey;
|
|
677
706
|
if (mpcSigner instanceof Ecdsa) {
|
|
678
707
|
derivedPrivateKey = await mpcSigner.derivePrivateKeyFromXpriv(keyExportRaw, walletDerivationPath);
|
|
679
|
-
} else if (mpcSigner instanceof
|
|
708
|
+
} else if (mpcSigner instanceof ExportableEd25519) {
|
|
680
709
|
derivedPrivateKey = keyExportRaw;
|
|
681
710
|
} else if (mpcSigner instanceof BIP340) {
|
|
682
711
|
derivedPrivateKey = await mpcSigner.derivePrivateKeyFromXpriv(keyExportRaw, walletDerivationPath);
|
|
@@ -731,23 +760,25 @@ class DynamicWalletClient {
|
|
|
731
760
|
if (!this.walletMap[accountAddress] || !this.walletMap[accountAddress].walletId) {
|
|
732
761
|
throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
|
|
733
762
|
}
|
|
734
|
-
|
|
735
|
-
const data = await this.apiClient.storeEncryptedBackupByWallet({
|
|
763
|
+
await this.apiClient.markKeySharesAsBackedUp({
|
|
736
764
|
walletId: this.walletMap[accountAddress].walletId,
|
|
737
|
-
|
|
738
|
-
passwordEncrypted: Boolean(password) && password !== this.environmentId,
|
|
739
|
-
signedSessionId
|
|
765
|
+
location: BackupLocation.EXTERNAL
|
|
740
766
|
});
|
|
741
767
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
|
|
742
768
|
externalServerKeySharesBackupInfo: getExternalServerKeyShareBackupInfo({
|
|
743
769
|
walletProperties: {
|
|
744
770
|
derivationPath: this.walletMap[accountAddress].derivationPath,
|
|
745
|
-
keyShares:
|
|
771
|
+
keyShares: encryptedKeyShares.map((encryptedKeyShare)=>({
|
|
772
|
+
id: v4(),
|
|
773
|
+
encryptedKeyShare,
|
|
774
|
+
backupLocation: BackupLocation.EXTERNAL,
|
|
775
|
+
passwordEncrypted: Boolean(password) && password !== this.environmentId
|
|
776
|
+
})),
|
|
746
777
|
thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme
|
|
747
778
|
}
|
|
748
779
|
})
|
|
749
780
|
});
|
|
750
|
-
return
|
|
781
|
+
return encryptedKeyShares;
|
|
751
782
|
} catch (error) {
|
|
752
783
|
this.logger.error('Error in storeEncryptedBackupByWallet:', error);
|
|
753
784
|
throw error;
|
|
@@ -1008,7 +1039,7 @@ class DynamicWalletClient {
|
|
|
1008
1039
|
walletProperties: wallet == null ? void 0 : wallet.walletProperties
|
|
1009
1040
|
});
|
|
1010
1041
|
}
|
|
1011
|
-
async getWallet({ accountAddress, walletOperation = WalletOperation.NO_OPERATION,
|
|
1042
|
+
async getWallet({ accountAddress, walletOperation = WalletOperation.NO_OPERATION, shareCount = undefined }) {
|
|
1012
1043
|
var _user_verifiedCredentials;
|
|
1013
1044
|
this.ensureApiClientAuthenticated();
|
|
1014
1045
|
const existingWalletCheck = await this.checkWalletFields({
|
|
@@ -1036,20 +1067,6 @@ class DynamicWalletClient {
|
|
|
1036
1067
|
walletProperties
|
|
1037
1068
|
})
|
|
1038
1069
|
});
|
|
1039
|
-
if (walletOperation !== WalletOperation.NO_OPERATION && await this.requiresRestoreBackupSharesForOperation({
|
|
1040
|
-
accountAddress,
|
|
1041
|
-
walletOperation
|
|
1042
|
-
})) {
|
|
1043
|
-
// TODO(zfaizal2): throw error if signedSessionId is not provided after service deploy
|
|
1044
|
-
const decryptedKeyShares = await this.recoverEncryptedBackupByWallet({
|
|
1045
|
-
accountAddress,
|
|
1046
|
-
password: password != null ? password : this.environmentId,
|
|
1047
|
-
walletOperation: walletOperation,
|
|
1048
|
-
signedSessionId,
|
|
1049
|
-
shareCount
|
|
1050
|
-
});
|
|
1051
|
-
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1052
|
-
}
|
|
1053
1070
|
const walletCount = Object.keys(this.walletMap).length;
|
|
1054
1071
|
if (walletCount === 0) {
|
|
1055
1072
|
throw new Error('No wallets found');
|
|
@@ -1109,4 +1126,4 @@ class DynamicWalletClient {
|
|
|
1109
1126
|
}
|
|
1110
1127
|
}
|
|
1111
1128
|
|
|
1112
|
-
export { DynamicWalletClient, base64ToBytes, bytesToBase64, ensureBase64Padding, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, mergeUniqueKeyShares, retryPromise, stringToBytes };
|
|
1129
|
+
export { DynamicWalletClient, base64ToBytes, bytesToBase64, ensureBase64Padding, formatEvmMessage, formatMessage, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, mergeUniqueKeyShares, retryPromise, stringToBytes };
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.123",
|
|
4
4
|
"license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/core": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/core": "0.0.123",
|
|
7
7
|
"@dynamic-labs/logger": "^4.5.1",
|
|
8
|
+
"uuid": "11.1.0",
|
|
8
9
|
"@noble/hashes": "1.7.1"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
package/src/client.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EcdsaKeygenResult, BIP340KeygenResult, EcdsaPublicKey, EcdsaSignature } from '../../internal/node';
|
|
1
|
+
import { EcdsaKeygenResult, BIP340KeygenResult, EcdsaPublicKey, EcdsaSignature, ExportableEd25519KeygenResult } from '../../internal/node';
|
|
2
2
|
import { ThresholdSignatureScheme, DynamicApiClient, WalletOperation, KeyShareBackupInfo, BackupLocation } from '@dynamic-labs-wallet/core';
|
|
3
3
|
import { ServerInitKeygenResult } from './mpc/types';
|
|
4
4
|
import { WalletProperties } from './types';
|
|
5
|
-
type ServerKeyShare = EcdsaKeygenResult | BIP340KeygenResult;
|
|
5
|
+
type ServerKeyShare = EcdsaKeygenResult | BIP340KeygenResult | ExportableEd25519KeygenResult;
|
|
6
6
|
export declare class DynamicWalletClient {
|
|
7
7
|
environmentId: string;
|
|
8
8
|
debug: boolean;
|
|
@@ -21,10 +21,11 @@ export declare class DynamicWalletClient {
|
|
|
21
21
|
});
|
|
22
22
|
private ensureApiClientAuthenticated;
|
|
23
23
|
authenticateApiToken(authToken: string): Promise<void>;
|
|
24
|
-
dynamicServerInitializeKeyGen({ chainName, externalServerKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
|
|
24
|
+
dynamicServerInitializeKeyGen({ chainName, externalServerKeygenIds, thresholdSignatureScheme, dynamicRequestId, onError, onCeremonyComplete, }: {
|
|
25
25
|
chainName: string;
|
|
26
26
|
externalServerKeygenIds: string[];
|
|
27
27
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
28
|
+
dynamicRequestId: string;
|
|
28
29
|
onError?: (error: Error) => void;
|
|
29
30
|
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
30
31
|
}): Promise<import("@dynamic-labs-wallet/core").KeygenCompleteResponse>;
|
|
@@ -36,7 +37,7 @@ export declare class DynamicWalletClient {
|
|
|
36
37
|
chainName: string;
|
|
37
38
|
keyShare: ServerKeyShare;
|
|
38
39
|
derivationPath: Uint32Array | undefined;
|
|
39
|
-
}): Promise<
|
|
40
|
+
}): Promise<string | EcdsaPublicKey | undefined>;
|
|
40
41
|
externalServerKeyGen({ chainName, roomId, dynamicServerKeygenIds, externalServerInitKeygenResults, thresholdSignatureScheme, }: {
|
|
41
42
|
chainName: string;
|
|
42
43
|
roomId: string;
|
|
@@ -44,7 +45,7 @@ export declare class DynamicWalletClient {
|
|
|
44
45
|
externalServerInitKeygenResults: ServerInitKeygenResult[];
|
|
45
46
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
46
47
|
}): Promise<{
|
|
47
|
-
rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
|
|
48
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
48
49
|
externalServerKeyGenResults: ServerKeyShare[];
|
|
49
50
|
}>;
|
|
50
51
|
keyGen({ chainName, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
|
|
@@ -53,7 +54,7 @@ export declare class DynamicWalletClient {
|
|
|
53
54
|
onError?: (error: Error) => void;
|
|
54
55
|
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
55
56
|
}): Promise<{
|
|
56
|
-
rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
|
|
57
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
57
58
|
externalServerKeyShares: ServerKeyShare[];
|
|
58
59
|
}>;
|
|
59
60
|
importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
|
|
@@ -63,26 +64,30 @@ export declare class DynamicWalletClient {
|
|
|
63
64
|
onError?: (error: Error) => void;
|
|
64
65
|
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
65
66
|
}): Promise<{
|
|
66
|
-
rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
|
|
67
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
67
68
|
externalServerKeyShares: ServerKeyShare[];
|
|
68
69
|
}>;
|
|
69
|
-
dynamicServerSign({ walletId, message, }: {
|
|
70
|
+
dynamicServerSign({ walletId, message, isFormatted, }: {
|
|
70
71
|
walletId: string;
|
|
71
72
|
message: string | Uint8Array;
|
|
73
|
+
isFormatted?: boolean;
|
|
72
74
|
}): Promise<import("@dynamic-labs-wallet/core").OpenRoomResponse>;
|
|
73
|
-
externalServerSign({ chainName, message, roomId, keyShare, derivationPath, }: {
|
|
75
|
+
externalServerSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted, }: {
|
|
74
76
|
chainName: string;
|
|
75
77
|
message: string | Uint8Array;
|
|
76
78
|
roomId: string;
|
|
77
79
|
keyShare: ServerKeyShare;
|
|
78
80
|
derivationPath: Uint32Array | undefined;
|
|
81
|
+
isFormatted?: boolean;
|
|
79
82
|
}): Promise<Uint8Array | EcdsaSignature>;
|
|
80
|
-
sign({ accountAddress, message, chainName, password, signedSessionId, }: {
|
|
83
|
+
sign({ accountAddress, externalServerKeyShares, message, chainName, password, isFormatted, signedSessionId, }: {
|
|
81
84
|
accountAddress: string;
|
|
85
|
+
externalServerKeyShares: ServerKeyShare[];
|
|
82
86
|
message: string | Uint8Array;
|
|
83
87
|
chainName: string;
|
|
84
88
|
password?: string;
|
|
85
89
|
signedSessionId: string;
|
|
90
|
+
isFormatted?: boolean;
|
|
86
91
|
}): Promise<Uint8Array | EcdsaSignature>;
|
|
87
92
|
refreshWalletAccountShares({ accountAddress, chainName, password, signedSessionId, }: {
|
|
88
93
|
accountAddress: string;
|
|
@@ -127,11 +132,12 @@ export declare class DynamicWalletClient {
|
|
|
127
132
|
password?: string;
|
|
128
133
|
signedSessionId: string;
|
|
129
134
|
}): Promise<(EcdsaKeygenResult | BIP340KeygenResult)[]>;
|
|
130
|
-
exportKey({ accountAddress, chainName, password, signedSessionId, }: {
|
|
135
|
+
exportKey({ accountAddress, chainName, password, signedSessionId, externalServerKeyShares, }: {
|
|
131
136
|
accountAddress: string;
|
|
132
137
|
chainName: string;
|
|
133
138
|
password?: string;
|
|
134
139
|
signedSessionId: string;
|
|
140
|
+
externalServerKeyShares: ServerKeyShare[];
|
|
135
141
|
}): Promise<{
|
|
136
142
|
derivedPrivateKey: string | undefined;
|
|
137
143
|
}>;
|
|
@@ -154,7 +160,7 @@ export declare class DynamicWalletClient {
|
|
|
154
160
|
externalServerKeyShares?: ServerKeyShare[];
|
|
155
161
|
password?: string;
|
|
156
162
|
signedSessionId: string;
|
|
157
|
-
}): Promise<
|
|
163
|
+
}): Promise<string[]>;
|
|
158
164
|
storeEncryptedBackupByWalletWithRetry({ accountAddress, externalServerKeyShares, password, signedSessionId, }: {
|
|
159
165
|
accountAddress: string;
|
|
160
166
|
externalServerKeyShares?: ServerKeyShare[];
|
|
@@ -248,7 +254,7 @@ export declare class DynamicWalletClient {
|
|
|
248
254
|
getWalletExternalServerKeyShareBackupInfo({ accountAddress, }: {
|
|
249
255
|
accountAddress: string;
|
|
250
256
|
}): Promise<KeyShareBackupInfo>;
|
|
251
|
-
getWallet({ accountAddress, walletOperation,
|
|
257
|
+
getWallet({ accountAddress, walletOperation, shareCount, }: {
|
|
252
258
|
accountAddress: string;
|
|
253
259
|
walletOperation?: WalletOperation;
|
|
254
260
|
signedSessionId: string;
|
package/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"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A8C,EAC9C,UAAsB,GACvB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IAgDK,UAAU;CAuCjB"}
|
package/src/mpc/mpc.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SigningAlgorithm } from '@dynamic-labs-wallet/core';
|
|
2
|
-
import { Ecdsa,
|
|
3
|
-
export { Ecdsa,
|
|
2
|
+
import { Ecdsa, ExportableEd25519, BIP340, BIP340KeygenResult, EcdsaPublicKey, ExportableEd25519KeygenResult, EcdsaKeygenResult, MessageHash, EcdsaInitKeygenResult, ExportableEd25519InitKeygenResult, BIP340InitKeygenResult, EcdsaSignature } from '../../../internal/node';
|
|
3
|
+
export { Ecdsa, ExportableEd25519, BIP340, EcdsaPublicKey, EcdsaKeygenResult, ExportableEd25519KeygenResult, BIP340KeygenResult, MessageHash, EcdsaInitKeygenResult, ExportableEd25519InitKeygenResult, BIP340InitKeygenResult, EcdsaSignature, };
|
|
4
4
|
export declare const getMPCSignatureScheme: ({ signingAlgorithm, baseRelayUrl, }: {
|
|
5
5
|
signingAlgorithm: SigningAlgorithm;
|
|
6
6
|
baseRelayUrl?: string;
|
|
7
|
-
}) => Ecdsa |
|
|
7
|
+
}) => Ecdsa | ExportableEd25519 | BIP340;
|
|
8
8
|
export declare const getMPCSigner: ({ chainName, baseRelayUrl, }: {
|
|
9
9
|
chainName: string;
|
|
10
10
|
baseRelayUrl?: string;
|
|
11
|
-
}) => Ecdsa |
|
|
11
|
+
}) => Ecdsa | ExportableEd25519 | BIP340;
|
|
12
12
|
//# sourceMappingURL=mpc.d.ts.map
|
package/src/mpc/mpc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mpc.d.ts","sourceRoot":"","sources":["../../src/mpc/mpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,KAAK,EACL,
|
|
1
|
+
{"version":3,"file":"mpc.d.ts","sourceRoot":"","sources":["../../src/mpc/mpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,6BAA6B,EAC7B,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,iCAAiC,EACjC,sBAAsB,EACtB,cAAc,EACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,6BAA6B,EAC7B,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,iCAAiC,EACjC,sBAAsB,EACtB,cAAc,GACf,CAAC;AAEF,eAAO,MAAM,qBAAqB,wCAG/B;IACD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,uCAWA,CAAC;AAEF,eAAO,MAAM,YAAY,iCAGtB;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,uCAOA,CAAC"}
|
package/src/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WaasWalletProperties, KeyShareBackupInfo } from '@dynamic-labs-wallet/core';
|
|
2
2
|
import { ServerKeyShare } from './mpc/types';
|
|
3
|
+
import { MessageHash } from '../../internal/node';
|
|
3
4
|
export declare const bytesToBase64: (arr: Uint8Array) => string;
|
|
4
5
|
export declare const stringToBytes: (str: string) => Uint8Array;
|
|
5
6
|
export declare const base64ToBytes: (base64: string) => Uint8Array;
|
|
@@ -30,5 +31,7 @@ interface RetryConfig {
|
|
|
30
31
|
* @throws Last error encountered after all retries are exhausted
|
|
31
32
|
*/
|
|
32
33
|
export declare function retryPromise<T>(operation: () => Promise<T>, { maxAttempts, retryInterval, operationName, logContext, }?: RetryConfig): Promise<T>;
|
|
34
|
+
export declare const formatEvmMessage: (message: string | Uint8Array) => MessageHash;
|
|
35
|
+
export declare const formatMessage: (chainName: string, message: string | Uint8Array) => string | Uint8Array | MessageHash;
|
|
33
36
|
export {};
|
|
34
37
|
//# sourceMappingURL=utils.d.ts.map
|
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,EAEL,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,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,WAAW,QAAS,MAAM,YAKtC,CAAC;AAEF,eAAO,MAAM,mCAAmC,YAAa;IAC3D,gBAAgB,EAAE,oBAAoB,CAAC;CACxC,KAAG,kBAgCH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,sBACZ,cAAc,EAAE,gBACrB,cAAc,EAAE,KAC7B,cAAc,EAchB,CAAC;AAEF,UAAU,WAAW;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,wBAAs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