@dynamic-labs-wallet/browser 0.0.45 → 0.0.47

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 CHANGED
@@ -40,6 +40,8 @@ const DEFAULT_LOG_LEVEL = 'INFO';
40
40
  const STORAGE_KEY = 'dynamic-waas-wallet-client';
41
41
  const CLIENT_KEYSHARE_EXPORT_FILENAME_PREFIX = 'dynamicWalletKeyShareBackup';
42
42
 
43
+ const logger = new logger$1.Logger('DynamicWaasWalletClient');
44
+
43
45
  const bytesToBase64 = (arr)=>{
44
46
  return btoa(Array.from(arr, (b)=>String.fromCharCode(b)).join(''));
45
47
  };
@@ -104,6 +106,35 @@ const getClientKeyShareBackupInfo = (params)=>{
104
106
  ...uniqueKeyShares
105
107
  ];
106
108
  };
109
+ const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
110
+ return new Promise((_, reject)=>setTimeout(()=>reject(new Error(`${activity} did not complete in ${timeInMs}ms`)), timeInMs));
111
+ };
112
+ /**
113
+ * Generic helper function to retry a promise-based operations
114
+ *
115
+ * @param operation - The async operation to retry
116
+ * @param config - Configuration options for retry behavior
117
+ * @returns Promise with the operation result
118
+ * @throws Last error encountered after all retries are exhausted
119
+ */ async function retryPromise(operation, { maxAttempts = 5, retryInterval = 500, operationName = 'operation', logContext = {} } = {}) {
120
+ let attempts = 0;
121
+ while(attempts < maxAttempts){
122
+ try {
123
+ return await operation();
124
+ } catch (error) {
125
+ attempts++;
126
+ if (attempts === maxAttempts) {
127
+ logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
128
+ error
129
+ }));
130
+ throw error;
131
+ }
132
+ await new Promise((resolve)=>setTimeout(resolve, retryInterval));
133
+ }
134
+ }
135
+ // TypeScript needs this even though it's unreachable
136
+ throw new Error('Unreachable code');
137
+ }
107
138
 
108
139
  const PBKDF2_ALGORITHM = 'PBKDF2';
109
140
  const PBKDF2_ITERATIONS = 100000;
@@ -360,8 +391,6 @@ var WalletOperation = /*#__PURE__*/ function(WalletOperation) {
360
391
  return WalletOperation;
361
392
  }({});
362
393
 
363
- const logger = new logger$1.Logger('DynamicWaasWalletClient');
364
-
365
394
  class DynamicWalletClient {
366
395
  async initialize() {
367
396
  if (this.initializePromise) {
@@ -389,13 +418,14 @@ class DynamicWalletClient {
389
418
  };
390
419
  }
391
420
  }
392
- async serverInitializeKeyGen({ chainName, clientKeygenIds, thresholdSignatureScheme, onError }) {
421
+ async serverInitializeKeyGen({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete }) {
393
422
  // Initialize keygen, create room, and create the wallet account on the server
394
423
  const data = await this.apiClient.createWalletAccount({
395
424
  chainName,
396
425
  clientKeygenIds,
397
426
  thresholdSignatureScheme,
398
- onError
427
+ onError,
428
+ onCeremonyComplete
399
429
  });
400
430
  return data;
401
431
  }
@@ -455,7 +485,7 @@ class DynamicWalletClient {
455
485
  clientKeygenResults
456
486
  };
457
487
  }
458
- async keyGen({ chainName, thresholdSignatureScheme, onError }) {
488
+ async keyGen({ chainName, thresholdSignatureScheme, onError, onCeremonyComplete }) {
459
489
  try {
460
490
  const clientKeygenInitResults = await this.clientInitializeKeyGen({
461
491
  chainName,
@@ -465,7 +495,8 @@ class DynamicWalletClient {
465
495
  const { roomId, serverKeygenIds } = await this.serverInitializeKeyGen({
466
496
  chainName,
467
497
  clientKeygenIds,
468
- thresholdSignatureScheme
498
+ thresholdSignatureScheme,
499
+ onCeremonyComplete
469
500
  });
470
501
  const { rawPublicKey, clientKeygenResults: clientKeyShares } = await this.clientKeyGen({
471
502
  chainName,
@@ -651,7 +682,6 @@ class DynamicWalletClient {
651
682
  shareCount: existingClientShareCount,
652
683
  password
653
684
  });
654
- console.log(`Resharing from ${oldThresholdSignatureScheme} to ${newThresholdSignatureScheme}`);
655
685
  const { newClientInitKeygenResults, newClientKeygenIds, existingClientKeygenIds, existingClientKeyShares } = await this.reshareStrategy({
656
686
  chainName,
657
687
  wallet,
@@ -687,8 +717,7 @@ class DynamicWalletClient {
687
717
  ...existingClientKeyShares.map((keyShare)=>mpcSigner.reshareRemainingParty(roomId, newMpcConfig.threshold, keyShare, allPartyKeygenIds))
688
718
  ]);
689
719
  this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
690
- clientKeyShares: reshareResults,
691
- clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
720
+ clientKeyShares: reshareResults
692
721
  });
693
722
  await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
694
723
  await this.storeEncryptedBackupByWallet({
@@ -776,27 +805,81 @@ class DynamicWalletClient {
776
805
  const serializedEncryptedKeyShare = Buffer.from(JSON.stringify(encryptedKeyShare)).toString('base64');
777
806
  return serializedEncryptedKeyShare;
778
807
  }
779
- async storeEncryptedBackupByWallet({ accountAddress, password = undefined }) {
780
- const encryptedKeyShares = await Promise.all(this.walletMap[accountAddress].clientKeyShares.map((keyShare)=>this.encryptKeyShare({
808
+ /**
809
+ * Encrypts and stores wallet key shares as backups.
810
+ *
811
+ * This method encrypts all client key shares for a specific wallet and stores them
812
+ * in Dynamic's backend. If Google Drive backup is already configured for this wallet,
813
+ * it will also update the backup in Google Drive.
814
+ *
815
+ * The method performs the following steps:
816
+ * 1. Encrypts all client key shares with the provided password (or environment ID if no password)
817
+ * 2. Stores the encrypted key shares in Dynamic's backend
818
+ * 3. If Google Drive backup exists, updates the backup there as well
819
+ * 4. Updates the local wallet map with the new backup information
820
+ * 5. Persists the updated wallet map to storage
821
+ *
822
+ * @param {Object} params - The parameters for the backup operation
823
+ * @param {string} params.accountAddress - The account address of the wallet to backup
824
+ * @param {string} [params.password] - Optional password for encrypting the key shares
825
+ */ async storeEncryptedBackupByWallet({ accountAddress, clientKeyShares = undefined, password = undefined }) {
826
+ const keySharesToBackup = clientKeyShares != null ? clientKeyShares : this.walletMap[accountAddress].clientKeyShares;
827
+ const encryptedKeyShares = await Promise.all(keySharesToBackup.map((keyShare)=>this.encryptKeyShare({
781
828
  keyShare,
782
829
  password
783
830
  })));
831
+ if (!this.walletMap[accountAddress].walletId) {
832
+ throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
833
+ }
784
834
  const data = await this.apiClient.storeEncryptedBackupByWallet({
785
835
  walletId: this.walletMap[accountAddress].walletId,
786
836
  encryptedKeyShares,
787
837
  passwordEncrypted: Boolean(password) && password !== this.environmentId
788
838
  });
839
+ const hasGoogleDriveBackup = this.walletMap[accountAddress].clientKeySharesBackupInfo.backups[core.BackupLocation.GOOGLE_DRIVE].length > 0;
840
+ if (hasGoogleDriveBackup) {
841
+ var _user_verifiedCredentials_find;
842
+ const user = await this.apiClient.getUser();
843
+ const oauthAccountId = user == null ? void 0 : (_user_verifiedCredentials_find = user.verifiedCredentials.find((credential)=>credential.oauthProvider === 'google')) == null ? void 0 : _user_verifiedCredentials_find.id;
844
+ const googleDriveKeyShareIds = await this.backupKeySharesToGoogleDrive({
845
+ accountAddress,
846
+ password,
847
+ oauthAccountId
848
+ });
849
+ data.keyShares.push({
850
+ backupLocation: core.BackupLocation.GOOGLE_DRIVE,
851
+ id: googleDriveKeyShareIds
852
+ });
853
+ }
854
+ const updatedBackupInfo = getClientKeyShareBackupInfo({
855
+ walletProperties: {
856
+ derivationPath: this.walletMap[accountAddress].derivationPath,
857
+ keyShares: data.keyShares,
858
+ thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme
859
+ }
860
+ });
789
861
  this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
790
- clientKeySharesBackupInfo: getClientKeyShareBackupInfo({
791
- walletProperties: {
792
- derivationPath: this.walletMap[accountAddress].derivationPath,
793
- keyShares: data.keyShares,
794
- thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme
795
- }
796
- })
862
+ clientKeySharesBackupInfo: updatedBackupInfo
797
863
  });
864
+ await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
798
865
  return data;
799
866
  }
867
+ async storeEncryptedBackupByWalletWithRetry({ accountAddress, clientKeyShares, password }) {
868
+ await retryPromise(()=>this.storeEncryptedBackupByWallet({
869
+ accountAddress,
870
+ clientKeyShares,
871
+ password
872
+ }), {
873
+ operationName: 'store encrypted backup',
874
+ logContext: {
875
+ walletAddress: accountAddress,
876
+ keyShares: clientKeyShares == null ? void 0 : clientKeyShares.map((keyShare)=>this.encryptKeyShare({
877
+ keyShare,
878
+ password
879
+ }))
880
+ }
881
+ });
882
+ }
800
883
  async updatePassword({ accountAddress, existingPassword, newPassword }) {
801
884
  await this.getWallet({
802
885
  accountAddress,
@@ -873,7 +956,6 @@ class DynamicWalletClient {
873
956
  }
874
957
  async restoreWallets() {
875
958
  const wallets = await this.storage.getItem(this.storageKey);
876
- console.log('local storage wallets', wallets);
877
959
  if (!wallets) {
878
960
  return;
879
961
  }
@@ -920,7 +1002,7 @@ class DynamicWalletClient {
920
1002
  }
921
1003
  };
922
1004
  // TODO: handle errors
923
- const [appUpload, personalUpload] = await Promise.all([
1005
+ await Promise.all([
924
1006
  uploadFileToGoogleDriveAppStorage({
925
1007
  accessToken,
926
1008
  fileName: fileName != null ? fileName : suggestedFileName,
@@ -932,13 +1014,13 @@ class DynamicWalletClient {
932
1014
  jsonData: backupData
933
1015
  })
934
1016
  ]);
935
- await this.apiClient.markKeySharesAsBackedUpGoogleDrive({
1017
+ const data = await this.apiClient.markKeySharesAsBackedUpGoogleDrive({
936
1018
  walletId: this.walletMap[accountAddress].walletId
937
1019
  });
938
- return {
939
- appUpload,
940
- personalUpload
941
- };
1020
+ const ids = data.keyShares.map((keyShare)=>keyShare.id);
1021
+ this.walletMap[accountAddress].clientKeySharesBackupInfo.backups[core.BackupLocation.GOOGLE_DRIVE] = ids;
1022
+ await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
1023
+ return ids;
942
1024
  }
943
1025
  async restoreBackupFromGoogleDrive({ accountAddress, oauthAccountId, name, password }) {
944
1026
  await this.getWallet({
@@ -973,7 +1055,7 @@ class DynamicWalletClient {
973
1055
  });
974
1056
  return decryptedKeyShares;
975
1057
  }
976
- async importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError }) {
1058
+ async importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError, onCeremonyComplete }) {
977
1059
  const mpcSigner = getMPCSigner({
978
1060
  chainName,
979
1061
  baseRelayUrl: this.baseMPCRelayApiUrl
@@ -987,7 +1069,8 @@ class DynamicWalletClient {
987
1069
  chainName,
988
1070
  clientKeygenIds,
989
1071
  thresholdSignatureScheme,
990
- onError
1072
+ onError,
1073
+ onCeremonyComplete
991
1074
  });
992
1075
  const { threshold } = core.getTSSConfig(thresholdSignatureScheme);
993
1076
  const clientKeygenResults = await Promise.all(clientKeygenInitResults.map(async (currentInit, index)=>{
@@ -1365,7 +1448,9 @@ exports.getMPCSigner = getMPCSigner;
1365
1448
  exports.isBrowser = isBrowser;
1366
1449
  exports.isHexString = isHexString;
1367
1450
  exports.mergeUniqueKeyShares = mergeUniqueKeyShares;
1451
+ exports.retryPromise = retryPromise;
1368
1452
  exports.stringToBytes = stringToBytes;
1453
+ exports.timeoutPromise = timeoutPromise;
1369
1454
  Object.keys(core).forEach(function (k) {
1370
1455
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1371
1456
  enumerable: true,
package/index.esm.js CHANGED
@@ -40,6 +40,8 @@ const DEFAULT_LOG_LEVEL = 'INFO';
40
40
  const STORAGE_KEY = 'dynamic-waas-wallet-client';
41
41
  const CLIENT_KEYSHARE_EXPORT_FILENAME_PREFIX = 'dynamicWalletKeyShareBackup';
42
42
 
43
+ const logger = new Logger('DynamicWaasWalletClient');
44
+
43
45
  const bytesToBase64 = (arr)=>{
44
46
  return btoa(Array.from(arr, (b)=>String.fromCharCode(b)).join(''));
45
47
  };
@@ -104,6 +106,35 @@ const getClientKeyShareBackupInfo = (params)=>{
104
106
  ...uniqueKeyShares
105
107
  ];
106
108
  };
109
+ const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
110
+ return new Promise((_, reject)=>setTimeout(()=>reject(new Error(`${activity} did not complete in ${timeInMs}ms`)), timeInMs));
111
+ };
112
+ /**
113
+ * Generic helper function to retry a promise-based operations
114
+ *
115
+ * @param operation - The async operation to retry
116
+ * @param config - Configuration options for retry behavior
117
+ * @returns Promise with the operation result
118
+ * @throws Last error encountered after all retries are exhausted
119
+ */ async function retryPromise(operation, { maxAttempts = 5, retryInterval = 500, operationName = 'operation', logContext = {} } = {}) {
120
+ let attempts = 0;
121
+ while(attempts < maxAttempts){
122
+ try {
123
+ return await operation();
124
+ } catch (error) {
125
+ attempts++;
126
+ if (attempts === maxAttempts) {
127
+ logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
128
+ error
129
+ }));
130
+ throw error;
131
+ }
132
+ await new Promise((resolve)=>setTimeout(resolve, retryInterval));
133
+ }
134
+ }
135
+ // TypeScript needs this even though it's unreachable
136
+ throw new Error('Unreachable code');
137
+ }
107
138
 
108
139
  const PBKDF2_ALGORITHM = 'PBKDF2';
109
140
  const PBKDF2_ITERATIONS = 100000;
@@ -360,8 +391,6 @@ var WalletOperation = /*#__PURE__*/ function(WalletOperation) {
360
391
  return WalletOperation;
361
392
  }({});
362
393
 
363
- const logger = new Logger('DynamicWaasWalletClient');
364
-
365
394
  class DynamicWalletClient {
366
395
  async initialize() {
367
396
  if (this.initializePromise) {
@@ -389,13 +418,14 @@ class DynamicWalletClient {
389
418
  };
390
419
  }
391
420
  }
392
- async serverInitializeKeyGen({ chainName, clientKeygenIds, thresholdSignatureScheme, onError }) {
421
+ async serverInitializeKeyGen({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete }) {
393
422
  // Initialize keygen, create room, and create the wallet account on the server
394
423
  const data = await this.apiClient.createWalletAccount({
395
424
  chainName,
396
425
  clientKeygenIds,
397
426
  thresholdSignatureScheme,
398
- onError
427
+ onError,
428
+ onCeremonyComplete
399
429
  });
400
430
  return data;
401
431
  }
@@ -455,7 +485,7 @@ class DynamicWalletClient {
455
485
  clientKeygenResults
456
486
  };
457
487
  }
458
- async keyGen({ chainName, thresholdSignatureScheme, onError }) {
488
+ async keyGen({ chainName, thresholdSignatureScheme, onError, onCeremonyComplete }) {
459
489
  try {
460
490
  const clientKeygenInitResults = await this.clientInitializeKeyGen({
461
491
  chainName,
@@ -465,7 +495,8 @@ class DynamicWalletClient {
465
495
  const { roomId, serverKeygenIds } = await this.serverInitializeKeyGen({
466
496
  chainName,
467
497
  clientKeygenIds,
468
- thresholdSignatureScheme
498
+ thresholdSignatureScheme,
499
+ onCeremonyComplete
469
500
  });
470
501
  const { rawPublicKey, clientKeygenResults: clientKeyShares } = await this.clientKeyGen({
471
502
  chainName,
@@ -651,7 +682,6 @@ class DynamicWalletClient {
651
682
  shareCount: existingClientShareCount,
652
683
  password
653
684
  });
654
- console.log(`Resharing from ${oldThresholdSignatureScheme} to ${newThresholdSignatureScheme}`);
655
685
  const { newClientInitKeygenResults, newClientKeygenIds, existingClientKeygenIds, existingClientKeyShares } = await this.reshareStrategy({
656
686
  chainName,
657
687
  wallet,
@@ -687,8 +717,7 @@ class DynamicWalletClient {
687
717
  ...existingClientKeyShares.map((keyShare)=>mpcSigner.reshareRemainingParty(roomId, newMpcConfig.threshold, keyShare, allPartyKeygenIds))
688
718
  ]);
689
719
  this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
690
- clientKeyShares: reshareResults,
691
- clientKeySharesBackupInfo: getClientKeyShareBackupInfo()
720
+ clientKeyShares: reshareResults
692
721
  });
693
722
  await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
694
723
  await this.storeEncryptedBackupByWallet({
@@ -776,27 +805,81 @@ class DynamicWalletClient {
776
805
  const serializedEncryptedKeyShare = Buffer.from(JSON.stringify(encryptedKeyShare)).toString('base64');
777
806
  return serializedEncryptedKeyShare;
778
807
  }
779
- async storeEncryptedBackupByWallet({ accountAddress, password = undefined }) {
780
- const encryptedKeyShares = await Promise.all(this.walletMap[accountAddress].clientKeyShares.map((keyShare)=>this.encryptKeyShare({
808
+ /**
809
+ * Encrypts and stores wallet key shares as backups.
810
+ *
811
+ * This method encrypts all client key shares for a specific wallet and stores them
812
+ * in Dynamic's backend. If Google Drive backup is already configured for this wallet,
813
+ * it will also update the backup in Google Drive.
814
+ *
815
+ * The method performs the following steps:
816
+ * 1. Encrypts all client key shares with the provided password (or environment ID if no password)
817
+ * 2. Stores the encrypted key shares in Dynamic's backend
818
+ * 3. If Google Drive backup exists, updates the backup there as well
819
+ * 4. Updates the local wallet map with the new backup information
820
+ * 5. Persists the updated wallet map to storage
821
+ *
822
+ * @param {Object} params - The parameters for the backup operation
823
+ * @param {string} params.accountAddress - The account address of the wallet to backup
824
+ * @param {string} [params.password] - Optional password for encrypting the key shares
825
+ */ async storeEncryptedBackupByWallet({ accountAddress, clientKeyShares = undefined, password = undefined }) {
826
+ const keySharesToBackup = clientKeyShares != null ? clientKeyShares : this.walletMap[accountAddress].clientKeyShares;
827
+ const encryptedKeyShares = await Promise.all(keySharesToBackup.map((keyShare)=>this.encryptKeyShare({
781
828
  keyShare,
782
829
  password
783
830
  })));
831
+ if (!this.walletMap[accountAddress].walletId) {
832
+ throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
833
+ }
784
834
  const data = await this.apiClient.storeEncryptedBackupByWallet({
785
835
  walletId: this.walletMap[accountAddress].walletId,
786
836
  encryptedKeyShares,
787
837
  passwordEncrypted: Boolean(password) && password !== this.environmentId
788
838
  });
839
+ const hasGoogleDriveBackup = this.walletMap[accountAddress].clientKeySharesBackupInfo.backups[BackupLocation.GOOGLE_DRIVE].length > 0;
840
+ if (hasGoogleDriveBackup) {
841
+ var _user_verifiedCredentials_find;
842
+ const user = await this.apiClient.getUser();
843
+ const oauthAccountId = user == null ? void 0 : (_user_verifiedCredentials_find = user.verifiedCredentials.find((credential)=>credential.oauthProvider === 'google')) == null ? void 0 : _user_verifiedCredentials_find.id;
844
+ const googleDriveKeyShareIds = await this.backupKeySharesToGoogleDrive({
845
+ accountAddress,
846
+ password,
847
+ oauthAccountId
848
+ });
849
+ data.keyShares.push({
850
+ backupLocation: BackupLocation.GOOGLE_DRIVE,
851
+ id: googleDriveKeyShareIds
852
+ });
853
+ }
854
+ const updatedBackupInfo = getClientKeyShareBackupInfo({
855
+ walletProperties: {
856
+ derivationPath: this.walletMap[accountAddress].derivationPath,
857
+ keyShares: data.keyShares,
858
+ thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme
859
+ }
860
+ });
789
861
  this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
790
- clientKeySharesBackupInfo: getClientKeyShareBackupInfo({
791
- walletProperties: {
792
- derivationPath: this.walletMap[accountAddress].derivationPath,
793
- keyShares: data.keyShares,
794
- thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme
795
- }
796
- })
862
+ clientKeySharesBackupInfo: updatedBackupInfo
797
863
  });
864
+ await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
798
865
  return data;
799
866
  }
867
+ async storeEncryptedBackupByWalletWithRetry({ accountAddress, clientKeyShares, password }) {
868
+ await retryPromise(()=>this.storeEncryptedBackupByWallet({
869
+ accountAddress,
870
+ clientKeyShares,
871
+ password
872
+ }), {
873
+ operationName: 'store encrypted backup',
874
+ logContext: {
875
+ walletAddress: accountAddress,
876
+ keyShares: clientKeyShares == null ? void 0 : clientKeyShares.map((keyShare)=>this.encryptKeyShare({
877
+ keyShare,
878
+ password
879
+ }))
880
+ }
881
+ });
882
+ }
800
883
  async updatePassword({ accountAddress, existingPassword, newPassword }) {
801
884
  await this.getWallet({
802
885
  accountAddress,
@@ -873,7 +956,6 @@ class DynamicWalletClient {
873
956
  }
874
957
  async restoreWallets() {
875
958
  const wallets = await this.storage.getItem(this.storageKey);
876
- console.log('local storage wallets', wallets);
877
959
  if (!wallets) {
878
960
  return;
879
961
  }
@@ -920,7 +1002,7 @@ class DynamicWalletClient {
920
1002
  }
921
1003
  };
922
1004
  // TODO: handle errors
923
- const [appUpload, personalUpload] = await Promise.all([
1005
+ await Promise.all([
924
1006
  uploadFileToGoogleDriveAppStorage({
925
1007
  accessToken,
926
1008
  fileName: fileName != null ? fileName : suggestedFileName,
@@ -932,13 +1014,13 @@ class DynamicWalletClient {
932
1014
  jsonData: backupData
933
1015
  })
934
1016
  ]);
935
- await this.apiClient.markKeySharesAsBackedUpGoogleDrive({
1017
+ const data = await this.apiClient.markKeySharesAsBackedUpGoogleDrive({
936
1018
  walletId: this.walletMap[accountAddress].walletId
937
1019
  });
938
- return {
939
- appUpload,
940
- personalUpload
941
- };
1020
+ const ids = data.keyShares.map((keyShare)=>keyShare.id);
1021
+ this.walletMap[accountAddress].clientKeySharesBackupInfo.backups[BackupLocation.GOOGLE_DRIVE] = ids;
1022
+ await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
1023
+ return ids;
942
1024
  }
943
1025
  async restoreBackupFromGoogleDrive({ accountAddress, oauthAccountId, name, password }) {
944
1026
  await this.getWallet({
@@ -973,7 +1055,7 @@ class DynamicWalletClient {
973
1055
  });
974
1056
  return decryptedKeyShares;
975
1057
  }
976
- async importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError }) {
1058
+ async importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError, onCeremonyComplete }) {
977
1059
  const mpcSigner = getMPCSigner({
978
1060
  chainName,
979
1061
  baseRelayUrl: this.baseMPCRelayApiUrl
@@ -987,7 +1069,8 @@ class DynamicWalletClient {
987
1069
  chainName,
988
1070
  clientKeygenIds,
989
1071
  thresholdSignatureScheme,
990
- onError
1072
+ onError,
1073
+ onCeremonyComplete
991
1074
  });
992
1075
  const { threshold } = getTSSConfig(thresholdSignatureScheme);
993
1076
  const clientKeygenResults = await Promise.all(clientKeygenInitResults.map(async (currentInit, index)=>{
@@ -1305,4 +1388,4 @@ class DynamicWalletClient {
1305
1388
  }
1306
1389
  }
1307
1390
 
1308
- export { DynamicWalletClient, WalletOperation, base64ToBytes, bytesToBase64, ensureBase64Padding, getClientKeyShareBackupInfo, getClientKeyShareExportFileName, getMPCSignatureScheme, getMPCSigner, isBrowser, isHexString, mergeUniqueKeyShares, stringToBytes };
1391
+ export { DynamicWalletClient, WalletOperation, base64ToBytes, bytesToBase64, ensureBase64Padding, getClientKeyShareBackupInfo, getClientKeyShareExportFileName, getMPCSignatureScheme, getMPCSigner, isBrowser, isHexString, mergeUniqueKeyShares, retryPromise, stringToBytes, timeoutPromise };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/browser",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
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.45",
6
+ "@dynamic-labs-wallet/core": "0.0.47",
7
7
  "@dynamic-labs/logger": "^4.5.1"
8
8
  },
9
9
  "files": [
@@ -1 +1 @@
1
- {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/backup/encryption.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,cAAc,MAAM,CAAC;AA4BlC,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;;;;EA4BA,CAAC;AAEF,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAC;CAClB,oBA0BA,CAAC"}
1
+ {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/backup/encryption.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,cAAc,MAAM,CAAC;AAiClC,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;;;;EA4BA,CAAC;AAEF,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAC;CAClB,oBA0BA,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"googleDrive.d.ts","sourceRoot":"","sources":["../../../src/backup/providers/googleDrive.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iCAAiC,yCAI3C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAEF,eAAO,MAAM,+BAA+B,yCAIzC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAiDF,eAAO,MAAM,wBAAwB,2BAGlC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,iBAsBA,CAAC;AAEF,eAAO,MAAM,2BAA2B,2BAGrC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAiCzB,CAAC"}
1
+ {"version":3,"file":"googleDrive.d.ts","sourceRoot":"","sources":["../../../src/backup/providers/googleDrive.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iCAAiC,yCAI3C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAEF,eAAO,MAAM,+BAA+B,yCAIzC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAgDF,eAAO,MAAM,wBAAwB,2BAGlC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,iBAsBA,CAAC;AAEF,eAAO,MAAM,2BAA2B,2BAGrC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAiCzB,CAAC"}
package/src/client.d.ts CHANGED
@@ -22,11 +22,12 @@ export declare class DynamicWalletClient {
22
22
  * Client initialization logic
23
23
  */
24
24
  private _initialize;
25
- serverInitializeKeyGen({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, }: {
25
+ serverInitializeKeyGen({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
26
26
  chainName: string;
27
27
  clientKeygenIds: string[];
28
28
  thresholdSignatureScheme: ThresholdSignatureScheme;
29
29
  onError?: (error: Error) => void;
30
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
30
31
  }): Promise<import("build/core/src/types").KeygenCompleteResponse>;
31
32
  clientInitializeKeyGen({ chainName, thresholdSignatureScheme, }: {
32
33
  chainName: string;
@@ -47,10 +48,11 @@ export declare class DynamicWalletClient {
47
48
  rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
48
49
  clientKeygenResults: ClientKeyShare[];
49
50
  }>;
50
- keyGen({ chainName, thresholdSignatureScheme, onError, }: {
51
+ keyGen({ chainName, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
51
52
  chainName: string;
52
53
  thresholdSignatureScheme: ThresholdSignatureScheme;
53
54
  onError?: (error: Error) => void;
55
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
54
56
  }): Promise<{
55
57
  rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
56
58
  clientKeyShares: ClientKeyShare[];
@@ -131,10 +133,34 @@ export declare class DynamicWalletClient {
131
133
  keyShare: ClientKeyShare;
132
134
  password?: string;
133
135
  }): Promise<string>;
134
- storeEncryptedBackupByWallet({ accountAddress, password, }: {
136
+ /**
137
+ * Encrypts and stores wallet key shares as backups.
138
+ *
139
+ * This method encrypts all client key shares for a specific wallet and stores them
140
+ * in Dynamic's backend. If Google Drive backup is already configured for this wallet,
141
+ * it will also update the backup in Google Drive.
142
+ *
143
+ * The method performs the following steps:
144
+ * 1. Encrypts all client key shares with the provided password (or environment ID if no password)
145
+ * 2. Stores the encrypted key shares in Dynamic's backend
146
+ * 3. If Google Drive backup exists, updates the backup there as well
147
+ * 4. Updates the local wallet map with the new backup information
148
+ * 5. Persists the updated wallet map to storage
149
+ *
150
+ * @param {Object} params - The parameters for the backup operation
151
+ * @param {string} params.accountAddress - The account address of the wallet to backup
152
+ * @param {string} [params.password] - Optional password for encrypting the key shares
153
+ */
154
+ storeEncryptedBackupByWallet({ accountAddress, clientKeyShares, password, }: {
135
155
  accountAddress: string;
156
+ clientKeyShares?: ClientKeyShare[];
136
157
  password?: string;
137
158
  }): Promise<any>;
159
+ storeEncryptedBackupByWalletWithRetry({ accountAddress, clientKeyShares, password, }: {
160
+ accountAddress: string;
161
+ clientKeyShares?: ClientKeyShare[];
162
+ password?: string;
163
+ }): Promise<void>;
138
164
  updatePassword({ accountAddress, existingPassword, newPassword, }: {
139
165
  accountAddress: string;
140
166
  existingPassword?: string;
@@ -178,21 +204,19 @@ export declare class DynamicWalletClient {
178
204
  fileName?: string;
179
205
  oauthAccountId: string;
180
206
  password?: string;
181
- }): Promise<{
182
- appUpload: any;
183
- personalUpload: any;
184
- }>;
207
+ }): Promise<any>;
185
208
  restoreBackupFromGoogleDrive({ accountAddress, oauthAccountId, name, password, }: {
186
209
  accountAddress: string;
187
210
  oauthAccountId: string;
188
211
  name?: string;
189
212
  password?: string;
190
213
  }): Promise<ClientKeyShare[] | null>;
191
- importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError, }: {
214
+ importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
192
215
  chainName: string;
193
216
  privateKey: string;
194
217
  thresholdSignatureScheme: ThresholdSignatureScheme;
195
218
  onError?: (error: Error) => void;
219
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
196
220
  }): Promise<{
197
221
  rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
198
222
  clientKeyShares: ClientKeyShare[];
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,EACxB,gBAAgB,EAIhB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAoBrE,OAAO,EAGL,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAC;AASjB,qBAAa,mBAAmB;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC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constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAExC,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAExD,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAElE,eAAO,MAAM,sCAAsC,gCAAgC,CAAC;AAEpF,eAAO,MAAM,iCAAiC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAKtE,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAItE,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../packages/src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAExC,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAExD,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAElE,eAAO,MAAM,sCAAsC,gCACpB,CAAC;AAEhC,eAAO,MAAM,iCAAiC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAKtE,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAItE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mpc/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,CAAC;AAGrB,YAAY,EACV,KAAK,EACL,OAAO,EACP,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mpc/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,CAAC;AAEvB,YAAY,EACV,KAAK,EACL,OAAO,EACP,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,eAAe,CAAC"}
package/src/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { ThresholdSignatureScheme } from "@dynamic-labs-wallet/core";
2
- import { KeyShareBackupInfo, WaasWalletProperties } from "./types";
3
- import { ClientKeyShare } from "./mpc/types";
1
+ import { ThresholdSignatureScheme } from '@dynamic-labs-wallet/core';
2
+ import { KeyShareBackupInfo, WaasWalletProperties } from './types';
3
+ import { ClientKeyShare } from './mpc/types';
4
4
  export declare const bytesToBase64: (arr: Uint8Array) => string;
5
5
  export declare const stringToBytes: (str: string) => Uint8Array;
6
6
  export declare const base64ToBytes: (base64: string) => Uint8Array;
@@ -21,4 +21,24 @@ export declare const getClientKeyShareBackupInfo: (params?: {
21
21
  * @returns Array of merged unique keyshares
22
22
  */
23
23
  export declare const mergeUniqueKeyShares: (existingKeyShares: ClientKeyShare[], newKeyShares: ClientKeyShare[]) => ClientKeyShare[];
24
+ export declare const timeoutPromise: ({ timeInMs, activity, }: {
25
+ timeInMs: number;
26
+ activity?: string;
27
+ }) => Promise<unknown>;
28
+ interface RetryConfig {
29
+ maxAttempts?: number;
30
+ retryInterval?: number;
31
+ operationName?: string;
32
+ logContext?: Record<string, unknown>;
33
+ }
34
+ /**
35
+ * Generic helper function to retry a promise-based operations
36
+ *
37
+ * @param operation - The async operation to retry
38
+ * @param config - Configuration options for retry behavior
39
+ * @returns Promise with the operation result
40
+ * @throws Last error encountered after all retries are exhausted
41
+ */
42
+ export declare function retryPromise<T>(operation: () => Promise<T>, { maxAttempts, retryInterval, operationName, logContext, }?: RetryConfig): Promise<T>;
43
+ export {};
24
44
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,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,SAAS,eAAsC,CAAC;AAE7D,eAAO,MAAM,WAAW,QAAS,MAAM,YAKtC,CAAC;AAEF,eAAO,MAAM,+BAA+B,kDAGzC;IACD,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,cAAc,EAAE,MAAM,CAAC;CACxB,WAEE,CAAC;AAEJ,eAAO,MAAM,2BAA2B,YAAa;IACnD,gBAAgB,EAAE,oBAAoB,CAAC;CACxC,KAAG,kBA4BH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,sBACZ,cAAc,EAAE,gBACrB,cAAc,EAAE,KAC7B,cAAc,EAchB,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot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