@dynamic-labs-wallet/browser 0.0.3 → 0.0.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/index.esm.js +234 -116
- package/package.json +3 -3
- package/src/client.d.ts +70 -50
- package/src/client.d.ts.map +1 -1
- package/src/mpc/types.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SigningAlgorithm,
|
|
1
|
+
import { SigningAlgorithm, MPC_RELAY_API_URL, getMPCChainConfig, MPC_CONFIG, getTSSConfig, DynamicApiClient } from '@dynamic-labs-wallet/core';
|
|
2
2
|
export * from '@dynamic-labs-wallet/core';
|
|
3
|
-
import { BIP340, Ed25519, Ecdsa, MessageHash } from '@dynamic-labs-wallet/lib-mpc-web';
|
|
3
|
+
import { BIP340, Ed25519, Ecdsa, MessageHash, EcdsaKeygenResult, Ed25519KeygenResult, BIP340KeygenResult } from '@dynamic-labs-wallet/lib-mpc-web';
|
|
4
4
|
export { BIP340, BIP340InitKeygenResult, BIP340KeygenResult, Ecdsa, EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519, Ed25519InitKeygenResult, Ed25519KeygenResult, MessageHash } from '@dynamic-labs-wallet/lib-mpc-web';
|
|
5
5
|
|
|
6
|
-
const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl =
|
|
6
|
+
const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = MPC_RELAY_API_URL })=>{
|
|
7
7
|
switch(signingAlgorithm){
|
|
8
8
|
case SigningAlgorithm.ECDSA:
|
|
9
9
|
return new Ecdsa(baseRelayUrl);
|
|
@@ -182,14 +182,15 @@ const downloadFileFromGoogleDrive = async ({ accessToken, name })=>{
|
|
|
182
182
|
const BACKUP_FILENAME = 'dynamicWalletSecretBackup.json';
|
|
183
183
|
|
|
184
184
|
class DynamicWalletClient {
|
|
185
|
-
async serverInitializeKeyGen({ chainName, clientPrimaryKeygenId, clientSecondaryKeygenId }) {
|
|
185
|
+
async serverInitializeKeyGen({ chainName, clientPrimaryKeygenId, clientSecondaryKeygenId, thresholdSignatureScheme }) {
|
|
186
186
|
// Initilize keygen, create room, and create the wallet account on the server
|
|
187
187
|
const data = await this.apiClient.createWalletAccount({
|
|
188
188
|
chainName,
|
|
189
189
|
clientKeygenIds: [
|
|
190
190
|
clientPrimaryKeygenId,
|
|
191
191
|
clientSecondaryKeygenId
|
|
192
|
-
]
|
|
192
|
+
],
|
|
193
|
+
thresholdSignatureScheme
|
|
193
194
|
});
|
|
194
195
|
return data;
|
|
195
196
|
}
|
|
@@ -197,7 +198,7 @@ class DynamicWalletClient {
|
|
|
197
198
|
// Get the mpc signer
|
|
198
199
|
const mpcSigner = getMPCSigner({
|
|
199
200
|
chainName,
|
|
200
|
-
baseRelayUrl:
|
|
201
|
+
baseRelayUrl: MPC_RELAY_API_URL
|
|
201
202
|
});
|
|
202
203
|
// Initialize the keygen for the primary client and the secondary client shares
|
|
203
204
|
const keygenInitResults = await Promise.all([
|
|
@@ -213,23 +214,23 @@ class DynamicWalletClient {
|
|
|
213
214
|
async derivePublicKey({ chainName, keyShare }) {
|
|
214
215
|
const mpcSigner = getMPCSigner({
|
|
215
216
|
chainName,
|
|
216
|
-
baseRelayUrl:
|
|
217
|
+
baseRelayUrl: MPC_RELAY_API_URL
|
|
217
218
|
});
|
|
218
219
|
const chainConfig = getMPCChainConfig(chainName);
|
|
219
220
|
let publicKey;
|
|
220
221
|
if (mpcSigner instanceof Ecdsa) {
|
|
221
|
-
publicKey = await mpcSigner.derivePubkey(keyShare
|
|
222
|
+
publicKey = await mpcSigner.derivePubkey(keyShare, new Uint32Array(chainConfig.derivationPath));
|
|
222
223
|
} else if (mpcSigner instanceof Ed25519) {
|
|
223
|
-
publicKey = await mpcSigner.derivePubkey(keyShare
|
|
224
|
+
publicKey = await mpcSigner.derivePubkey(keyShare, new Uint32Array(chainConfig.derivationPath));
|
|
224
225
|
}
|
|
225
226
|
return publicKey;
|
|
226
227
|
}
|
|
227
|
-
async clientKeyGen({ chainName, roomId, serverKeygenIds, clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult }) {
|
|
228
|
+
async clientKeyGen({ chainName, roomId, serverKeygenIds, clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult, thresholdSignatureScheme }) {
|
|
228
229
|
// Get the chain config and the mpc signer
|
|
229
230
|
const chainConfig = getMPCChainConfig(chainName);
|
|
230
231
|
const mpcSigner = getMPCSigner({
|
|
231
232
|
chainName,
|
|
232
|
-
baseRelayUrl:
|
|
233
|
+
baseRelayUrl: MPC_RELAY_API_URL
|
|
233
234
|
});
|
|
234
235
|
// All parties receive the keygenIds from all OTHER parties
|
|
235
236
|
const clientPrimaryKeygenId = clientPrimaryKeygenInitResult.keygenId;
|
|
@@ -243,14 +244,13 @@ class DynamicWalletClient {
|
|
|
243
244
|
clientPrimaryKeygenId
|
|
244
245
|
];
|
|
245
246
|
// Get the MPC config for the threshold signature scheme
|
|
246
|
-
const mpcConfig = MPC_CONFIG[
|
|
247
|
+
const mpcConfig = MPC_CONFIG[thresholdSignatureScheme];
|
|
247
248
|
// All parties join the keygen room
|
|
248
249
|
const keygenResults = await Promise.all([
|
|
249
250
|
mpcSigner.keygen(roomId, mpcConfig.numberOfParties, mpcConfig.threshold, clientPrimaryKeygenInitResult, clientPrimaryKeygenIds),
|
|
250
251
|
mpcSigner.keygen(roomId, mpcConfig.numberOfParties, mpcConfig.threshold, clientSecondaryKeygenInitResult, clientSecondaryKeygenIds)
|
|
251
252
|
]);
|
|
252
253
|
const [clientPrimaryKeygenResult, clientSecondaryKeygenResult] = keygenResults;
|
|
253
|
-
this.clientKeyshare = clientPrimaryKeygenResult;
|
|
254
254
|
// Pick the derivation path of the public key you want to sign for
|
|
255
255
|
const derivationPath = new Uint32Array(chainConfig.derivationPath);
|
|
256
256
|
// Get the public key for the derivation path
|
|
@@ -268,7 +268,7 @@ class DynamicWalletClient {
|
|
|
268
268
|
secondaryKeygenResult: clientSecondaryKeygenResult
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
|
-
async keyGen({ chainName }) {
|
|
271
|
+
async keyGen({ chainName, thresholdSignatureScheme }) {
|
|
272
272
|
try {
|
|
273
273
|
const { clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult } = await this.clientInitializeKeyGen({
|
|
274
274
|
chainName
|
|
@@ -276,14 +276,16 @@ class DynamicWalletClient {
|
|
|
276
276
|
const data = await this.serverInitializeKeyGen({
|
|
277
277
|
chainName,
|
|
278
278
|
clientPrimaryKeygenId: clientPrimaryKeygenInitResult.keygenId,
|
|
279
|
-
clientSecondaryKeygenId: clientSecondaryKeygenInitResult.keygenId
|
|
279
|
+
clientSecondaryKeygenId: clientSecondaryKeygenInitResult.keygenId,
|
|
280
|
+
thresholdSignatureScheme
|
|
280
281
|
});
|
|
281
282
|
const { rawPublicKey, primaryKeygenResult, secondaryKeygenResult } = await this.clientKeyGen({
|
|
282
283
|
chainName,
|
|
283
284
|
roomId: data.roomId,
|
|
284
285
|
serverKeygenIds: data.serverKeygenIds,
|
|
285
286
|
clientPrimaryKeygenInitResult,
|
|
286
|
-
clientSecondaryKeygenInitResult
|
|
287
|
+
clientSecondaryKeygenInitResult,
|
|
288
|
+
thresholdSignatureScheme
|
|
287
289
|
});
|
|
288
290
|
return {
|
|
289
291
|
rawPublicKey,
|
|
@@ -303,12 +305,12 @@ class DynamicWalletClient {
|
|
|
303
305
|
});
|
|
304
306
|
return data;
|
|
305
307
|
}
|
|
306
|
-
async clientSign({ chainName, message, roomId }) {
|
|
308
|
+
async clientSign({ chainName, message, roomId, keyShare }) {
|
|
307
309
|
try {
|
|
308
310
|
const chainConfig = getMPCChainConfig(chainName);
|
|
309
311
|
const mpcSigner = getMPCSigner({
|
|
310
312
|
chainName,
|
|
311
|
-
baseRelayUrl:
|
|
313
|
+
baseRelayUrl: MPC_RELAY_API_URL
|
|
312
314
|
});
|
|
313
315
|
const derivationPath = new Uint32Array(chainConfig.derivationPath);
|
|
314
316
|
let formattedMessage;
|
|
@@ -321,45 +323,49 @@ class DynamicWalletClient {
|
|
|
321
323
|
} else {
|
|
322
324
|
throw new Error('Unsupported signer type');
|
|
323
325
|
}
|
|
324
|
-
const signature = await mpcSigner.sign(roomId,
|
|
326
|
+
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
325
327
|
return signature;
|
|
326
328
|
} catch (error) {
|
|
327
329
|
console.error('Error in clientSign:', error);
|
|
328
330
|
throw error;
|
|
329
331
|
}
|
|
330
332
|
}
|
|
331
|
-
async sign({
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
333
|
+
async sign({ accountAddress, message, chainName }) {
|
|
334
|
+
const wallet = await this.getWallet({
|
|
335
|
+
accountAddress
|
|
336
|
+
});
|
|
335
337
|
// Perform the server sign
|
|
336
338
|
const data = await this.serverSign({
|
|
337
|
-
walletId:
|
|
339
|
+
walletId: wallet.walletId,
|
|
338
340
|
message
|
|
339
341
|
});
|
|
340
342
|
// Perform the client sign and return the signature
|
|
341
343
|
const signature = await this.clientSign({
|
|
342
344
|
chainName,
|
|
343
345
|
message,
|
|
344
|
-
roomId: data.roomId
|
|
346
|
+
roomId: data.roomId,
|
|
347
|
+
keyShare: wallet.clientKeyShares[0]
|
|
345
348
|
});
|
|
346
349
|
return signature;
|
|
347
350
|
}
|
|
348
|
-
async refreshWalletAccountShares({
|
|
351
|
+
async refreshWalletAccountShares({ accountAddress }) {
|
|
352
|
+
const wallet = await this.getWallet({
|
|
353
|
+
accountAddress
|
|
354
|
+
});
|
|
355
|
+
const chainName = wallet.chainName;
|
|
349
356
|
const mpcSigner = getMPCSigner({
|
|
350
357
|
chainName,
|
|
351
|
-
baseRelayUrl:
|
|
358
|
+
baseRelayUrl: MPC_RELAY_API_URL
|
|
352
359
|
});
|
|
353
360
|
// Create the room and refresh the shares
|
|
354
361
|
const data = await this.apiClient.refreshWalletAccountShares({
|
|
355
|
-
walletId
|
|
362
|
+
walletId: wallet.walletId
|
|
356
363
|
});
|
|
357
364
|
const roomId = data.roomId;
|
|
358
365
|
const keygenResults = await Promise.all([
|
|
359
|
-
mpcSigner.refresh(roomId,
|
|
360
|
-
mpcSigner.refresh(roomId,
|
|
366
|
+
mpcSigner.refresh(roomId, wallet.clientKeyShares[0]),
|
|
367
|
+
mpcSigner.refresh(roomId, wallet.clientKeyShares[1])
|
|
361
368
|
]);
|
|
362
|
-
this.clientKeyshare = keygenResults[0];
|
|
363
369
|
return keygenResults;
|
|
364
370
|
}
|
|
365
371
|
async serverReshareRemainingParty({ walletId, clientKeygenIds }) {
|
|
@@ -369,29 +375,33 @@ class DynamicWalletClient {
|
|
|
369
375
|
});
|
|
370
376
|
return data;
|
|
371
377
|
}
|
|
372
|
-
async
|
|
378
|
+
async getExportId({ chainName, clientKeyShare }) {
|
|
373
379
|
const mpcSigner = getMPCSigner({
|
|
374
380
|
chainName,
|
|
375
|
-
baseRelayUrl:
|
|
381
|
+
baseRelayUrl: MPC_RELAY_API_URL
|
|
376
382
|
});
|
|
377
|
-
const exportId = await mpcSigner.exportID(
|
|
383
|
+
const exportId = await mpcSigner.exportID(clientKeyShare);
|
|
378
384
|
return exportId;
|
|
379
385
|
}
|
|
380
|
-
async reshareRemainingParty({
|
|
386
|
+
async reshareRemainingParty({ accountAddress, thresholdSignatureScheme }) {
|
|
387
|
+
const wallet = await this.getWallet({
|
|
388
|
+
accountAddress
|
|
389
|
+
});
|
|
390
|
+
const chainName = wallet.chainName;
|
|
381
391
|
const mpcSigner = getMPCSigner({
|
|
382
392
|
chainName,
|
|
383
|
-
baseRelayUrl:
|
|
393
|
+
baseRelayUrl: MPC_RELAY_API_URL
|
|
384
394
|
});
|
|
385
395
|
// Initialize the new party
|
|
386
396
|
const newPartyInitKeygen = await mpcSigner.initKeygen();
|
|
387
397
|
const newPartyInitKeygenId = newPartyInitKeygen.keygenId;
|
|
388
|
-
const clientKeygenId = await this.
|
|
398
|
+
const clientKeygenId = await this.getExportId({
|
|
389
399
|
chainName,
|
|
390
|
-
|
|
400
|
+
clientKeyShare: wallet.clientKeyShares[0]
|
|
391
401
|
});
|
|
392
402
|
// Create the room and reshare the server share
|
|
393
403
|
const data = await this.serverReshareRemainingParty({
|
|
394
|
-
walletId,
|
|
404
|
+
walletId: wallet.walletId,
|
|
395
405
|
clientKeygenIds: [
|
|
396
406
|
newPartyInitKeygenId,
|
|
397
407
|
clientKeygenId
|
|
@@ -399,7 +409,7 @@ class DynamicWalletClient {
|
|
|
399
409
|
});
|
|
400
410
|
const roomId = data.roomId;
|
|
401
411
|
// Get the MPC config for the threshold signature scheme
|
|
402
|
-
const mpcConfig = MPC_CONFIG[
|
|
412
|
+
const mpcConfig = MPC_CONFIG[thresholdSignatureScheme];
|
|
403
413
|
const newClientPrimaryKeygenIds = [
|
|
404
414
|
data.serverKeygenId,
|
|
405
415
|
clientKeygenId
|
|
@@ -412,26 +422,28 @@ class DynamicWalletClient {
|
|
|
412
422
|
console.log('clientSecondaryKeygenIds', clientSecondaryKeygenIds);
|
|
413
423
|
const keygenResults = await Promise.all([
|
|
414
424
|
mpcSigner.reshareNewParty(roomId, mpcConfig.threshold, mpcConfig.threshold, newPartyInitKeygen, newClientPrimaryKeygenIds),
|
|
415
|
-
mpcSigner.reshareRemainingParty(roomId, mpcConfig.threshold,
|
|
425
|
+
mpcSigner.reshareRemainingParty(roomId, mpcConfig.threshold, wallet.clientKeyShares[1], clientSecondaryKeygenIds)
|
|
416
426
|
]);
|
|
417
|
-
this.clientKeyshare = keygenResults[0];
|
|
418
427
|
return keygenResults;
|
|
419
428
|
}
|
|
420
|
-
async
|
|
429
|
+
async exportKey({ accountAddress, chainName }) {
|
|
430
|
+
const wallet = await this.getWallet({
|
|
431
|
+
accountAddress
|
|
432
|
+
});
|
|
421
433
|
const chainConfig = getMPCChainConfig(chainName);
|
|
422
434
|
const mpcSigner = getMPCSigner({
|
|
423
435
|
chainName,
|
|
424
|
-
baseRelayUrl:
|
|
436
|
+
baseRelayUrl: MPC_RELAY_API_URL
|
|
425
437
|
});
|
|
426
|
-
const exportId = await this.
|
|
438
|
+
const exportId = await this.getExportId({
|
|
427
439
|
chainName,
|
|
428
|
-
|
|
440
|
+
clientKeyShare: wallet.clientKeyShares[0]
|
|
429
441
|
});
|
|
430
442
|
const data = await this.apiClient.exportKey({
|
|
431
|
-
walletId,
|
|
443
|
+
walletId: wallet.walletId,
|
|
432
444
|
exportId
|
|
433
445
|
});
|
|
434
|
-
const keyExportRaw = await mpcSigner.exportFullPrivateKey(data.roomId,
|
|
446
|
+
const keyExportRaw = await mpcSigner.exportFullPrivateKey(data.roomId, wallet.clientKeyShares[0], exportId);
|
|
435
447
|
if (!keyExportRaw) {
|
|
436
448
|
throw new Error('Error exporting private key');
|
|
437
449
|
}
|
|
@@ -448,28 +460,39 @@ class DynamicWalletClient {
|
|
|
448
460
|
derivedPrivateKey
|
|
449
461
|
};
|
|
450
462
|
}
|
|
451
|
-
async
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
463
|
+
async offlineExportKey({ chainName, keyShares }) {
|
|
464
|
+
try {
|
|
465
|
+
if (!keyShares || keyShares.length !== 2) {
|
|
466
|
+
throw new Error('Must provide 2 key shares');
|
|
467
|
+
}
|
|
468
|
+
const mpcSigner = getMPCSigner({
|
|
469
|
+
chainName,
|
|
470
|
+
baseRelayUrl: MPC_RELAY_API_URL
|
|
471
|
+
});
|
|
472
|
+
const walletKeyShares = keyShares.map((keyShare)=>{
|
|
473
|
+
return mpcSigner instanceof Ecdsa ? new EcdsaKeygenResult(keyShare.pubkey, keyShare.secretShare) : mpcSigner instanceof Ed25519 ? new Ed25519KeygenResult(keyShare.pubkey, keyShare.secretShare) : new BIP340KeygenResult(keyShare.pubkey, keyShare.secretShare);
|
|
474
|
+
});
|
|
475
|
+
const keyExportRaw = await mpcSigner.offlineExportFullPrivateKey(walletKeyShares);
|
|
476
|
+
if (!keyExportRaw) {
|
|
477
|
+
throw new Error('Error exporting private key: Export returned null');
|
|
478
|
+
}
|
|
479
|
+
const chainConfig = getMPCChainConfig(chainName);
|
|
480
|
+
const derivationPath = new Uint32Array(chainConfig.derivationPath);
|
|
481
|
+
let derivedPrivateKey;
|
|
482
|
+
if (mpcSigner instanceof Ecdsa) {
|
|
483
|
+
derivedPrivateKey = await mpcSigner.derivePrivateKeyFromXpriv(keyExportRaw, derivationPath);
|
|
484
|
+
} else if (mpcSigner instanceof Ed25519) {
|
|
485
|
+
derivedPrivateKey = keyExportRaw;
|
|
486
|
+
} else if (mpcSigner instanceof BIP340) {
|
|
487
|
+
derivedPrivateKey = await mpcSigner.derivePrivateKeyFromXpriv(keyExportRaw, derivationPath);
|
|
488
|
+
}
|
|
489
|
+
return {
|
|
490
|
+
derivedPrivateKey
|
|
491
|
+
};
|
|
492
|
+
} catch (error) {
|
|
493
|
+
console.error('Error in offlineExportKey:', error);
|
|
494
|
+
throw error;
|
|
469
495
|
}
|
|
470
|
-
return {
|
|
471
|
-
derivedPrivateKey
|
|
472
|
-
};
|
|
473
496
|
}
|
|
474
497
|
async encryptKeyShare({ keyShare, password }) {
|
|
475
498
|
const serializedKeyShare = JSON.stringify(keyShare);
|
|
@@ -481,14 +504,15 @@ class DynamicWalletClient {
|
|
|
481
504
|
const serializedEncryptedKeyShare = Buffer.from(JSON.stringify(encryptedKeyShare)).toString('base64');
|
|
482
505
|
return serializedEncryptedKeyShare;
|
|
483
506
|
}
|
|
484
|
-
async
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
const data = await this.apiClient.
|
|
490
|
-
walletId,
|
|
491
|
-
|
|
507
|
+
async storeEncryptedBackupByWallet({ accountAddress, password }) {
|
|
508
|
+
const encryptedKeyShares = await Promise.all(this.walletMap[accountAddress].clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
509
|
+
keyShare,
|
|
510
|
+
password
|
|
511
|
+
})));
|
|
512
|
+
const data = await this.apiClient.storeEncryptedBackupByWallet({
|
|
513
|
+
walletId: this.walletMap[accountAddress].walletId,
|
|
514
|
+
encryptedKeyShares,
|
|
515
|
+
passwordEncrypted: password ? true : false
|
|
492
516
|
});
|
|
493
517
|
return data;
|
|
494
518
|
}
|
|
@@ -501,28 +525,38 @@ class DynamicWalletClient {
|
|
|
501
525
|
const deserializedKeyShare = JSON.parse(decryptedKeyShare);
|
|
502
526
|
return deserializedKeyShare;
|
|
503
527
|
}
|
|
504
|
-
async
|
|
505
|
-
const data = await this.apiClient.
|
|
506
|
-
walletId,
|
|
507
|
-
|
|
508
|
-
});
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
528
|
+
async recoverEncryptedBackupByWallet({ accountAddress, password, keyShareIds }) {
|
|
529
|
+
const data = await this.apiClient.recoverEncryptedBackupByWallet({
|
|
530
|
+
walletId: this.walletMap[accountAddress].walletId,
|
|
531
|
+
keyShareIds
|
|
532
|
+
});
|
|
533
|
+
const decryptedKeyShares = await Promise.all(data.keyShares.map((keyShare)=>this.decryptKeyShare({
|
|
534
|
+
keyShare: keyShare.encryptedAccountCredential,
|
|
535
|
+
password: password != null ? password : this.environmentId
|
|
536
|
+
})));
|
|
537
|
+
decryptedKeyShares.forEach((keyShare)=>{
|
|
538
|
+
this.restoreBackupShare({
|
|
539
|
+
walletId: this.walletMap[accountAddress].walletId,
|
|
540
|
+
accountAddress,
|
|
541
|
+
chainName: data.chainName,
|
|
542
|
+
keyShare,
|
|
543
|
+
thresholdSignatureScheme: data.thresholdSignatureScheme
|
|
544
|
+
});
|
|
515
545
|
});
|
|
516
|
-
return
|
|
517
|
-
}
|
|
518
|
-
restoreBackupShare({ keyShare }) {
|
|
519
|
-
this.clientKeyshare = keyShare;
|
|
546
|
+
return decryptedKeyShares;
|
|
520
547
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
548
|
+
restoreBackupShare({ walletId, accountAddress, chainName, keyShare, thresholdSignatureScheme }) {
|
|
549
|
+
var _this_walletMap_accountAddress;
|
|
550
|
+
this.walletMap[accountAddress] = {
|
|
551
|
+
walletId,
|
|
552
|
+
chainName,
|
|
553
|
+
accountAddress,
|
|
554
|
+
clientKeyShares: [
|
|
555
|
+
...((_this_walletMap_accountAddress = this.walletMap[accountAddress]) == null ? undefined : _this_walletMap_accountAddress.clientKeyShares) || [],
|
|
556
|
+
keyShare
|
|
557
|
+
],
|
|
558
|
+
thresholdSignatureScheme
|
|
559
|
+
};
|
|
526
560
|
}
|
|
527
561
|
async backupFileToGoogleDrive({ oauthAccountId, fileName = BACKUP_FILENAME, jsonData, password }) {
|
|
528
562
|
const encryptedKeyShare = await this.encryptKeyShare({
|
|
@@ -556,10 +590,11 @@ class DynamicWalletClient {
|
|
|
556
590
|
});
|
|
557
591
|
return decryptedKeyShare;
|
|
558
592
|
}
|
|
559
|
-
async importRawPrivateKey({ chainName,
|
|
593
|
+
async importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme }) {
|
|
594
|
+
const chainConfig = getMPCChainConfig(chainName);
|
|
560
595
|
const mpcSigner = getMPCSigner({
|
|
561
596
|
chainName,
|
|
562
|
-
baseRelayUrl:
|
|
597
|
+
baseRelayUrl: MPC_RELAY_API_URL
|
|
563
598
|
});
|
|
564
599
|
// 1. 2 parties on the client side create keygenInit
|
|
565
600
|
const { clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult } = await this.clientInitializeKeyGen({
|
|
@@ -572,22 +607,22 @@ class DynamicWalletClient {
|
|
|
572
607
|
// --- 1. init keygen for the server as a party
|
|
573
608
|
// --- 2. open a room and return the roomId for the ceremony
|
|
574
609
|
// --- 3. join the room as a party for the 2/3 ceremony
|
|
575
|
-
const { roomId,
|
|
610
|
+
const { roomId, serverKeygenIds } = await this.apiClient.importPrivateKey({
|
|
576
611
|
chainName,
|
|
577
|
-
walletId,
|
|
578
612
|
clientKeygenIds: [
|
|
579
613
|
clientPrimaryKeygenId,
|
|
580
614
|
clientSecondaryKeygenId
|
|
581
|
-
]
|
|
615
|
+
],
|
|
616
|
+
thresholdSignatureScheme
|
|
582
617
|
});
|
|
583
|
-
const threshold =
|
|
618
|
+
const { threshold } = getTSSConfig(thresholdSignatureScheme);
|
|
584
619
|
// prep
|
|
585
620
|
const importerKeygenIds = [
|
|
586
|
-
|
|
621
|
+
...serverKeygenIds,
|
|
587
622
|
clientSecondaryKeygenId
|
|
588
623
|
];
|
|
589
624
|
const recipientKeygenIds = [
|
|
590
|
-
|
|
625
|
+
...serverKeygenIds,
|
|
591
626
|
clientPrimaryKeygenId
|
|
592
627
|
];
|
|
593
628
|
// 3. Join the keygen room for the ceremony
|
|
@@ -595,26 +630,109 @@ class DynamicWalletClient {
|
|
|
595
630
|
mpcSigner.importPrivateKeyImporter(roomId, threshold, privateKey, clientPrimaryKeygenInitResult, importerKeygenIds),
|
|
596
631
|
mpcSigner.importPrivateKeyRecipient(roomId, threshold, clientSecondaryKeygenInitResult, recipientKeygenIds)
|
|
597
632
|
]);
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
633
|
+
const derivationPath = new Uint32Array(chainConfig.derivationPath);
|
|
634
|
+
// Get the public key for the derivation path
|
|
635
|
+
let rawPublicKey;
|
|
636
|
+
if (mpcSigner instanceof Ecdsa) {
|
|
637
|
+
rawPublicKey = await mpcSigner.derivePubkey(clientPrimaryKeygenResult, derivationPath);
|
|
638
|
+
} else if (mpcSigner instanceof Ed25519) {
|
|
639
|
+
rawPublicKey = await mpcSigner.derivePubkey(clientPrimaryKeygenResult, derivationPath);
|
|
640
|
+
} else if (mpcSigner instanceof BIP340) {
|
|
641
|
+
rawPublicKey = await mpcSigner.deriveTweakPubkey(clientPrimaryKeygenResult, derivationPath);
|
|
642
|
+
}
|
|
643
|
+
return {
|
|
644
|
+
rawPublicKey,
|
|
645
|
+
primaryKeygenResult: clientPrimaryKeygenResult,
|
|
646
|
+
secondaryKeygenResult: clientSecondaryKeygenResult
|
|
647
|
+
};
|
|
603
648
|
}
|
|
604
|
-
async
|
|
605
|
-
|
|
649
|
+
async exportClientKeyshares({ accountAddress }) {
|
|
650
|
+
const clientKeyshares = await this.getClientKeyshares({
|
|
651
|
+
accountAddress
|
|
652
|
+
});
|
|
653
|
+
const text = JSON.stringify(clientKeyshares);
|
|
654
|
+
const blob = new Blob([
|
|
655
|
+
text
|
|
656
|
+
], {
|
|
657
|
+
type: 'text/plain'
|
|
658
|
+
});
|
|
659
|
+
const url = URL.createObjectURL(blob);
|
|
660
|
+
const a = document.createElement('a');
|
|
661
|
+
a.href = url;
|
|
662
|
+
a.download = 'clientKeyshare.txt';
|
|
663
|
+
a.click();
|
|
664
|
+
}
|
|
665
|
+
async getClientKeyshares({ accountAddress }) {
|
|
666
|
+
const wallet = await this.getWallet({
|
|
667
|
+
accountAddress
|
|
668
|
+
});
|
|
669
|
+
return wallet.clientKeyShares;
|
|
606
670
|
}
|
|
607
|
-
async
|
|
608
|
-
|
|
671
|
+
async getWallet({ accountAddress }) {
|
|
672
|
+
if (accountAddress) {
|
|
673
|
+
if (this.walletMap[accountAddress] && this.walletMap[accountAddress].clientKeyShares.length > 0) {
|
|
674
|
+
return this.walletMap[accountAddress];
|
|
675
|
+
} else {
|
|
676
|
+
var _user_verifiedCredentials;
|
|
677
|
+
const user = await this.apiClient.getUser();
|
|
678
|
+
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? undefined : _user_verifiedCredentials.find((vc)=>vc.address === accountAddress);
|
|
679
|
+
console.log('need to restore wallet', wallet);
|
|
680
|
+
const clientShares = wallet.walletProperties.keyShares.filter((ks)=>ks.backupLocation === 'dynamic');
|
|
681
|
+
console.log('clientShares', clientShares);
|
|
682
|
+
// restore backup
|
|
683
|
+
const decryptedKeyShares = await this.recoverEncryptedBackupByWallet({
|
|
684
|
+
accountAddress,
|
|
685
|
+
password: this.environmentId
|
|
686
|
+
});
|
|
687
|
+
//todo: check to see if their are other backups ie google drive, etc
|
|
688
|
+
console.log('recovery decryptedKeyShares', decryptedKeyShares);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
const walletCount = Object.keys(this.walletMap).length;
|
|
692
|
+
// if there are no wallets, throw an error
|
|
693
|
+
if (walletCount === 0) {
|
|
694
|
+
throw new Error('No wallets found');
|
|
695
|
+
}
|
|
696
|
+
// if there is only one wallet, return it by default
|
|
697
|
+
if (walletCount === 1) {
|
|
698
|
+
return Object.values(this.walletMap)[0];
|
|
699
|
+
}
|
|
700
|
+
if (!accountAddress) {
|
|
701
|
+
throw new Error('Must provide an account address');
|
|
702
|
+
}
|
|
703
|
+
return this.walletMap[accountAddress];
|
|
704
|
+
}
|
|
705
|
+
async getWallets() {
|
|
706
|
+
var _user_verifiedCredentials;
|
|
707
|
+
const user = await this.apiClient.getUser();
|
|
708
|
+
const waasWallets = (_user_verifiedCredentials = user.verifiedCredentials) == null ? undefined : _user_verifiedCredentials.filter((vc)=>vc.walletName === 'dynamicwaas');
|
|
709
|
+
const wallets = waasWallets.map((vc)=>({
|
|
710
|
+
walletId: vc.id,
|
|
711
|
+
chainName: vc.chain,
|
|
712
|
+
accountAddress: vc.address
|
|
713
|
+
}));
|
|
714
|
+
this.walletMap = wallets.reduce((acc, wallet)=>{
|
|
715
|
+
acc[wallet.accountAddress] = {
|
|
716
|
+
walletId: wallet.walletId,
|
|
717
|
+
chainName: wallet.chainName,
|
|
718
|
+
accountAddress: wallet.accountAddress,
|
|
719
|
+
clientKeyShares: [],
|
|
720
|
+
thresholdSignatureScheme: undefined
|
|
721
|
+
};
|
|
722
|
+
return acc;
|
|
723
|
+
}, {});
|
|
724
|
+
return wallets;
|
|
609
725
|
}
|
|
610
|
-
constructor({ environmentId, authToken, baseApiUrl
|
|
726
|
+
constructor({ environmentId, authToken, baseApiUrl }){
|
|
727
|
+
this.walletMap = {} // todo: store in session storage
|
|
728
|
+
;
|
|
611
729
|
this.environmentId = environmentId;
|
|
612
|
-
this.clientKeyshare = clientKeyshare;
|
|
613
730
|
this.apiClient = new DynamicApiClient({
|
|
614
731
|
environmentId,
|
|
615
732
|
authToken,
|
|
616
733
|
baseApiUrl
|
|
617
734
|
});
|
|
735
|
+
this.getWallets();
|
|
618
736
|
}
|
|
619
737
|
}
|
|
620
738
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@dynamic-labs-wallet/core": "0.0.
|
|
6
|
-
"@dynamic-labs-wallet/lib-mpc-web": "0.0.
|
|
5
|
+
"@dynamic-labs-wallet/core": "0.0.5",
|
|
6
|
+
"@dynamic-labs-wallet/lib-mpc-web": "0.0.5"
|
|
7
7
|
},
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "restricted"
|
package/src/client.d.ts
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
|
+
import { ThresholdSignatureScheme, DynamicApiClient } from '@dynamic-labs-wallet/core';
|
|
1
2
|
import { EcdsaPublicKey, EcdsaKeygenResult, Ed25519KeygenResult, BIP340KeygenResult, EcdsaSignature } from '@dynamic-labs-wallet/lib-mpc-web';
|
|
2
|
-
import { ClientInitKeygenResult,
|
|
3
|
+
import { ClientInitKeygenResult, ClientKeyShare } from './mpc/types';
|
|
4
|
+
interface WalletProperties {
|
|
5
|
+
chainName: string;
|
|
6
|
+
walletId: string;
|
|
7
|
+
accountAddress: string;
|
|
8
|
+
clientKeyShares: ClientKeyShare[];
|
|
9
|
+
thresholdSignatureScheme?: ThresholdSignatureScheme;
|
|
10
|
+
}
|
|
3
11
|
export declare class DynamicWalletClient {
|
|
4
12
|
environmentId: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
constructor({ environmentId, authToken, baseApiUrl, clientKeyshare, }: {
|
|
13
|
+
protected apiClient: DynamicApiClient;
|
|
14
|
+
protected walletMap: Record<string, WalletProperties>;
|
|
15
|
+
constructor({ environmentId, authToken, baseApiUrl, }: {
|
|
9
16
|
environmentId: string;
|
|
10
17
|
authToken: string;
|
|
11
18
|
baseApiUrl?: string;
|
|
12
|
-
clientKeyshare?: ClientKeyshare;
|
|
13
19
|
});
|
|
14
|
-
serverInitializeKeyGen({ chainName, clientPrimaryKeygenId, clientSecondaryKeygenId, }: {
|
|
20
|
+
serverInitializeKeyGen({ chainName, clientPrimaryKeygenId, clientSecondaryKeygenId, thresholdSignatureScheme, }: {
|
|
15
21
|
chainName: string;
|
|
16
22
|
clientPrimaryKeygenId: string;
|
|
17
23
|
clientSecondaryKeygenId: string;
|
|
24
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
18
25
|
}): Promise<any>;
|
|
19
26
|
clientInitializeKeyGen({ chainName }: {
|
|
20
27
|
chainName: string;
|
|
@@ -24,23 +31,25 @@ export declare class DynamicWalletClient {
|
|
|
24
31
|
}>;
|
|
25
32
|
derivePublicKey({ chainName, keyShare, }: {
|
|
26
33
|
chainName: string;
|
|
27
|
-
keyShare
|
|
28
|
-
}): Promise<
|
|
29
|
-
clientKeyGen({ chainName, roomId, serverKeygenIds, clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult, }: {
|
|
34
|
+
keyShare: ClientKeyShare;
|
|
35
|
+
}): Promise<EcdsaPublicKey | Uint8Array | undefined>;
|
|
36
|
+
clientKeyGen({ chainName, roomId, serverKeygenIds, clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult, thresholdSignatureScheme, }: {
|
|
30
37
|
chainName: string;
|
|
31
38
|
roomId: string;
|
|
32
39
|
serverKeygenIds: string[];
|
|
33
40
|
clientPrimaryKeygenInitResult: ClientInitKeygenResult;
|
|
34
41
|
clientSecondaryKeygenInitResult: ClientInitKeygenResult;
|
|
42
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
35
43
|
}): Promise<{
|
|
36
|
-
rawPublicKey:
|
|
44
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
|
|
37
45
|
primaryKeygenResult: EcdsaKeygenResult | BIP340KeygenResult;
|
|
38
46
|
secondaryKeygenResult: EcdsaKeygenResult | BIP340KeygenResult;
|
|
39
47
|
}>;
|
|
40
|
-
keyGen({ chainName }: {
|
|
48
|
+
keyGen({ chainName, thresholdSignatureScheme, }: {
|
|
41
49
|
chainName: string;
|
|
50
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
42
51
|
}): Promise<{
|
|
43
|
-
rawPublicKey:
|
|
52
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
|
|
44
53
|
primaryKeygenResult: EcdsaKeygenResult | BIP340KeygenResult;
|
|
45
54
|
secondaryKeygenResult: EcdsaKeygenResult | BIP340KeygenResult;
|
|
46
55
|
}>;
|
|
@@ -48,70 +57,68 @@ export declare class DynamicWalletClient {
|
|
|
48
57
|
walletId: string;
|
|
49
58
|
message: string;
|
|
50
59
|
}): Promise<any>;
|
|
51
|
-
clientSign({ chainName, message, roomId, }: {
|
|
60
|
+
clientSign({ chainName, message, roomId, keyShare, }: {
|
|
52
61
|
chainName: string;
|
|
53
62
|
message: string;
|
|
54
63
|
roomId: string;
|
|
64
|
+
keyShare: ClientKeyShare;
|
|
55
65
|
}): Promise<Uint8Array | EcdsaSignature>;
|
|
56
|
-
sign({
|
|
57
|
-
|
|
66
|
+
sign({ accountAddress, message, chainName, }: {
|
|
67
|
+
accountAddress?: string;
|
|
58
68
|
message: string;
|
|
59
|
-
}): Promise<Uint8Array | EcdsaSignature>;
|
|
60
|
-
refreshWalletAccountShares({ chainName, walletId, clientPrimaryKeyshare, clientSecondaryKeyshare, }: {
|
|
61
69
|
chainName: string;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
}): Promise<Uint8Array | EcdsaSignature>;
|
|
71
|
+
refreshWalletAccountShares({ accountAddress, }: {
|
|
72
|
+
accountAddress: string;
|
|
65
73
|
}): Promise<[EcdsaKeygenResult | BIP340KeygenResult, EcdsaKeygenResult | BIP340KeygenResult]>;
|
|
66
74
|
serverReshareRemainingParty({ walletId, clientKeygenIds, }: {
|
|
67
75
|
walletId: string;
|
|
68
76
|
clientKeygenIds: string[];
|
|
69
77
|
}): Promise<any>;
|
|
70
|
-
|
|
78
|
+
getExportId({ chainName, clientKeyShare, }: {
|
|
71
79
|
chainName: string;
|
|
72
|
-
|
|
80
|
+
clientKeyShare: EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
|
|
73
81
|
}): Promise<string>;
|
|
74
|
-
reshareRemainingParty({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
clientKeyshare: EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
|
|
82
|
+
reshareRemainingParty({ accountAddress, thresholdSignatureScheme, }: {
|
|
83
|
+
accountAddress: string;
|
|
84
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
78
85
|
}): Promise<[EcdsaKeygenResult | BIP340KeygenResult, EcdsaKeygenResult | BIP340KeygenResult]>;
|
|
79
|
-
|
|
86
|
+
exportKey({ accountAddress, chainName, }: {
|
|
87
|
+
accountAddress: string;
|
|
80
88
|
chainName: string;
|
|
81
|
-
clientKeyshare: EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
|
|
82
|
-
walletId: string;
|
|
83
89
|
}): Promise<{
|
|
84
90
|
derivedPrivateKey: string | undefined;
|
|
85
91
|
}>;
|
|
86
|
-
|
|
92
|
+
offlineExportKey({ chainName, keyShares, }: {
|
|
87
93
|
chainName: string;
|
|
88
|
-
keyShares:
|
|
94
|
+
keyShares: ClientKeyShare[];
|
|
89
95
|
}): Promise<{
|
|
90
96
|
derivedPrivateKey: string | undefined;
|
|
91
97
|
}>;
|
|
92
98
|
encryptKeyShare({ keyShare, password, }: {
|
|
93
|
-
keyShare:
|
|
99
|
+
keyShare: ClientKeyShare;
|
|
94
100
|
password?: string;
|
|
95
101
|
}): Promise<string>;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
keyShare: ClientKeyshare;
|
|
102
|
+
storeEncryptedBackupByWallet({ accountAddress, password, }: {
|
|
103
|
+
accountAddress: string;
|
|
99
104
|
password?: string;
|
|
100
105
|
}): Promise<any>;
|
|
101
106
|
decryptKeyShare({ keyShare, password, }: {
|
|
102
107
|
keyShare: string;
|
|
103
108
|
password?: string;
|
|
104
109
|
}): Promise<any>;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
keyShareId: string;
|
|
110
|
+
recoverEncryptedBackupByWallet({ accountAddress, password, keyShareIds, }: {
|
|
111
|
+
accountAddress: string;
|
|
108
112
|
password?: string;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
keyShareIds?: string[];
|
|
114
|
+
}): Promise<any[]>;
|
|
115
|
+
restoreBackupShare({ walletId, accountAddress, chainName, keyShare, thresholdSignatureScheme, }: {
|
|
116
|
+
walletId: string;
|
|
117
|
+
accountAddress: string;
|
|
118
|
+
chainName: string;
|
|
119
|
+
keyShare: ClientKeyShare;
|
|
120
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
112
121
|
}): void;
|
|
113
|
-
getClientShare(): Promise<ClientKeyshare | undefined>;
|
|
114
|
-
setClientShare(clientKeyshare: ClientKeyshare): Promise<void>;
|
|
115
122
|
backupFileToGoogleDrive({ oauthAccountId, fileName, jsonData, password, }: {
|
|
116
123
|
oauthAccountId: string;
|
|
117
124
|
fileName?: string;
|
|
@@ -122,13 +129,26 @@ export declare class DynamicWalletClient {
|
|
|
122
129
|
oauthAccountId: string;
|
|
123
130
|
name?: string;
|
|
124
131
|
password?: string;
|
|
125
|
-
}): Promise<
|
|
126
|
-
importRawPrivateKey({ chainName,
|
|
132
|
+
}): Promise<ClientKeyShare | null>;
|
|
133
|
+
importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, }: {
|
|
127
134
|
chainName: string;
|
|
128
|
-
walletId: string;
|
|
129
135
|
privateKey: string;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
137
|
+
}): Promise<{
|
|
138
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
|
|
139
|
+
primaryKeygenResult: ClientKeyShare;
|
|
140
|
+
secondaryKeygenResult: ClientKeyShare;
|
|
141
|
+
}>;
|
|
142
|
+
exportClientKeyshares({ accountAddress }: {
|
|
143
|
+
accountAddress?: string;
|
|
144
|
+
}): Promise<void>;
|
|
145
|
+
getClientKeyshares({ accountAddress }: {
|
|
146
|
+
accountAddress?: string;
|
|
147
|
+
}): Promise<ClientKeyShare[]>;
|
|
148
|
+
getWallet({ accountAddress }: {
|
|
149
|
+
accountAddress?: string;
|
|
150
|
+
}): Promise<WalletProperties>;
|
|
151
|
+
getWallets(): Promise<any>;
|
|
133
152
|
}
|
|
153
|
+
export {};
|
|
134
154
|
//# sourceMappingURL=client.d.ts.map
|
package/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,wBAAwB,EACxB,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACf,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAA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C,EAAE,MAAM,CAAC;KACnB;IAgBK,4BAA4B,CAAC,EACjC,cAAc,EACd,IAAsB,EACtB,QAAQ,GACT,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAmB5B,mBAAmB,CAAC,EACxB,SAAS,EACT,UAAU,EACV,wBAAwB,GACzB,EAAE;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,wBAAwB,EAAE,wBAAwB,CAAC;KACpD,GAAG,OAAO,CAAC;QACV,YAAY,EAAE,cAAc,GAAG,UAAU,GAAG,SAAS,CAAC;QACtD,mBAAmB,EAAE,cAAc,CAAC;QACpC,qBAAqB,EAAE,cAAc,CAAC;KACvC,CAAC;IA4EI,qBAAqB,CAAC,EAAE,cAAc,EAAE,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE;IAarE,kBAAkB,CAAC,EAAE,cAAc,EAAE,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE;IAKlE,SAAS,CAAC,EAAE,cAAc,EAAE,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE;IA4CzD,UAAU;CA0BjB"}
|
package/src/mpc/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BIP340InitKeygenResult, BIP340KeygenResult, Ed25519InitKeygenResult, EcdsaInitKeygenResult, EcdsaKeygenResult, Ed25519KeygenResult } from '@dynamic-labs-wallet/lib-mpc-web';
|
|
2
2
|
export type ClientInitKeygenResult = EcdsaInitKeygenResult | Ed25519InitKeygenResult | BIP340InitKeygenResult;
|
|
3
|
-
export type
|
|
3
|
+
export type ClientKeyShare = EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
|
|
4
4
|
export type { Ecdsa, Ed25519, BIP340, EcdsaPublicKey, EcdsaKeygenResult, Ed25519KeygenResult, BIP340KeygenResult, MessageHash, EcdsaSignature, } from '@dynamic-labs-wallet/lib-mpc-web';
|
|
5
5
|
//# sourceMappingURL=types.d.ts.map
|