@dynamic-labs-wallet/browser 0.0.33 → 0.0.34
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 +181 -35
- package/index.esm.js +181 -35
- package/package.json +2 -2
- package/src/client.d.ts +57 -10
- package/src/client.d.ts.map +1 -1
- package/src/types.d.ts +2 -1
- package/src/types.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -356,6 +356,7 @@ var WalletOperation = /*#__PURE__*/ function(WalletOperation) {
|
|
|
356
356
|
WalletOperation["REFRESH"] = "REFRESH";
|
|
357
357
|
WalletOperation["RESHARE"] = "RESHARE";
|
|
358
358
|
WalletOperation["EXPORT_PRIVATE_KEY"] = "EXPORT_PRIVATE_KEY";
|
|
359
|
+
WalletOperation["NO_OPERATION"] = "NO_OPERATION";
|
|
359
360
|
return WalletOperation;
|
|
360
361
|
}({});
|
|
361
362
|
|
|
@@ -525,9 +526,16 @@ class DynamicWalletClient {
|
|
|
525
526
|
}
|
|
526
527
|
}
|
|
527
528
|
//todo: need to modify with imported flag
|
|
528
|
-
async sign({ accountAddress, message, chainName }) {
|
|
529
|
+
async sign({ accountAddress, message, chainName, password = undefined }) {
|
|
530
|
+
await this.verifyPassword({
|
|
531
|
+
accountAddress,
|
|
532
|
+
password,
|
|
533
|
+
walletOperation: WalletOperation.SIGN_MESSAGE
|
|
534
|
+
});
|
|
529
535
|
const wallet = await this.getWallet({
|
|
530
|
-
accountAddress
|
|
536
|
+
accountAddress,
|
|
537
|
+
password,
|
|
538
|
+
walletOperation: WalletOperation.SIGN_MESSAGE
|
|
531
539
|
});
|
|
532
540
|
// Perform the server sign
|
|
533
541
|
const data = await this.serverSign({
|
|
@@ -545,11 +553,17 @@ class DynamicWalletClient {
|
|
|
545
553
|
});
|
|
546
554
|
return signature;
|
|
547
555
|
}
|
|
548
|
-
async refreshWalletAccountShares({ accountAddress, chainName }) {
|
|
549
|
-
|
|
556
|
+
async refreshWalletAccountShares({ accountAddress, chainName, password = undefined }) {
|
|
557
|
+
await this.verifyPassword({
|
|
550
558
|
accountAddress,
|
|
559
|
+
password,
|
|
551
560
|
walletOperation: WalletOperation.REFRESH
|
|
552
561
|
});
|
|
562
|
+
const wallet = await this.getWallet({
|
|
563
|
+
accountAddress,
|
|
564
|
+
walletOperation: WalletOperation.REFRESH,
|
|
565
|
+
password
|
|
566
|
+
});
|
|
553
567
|
const mpcSigner = getMPCSigner({
|
|
554
568
|
chainName,
|
|
555
569
|
baseRelayUrl: this.baseMPCRelayApiUrl
|
|
@@ -565,7 +579,7 @@ class DynamicWalletClient {
|
|
|
565
579
|
});
|
|
566
580
|
await this.storeEncryptedBackupByWallet({
|
|
567
581
|
accountAddress,
|
|
568
|
-
password:
|
|
582
|
+
password: password != null ? password : this.environmentId
|
|
569
583
|
});
|
|
570
584
|
return refreshResults;
|
|
571
585
|
}
|
|
@@ -618,7 +632,12 @@ class DynamicWalletClient {
|
|
|
618
632
|
existingClientKeyShares
|
|
619
633
|
};
|
|
620
634
|
}
|
|
621
|
-
async reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme }) {
|
|
635
|
+
async reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password = undefined }) {
|
|
636
|
+
await this.verifyPassword({
|
|
637
|
+
accountAddress,
|
|
638
|
+
password,
|
|
639
|
+
walletOperation: WalletOperation.RESHARE
|
|
640
|
+
});
|
|
622
641
|
const { existingClientShareCount } = core.getReshareConfig({
|
|
623
642
|
oldThresholdSignatureScheme,
|
|
624
643
|
newThresholdSignatureScheme
|
|
@@ -626,7 +645,8 @@ class DynamicWalletClient {
|
|
|
626
645
|
const wallet = await this.getWallet({
|
|
627
646
|
accountAddress,
|
|
628
647
|
walletOperation: WalletOperation.RESHARE,
|
|
629
|
-
shareCount: existingClientShareCount
|
|
648
|
+
shareCount: existingClientShareCount,
|
|
649
|
+
password
|
|
630
650
|
});
|
|
631
651
|
console.log(`Resharing from ${oldThresholdSignatureScheme} to ${newThresholdSignatureScheme}`);
|
|
632
652
|
const { newClientInitKeygenResults, newClientKeygenIds, existingClientKeygenIds, existingClientKeyShares } = await this.reshareStrategy({
|
|
@@ -668,13 +688,15 @@ class DynamicWalletClient {
|
|
|
668
688
|
});
|
|
669
689
|
await this.storeEncryptedBackupByWallet({
|
|
670
690
|
accountAddress,
|
|
671
|
-
password
|
|
691
|
+
password
|
|
672
692
|
});
|
|
673
693
|
return reshareResults;
|
|
674
694
|
}
|
|
675
|
-
async exportKey({ accountAddress, chainName }) {
|
|
695
|
+
async exportKey({ accountAddress, chainName, password = undefined }) {
|
|
676
696
|
const wallet = await this.getWallet({
|
|
677
|
-
accountAddress
|
|
697
|
+
accountAddress,
|
|
698
|
+
password,
|
|
699
|
+
walletOperation: WalletOperation.EXPORT_PRIVATE_KEY
|
|
678
700
|
});
|
|
679
701
|
const mpcSigner = getMPCSigner({
|
|
680
702
|
chainName,
|
|
@@ -749,9 +771,11 @@ class DynamicWalletClient {
|
|
|
749
771
|
const serializedEncryptedKeyShare = Buffer.from(JSON.stringify(encryptedKeyShare)).toString('base64');
|
|
750
772
|
return serializedEncryptedKeyShare;
|
|
751
773
|
}
|
|
752
|
-
async storeEncryptedBackupByWallet({ accountAddress, password }) {
|
|
774
|
+
async storeEncryptedBackupByWallet({ accountAddress, password = undefined, walletOperation = WalletOperation.REACH_ALL_PARTIES }) {
|
|
753
775
|
await this.getWallet({
|
|
754
|
-
accountAddress
|
|
776
|
+
accountAddress,
|
|
777
|
+
password,
|
|
778
|
+
walletOperation
|
|
755
779
|
});
|
|
756
780
|
const encryptedKeyShares = await Promise.all(this.walletMap[accountAddress].clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
757
781
|
keyShare,
|
|
@@ -764,6 +788,17 @@ class DynamicWalletClient {
|
|
|
764
788
|
});
|
|
765
789
|
return data;
|
|
766
790
|
}
|
|
791
|
+
async updatePassword({ accountAddress, existingPassword, newPassword }) {
|
|
792
|
+
await this.getWallet({
|
|
793
|
+
accountAddress,
|
|
794
|
+
password: existingPassword,
|
|
795
|
+
walletOperation: WalletOperation.REACH_ALL_PARTIES
|
|
796
|
+
});
|
|
797
|
+
await this.storeEncryptedBackupByWallet({
|
|
798
|
+
accountAddress,
|
|
799
|
+
password: newPassword
|
|
800
|
+
});
|
|
801
|
+
}
|
|
767
802
|
async decryptKeyShare({ keyShare, password }) {
|
|
768
803
|
const decodedKeyShare = JSON.parse(Buffer.from(keyShare, 'base64').toString());
|
|
769
804
|
const decryptedKeyShare = await decryptData({
|
|
@@ -782,29 +817,34 @@ class DynamicWalletClient {
|
|
|
782
817
|
* @param thresholdSignatureScheme - The signature scheme being used (2-of-2, 2-of-3, etc)
|
|
783
818
|
* @param walletOperation - The operation being performed (REFRESH, SIGN_MESSAGE, etc)
|
|
784
819
|
* @param shareCount - The number of shares to recover if specified for reshare operations
|
|
785
|
-
* @returns Object mapping backup locations to arrays of share IDs to recover
|
|
786
|
-
|
|
820
|
+
* @returns @shares: Object mapping backup locations to arrays of share IDs to recover
|
|
821
|
+
* @returns @requiredShareCount: The number of shares required to recover
|
|
822
|
+
*/ recoverStrategy({ clientKeyShareBackupInfo, thresholdSignatureScheme, walletOperation, shareCount = undefined }) {
|
|
787
823
|
const { backups } = clientKeyShareBackupInfo;
|
|
788
824
|
const { clientThreshold } = core.MPC_CONFIG[thresholdSignatureScheme];
|
|
789
|
-
let
|
|
790
|
-
// Override
|
|
825
|
+
let requiredShareCount = walletOperation === WalletOperation.REFRESH || walletOperation === WalletOperation.REACH_ALL_PARTIES || walletOperation === WalletOperation.RESHARE ? clientThreshold : 1;
|
|
826
|
+
// Override requiredShareCount if shareCount is provided
|
|
791
827
|
if (shareCount !== undefined) {
|
|
792
|
-
|
|
828
|
+
requiredShareCount = shareCount;
|
|
793
829
|
}
|
|
794
|
-
const dynamicShares = backups[core.BackupLocation.DYNAMIC].slice(0,
|
|
830
|
+
const dynamicShares = backups[core.BackupLocation.DYNAMIC].slice(0, requiredShareCount);
|
|
795
831
|
return {
|
|
796
|
-
|
|
832
|
+
shares: {
|
|
833
|
+
[core.BackupLocation.DYNAMIC]: dynamicShares
|
|
834
|
+
},
|
|
835
|
+
requiredShareCount
|
|
797
836
|
};
|
|
798
837
|
}
|
|
799
838
|
async recoverEncryptedBackupByWallet({ accountAddress, password, walletOperation, shareCount = undefined }) {
|
|
800
839
|
const wallet = this.walletMap[accountAddress];
|
|
801
840
|
this.logger.debug(`recoverEncryptedBackupByWallet wallet: ${walletOperation}`, wallet);
|
|
802
|
-
const {
|
|
841
|
+
const { shares } = this.recoverStrategy({
|
|
803
842
|
clientKeyShareBackupInfo: wallet.clientKeySharesBackupInfo,
|
|
804
843
|
thresholdSignatureScheme: wallet.thresholdSignatureScheme,
|
|
805
844
|
walletOperation,
|
|
806
845
|
shareCount
|
|
807
846
|
});
|
|
847
|
+
const { dynamic: dynamicKeyShareIds } = shares;
|
|
808
848
|
const data = await this.apiClient.recoverEncryptedBackupByWallet({
|
|
809
849
|
walletId: wallet.walletId,
|
|
810
850
|
keyShareIds: dynamicKeyShareIds
|
|
@@ -831,7 +871,8 @@ class DynamicWalletClient {
|
|
|
831
871
|
async backupKeySharesToGoogleDrive({ accountAddress, fileName, oauthAccountId, password }) {
|
|
832
872
|
await this.getWallet({
|
|
833
873
|
accountAddress,
|
|
834
|
-
walletOperation: WalletOperation.REACH_ALL_PARTIES
|
|
874
|
+
walletOperation: WalletOperation.REACH_ALL_PARTIES,
|
|
875
|
+
password
|
|
835
876
|
});
|
|
836
877
|
const clientKeyShares = this.walletMap[accountAddress].clientKeyShares;
|
|
837
878
|
if (clientKeyShares.length === 0) {
|
|
@@ -965,13 +1006,20 @@ class DynamicWalletClient {
|
|
|
965
1006
|
clientKeyShares: clientKeygenResults
|
|
966
1007
|
};
|
|
967
1008
|
}
|
|
968
|
-
async exportClientKeyshares({ accountAddress }) {
|
|
969
|
-
await this.
|
|
1009
|
+
async exportClientKeyshares({ accountAddress, password }) {
|
|
1010
|
+
await this.verifyPassword({
|
|
970
1011
|
accountAddress,
|
|
1012
|
+
password,
|
|
971
1013
|
walletOperation: WalletOperation.REACH_ALL_PARTIES
|
|
972
1014
|
});
|
|
1015
|
+
await this.getWallet({
|
|
1016
|
+
accountAddress,
|
|
1017
|
+
walletOperation: WalletOperation.REACH_ALL_PARTIES,
|
|
1018
|
+
password
|
|
1019
|
+
});
|
|
973
1020
|
const clientKeyShares = await this.getClientKeyShares({
|
|
974
|
-
accountAddress
|
|
1021
|
+
accountAddress,
|
|
1022
|
+
password
|
|
975
1023
|
});
|
|
976
1024
|
if (!accountAddress) {
|
|
977
1025
|
throw new Error('Must provide an account address');
|
|
@@ -992,9 +1040,11 @@ class DynamicWalletClient {
|
|
|
992
1040
|
a.download = `${CLIENT_KEYSHARE_EXPORT_FILENAME_PREFIX}-${accountAddress}.txt`;
|
|
993
1041
|
a.click();
|
|
994
1042
|
}
|
|
995
|
-
async getClientKeyShares({ accountAddress }) {
|
|
1043
|
+
async getClientKeyShares({ accountAddress, password }) {
|
|
996
1044
|
const wallet = await this.getWallet({
|
|
997
|
-
accountAddress
|
|
1045
|
+
accountAddress,
|
|
1046
|
+
password,
|
|
1047
|
+
walletOperation: WalletOperation.REACH_THRESHOLD
|
|
998
1048
|
});
|
|
999
1049
|
return wallet.clientKeyShares;
|
|
1000
1050
|
}
|
|
@@ -1019,7 +1069,7 @@ class DynamicWalletClient {
|
|
|
1019
1069
|
// check if wallet already exists with sufficient keyshares
|
|
1020
1070
|
if (existingWallet) {
|
|
1021
1071
|
var _existingWallet_clientKeyShares;
|
|
1022
|
-
const {
|
|
1072
|
+
const { shares } = this.recoverStrategy({
|
|
1023
1073
|
clientKeyShareBackupInfo: existingWallet.clientKeySharesBackupInfo || {
|
|
1024
1074
|
backups: getClientKeyShareBackupInfo()
|
|
1025
1075
|
},
|
|
@@ -1027,13 +1077,105 @@ class DynamicWalletClient {
|
|
|
1027
1077
|
walletOperation,
|
|
1028
1078
|
shareCount
|
|
1029
1079
|
});
|
|
1080
|
+
const { dynamic: requiredDynamicKeyShareIds = [] } = shares;
|
|
1030
1081
|
if (requiredDynamicKeyShareIds.length <= (((_existingWallet_clientKeyShares = existingWallet.clientKeyShares) == null ? void 0 : _existingWallet_clientKeyShares.length) || 0)) {
|
|
1031
1082
|
keyshareCheck = true;
|
|
1032
1083
|
}
|
|
1033
1084
|
}
|
|
1034
1085
|
return walletCheck && thresholdSignatureSchemeCheck && keyshareCheck;
|
|
1035
1086
|
}
|
|
1036
|
-
|
|
1087
|
+
/**
|
|
1088
|
+
* verifyPassword attempts to recover and decrypt 1 client key share using the provided password
|
|
1089
|
+
* if successful, the key share is encrypted with the new password and stored
|
|
1090
|
+
* if unsuccessful, throws an error
|
|
1091
|
+
*/ async verifyPassword({ accountAddress, password = undefined, walletOperation = WalletOperation.NO_OPERATION }) {
|
|
1092
|
+
await this.getWallet({
|
|
1093
|
+
accountAddress,
|
|
1094
|
+
password,
|
|
1095
|
+
walletOperation
|
|
1096
|
+
});
|
|
1097
|
+
if (await this.requiresPasswordForOperation({
|
|
1098
|
+
accountAddress,
|
|
1099
|
+
walletOperation
|
|
1100
|
+
}) && !password) {
|
|
1101
|
+
throw new Error('Password is required for operation but not provided');
|
|
1102
|
+
}
|
|
1103
|
+
// silent return if no password is provided and operation does not require a password
|
|
1104
|
+
if (!password) {
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1107
|
+
const { backups } = await this.getWalletClientKeyShareBackupInfo({
|
|
1108
|
+
accountAddress
|
|
1109
|
+
});
|
|
1110
|
+
const { dynamic: dynamicKeyShareIds = [] } = backups;
|
|
1111
|
+
if (!dynamicKeyShareIds || dynamicKeyShareIds.length === 0) {
|
|
1112
|
+
throw new Error('No dynamic key shares found');
|
|
1113
|
+
}
|
|
1114
|
+
try {
|
|
1115
|
+
await this.recoverEncryptedBackupByWallet({
|
|
1116
|
+
accountAddress,
|
|
1117
|
+
password,
|
|
1118
|
+
walletOperation: WalletOperation.NO_OPERATION
|
|
1119
|
+
});
|
|
1120
|
+
} catch (error) {
|
|
1121
|
+
this.logger.error('Error in verifying password', error);
|
|
1122
|
+
throw new Error('Incorrect password');
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
async isPasswordEncrypted({ accountAddress }) {
|
|
1126
|
+
const clientKeySharesBackupInfo = await this.getWalletClientKeyShareBackupInfo({
|
|
1127
|
+
accountAddress
|
|
1128
|
+
});
|
|
1129
|
+
return clientKeySharesBackupInfo == null ? void 0 : clientKeySharesBackupInfo.passwordEncrypted;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* check if the operation requires a password
|
|
1133
|
+
*/ async requiresPasswordForOperation({ accountAddress, walletOperation = WalletOperation.REACH_THRESHOLD }) {
|
|
1134
|
+
const isEncrypted = await this.isPasswordEncrypted({
|
|
1135
|
+
accountAddress
|
|
1136
|
+
});
|
|
1137
|
+
if (!isEncrypted) {
|
|
1138
|
+
return false;
|
|
1139
|
+
}
|
|
1140
|
+
return this.requiresRestoreBackupSharesForOperation({
|
|
1141
|
+
accountAddress,
|
|
1142
|
+
walletOperation
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* check if the operation requires restoring backup shares
|
|
1147
|
+
*/ async requiresRestoreBackupSharesForOperation({ accountAddress, walletOperation = WalletOperation.REACH_THRESHOLD }) {
|
|
1148
|
+
const clientKeySharesBackupInfo = await this.getWalletClientKeyShareBackupInfo({
|
|
1149
|
+
accountAddress
|
|
1150
|
+
});
|
|
1151
|
+
const clientKeyShares = this.walletMap[accountAddress].clientKeyShares || [];
|
|
1152
|
+
if (walletOperation === WalletOperation.REACH_ALL_PARTIES || walletOperation === WalletOperation.REFRESH || walletOperation === WalletOperation.RESHARE) {
|
|
1153
|
+
return true;
|
|
1154
|
+
}
|
|
1155
|
+
const { requiredShareCount } = this.recoverStrategy({
|
|
1156
|
+
clientKeyShareBackupInfo: clientKeySharesBackupInfo,
|
|
1157
|
+
thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme,
|
|
1158
|
+
walletOperation
|
|
1159
|
+
});
|
|
1160
|
+
if (clientKeyShares.length >= requiredShareCount) {
|
|
1161
|
+
return false;
|
|
1162
|
+
}
|
|
1163
|
+
return true;
|
|
1164
|
+
}
|
|
1165
|
+
async getWalletClientKeyShareBackupInfo({ accountAddress }) {
|
|
1166
|
+
var _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups_BackupLocation_DYNAMIC, _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups, _this_walletMap_accountAddress_clientKeySharesBackupInfo, _this_walletMap_accountAddress, _user_verifiedCredentials;
|
|
1167
|
+
// Return existing backup info if it exists
|
|
1168
|
+
if (((_this_walletMap_accountAddress = this.walletMap[accountAddress]) == null ? void 0 : (_this_walletMap_accountAddress_clientKeySharesBackupInfo = _this_walletMap_accountAddress.clientKeySharesBackupInfo) == null ? void 0 : (_this_walletMap_accountAddress_clientKeySharesBackupInfo_backups = _this_walletMap_accountAddress_clientKeySharesBackupInfo.backups) == null ? void 0 : (_this_walletMap_accountAddress_clientKeySharesBackupInfo_backups_BackupLocation_DYNAMIC = _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups[core.BackupLocation.DYNAMIC]) == null ? void 0 : _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups_BackupLocation_DYNAMIC.length) > 0) {
|
|
1169
|
+
return this.walletMap[accountAddress].clientKeySharesBackupInfo;
|
|
1170
|
+
}
|
|
1171
|
+
// Get backup info from server
|
|
1172
|
+
const user = await this.apiClient.getUser();
|
|
1173
|
+
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
|
|
1174
|
+
return getClientKeyShareBackupInfo({
|
|
1175
|
+
walletProperties: wallet == null ? void 0 : wallet.walletProperties
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
async getWallet({ accountAddress, walletOperation = WalletOperation.NO_OPERATION, shareCount = undefined, password = undefined }) {
|
|
1037
1179
|
var _user_verifiedCredentials;
|
|
1038
1180
|
const existingWalletCheck = await this.checkWalletFields({
|
|
1039
1181
|
accountAddress,
|
|
@@ -1059,14 +1201,18 @@ class DynamicWalletClient {
|
|
|
1059
1201
|
walletProperties
|
|
1060
1202
|
})
|
|
1061
1203
|
});
|
|
1062
|
-
|
|
1063
|
-
const decryptedKeyShares = await this.recoverEncryptedBackupByWallet({
|
|
1204
|
+
if (walletOperation !== WalletOperation.NO_OPERATION && await this.requiresRestoreBackupSharesForOperation({
|
|
1064
1205
|
accountAddress,
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1206
|
+
walletOperation
|
|
1207
|
+
})) {
|
|
1208
|
+
const decryptedKeyShares = await this.recoverEncryptedBackupByWallet({
|
|
1209
|
+
accountAddress,
|
|
1210
|
+
password: password != null ? password : this.environmentId,
|
|
1211
|
+
walletOperation: walletOperation,
|
|
1212
|
+
shareCount
|
|
1213
|
+
});
|
|
1214
|
+
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1215
|
+
}
|
|
1070
1216
|
const walletCount = Object.keys(this.walletMap).length;
|
|
1071
1217
|
if (walletCount === 0) {
|
|
1072
1218
|
throw new Error('No wallets found');
|
package/index.esm.js
CHANGED
|
@@ -356,6 +356,7 @@ var WalletOperation = /*#__PURE__*/ function(WalletOperation) {
|
|
|
356
356
|
WalletOperation["REFRESH"] = "REFRESH";
|
|
357
357
|
WalletOperation["RESHARE"] = "RESHARE";
|
|
358
358
|
WalletOperation["EXPORT_PRIVATE_KEY"] = "EXPORT_PRIVATE_KEY";
|
|
359
|
+
WalletOperation["NO_OPERATION"] = "NO_OPERATION";
|
|
359
360
|
return WalletOperation;
|
|
360
361
|
}({});
|
|
361
362
|
|
|
@@ -525,9 +526,16 @@ class DynamicWalletClient {
|
|
|
525
526
|
}
|
|
526
527
|
}
|
|
527
528
|
//todo: need to modify with imported flag
|
|
528
|
-
async sign({ accountAddress, message, chainName }) {
|
|
529
|
+
async sign({ accountAddress, message, chainName, password = undefined }) {
|
|
530
|
+
await this.verifyPassword({
|
|
531
|
+
accountAddress,
|
|
532
|
+
password,
|
|
533
|
+
walletOperation: WalletOperation.SIGN_MESSAGE
|
|
534
|
+
});
|
|
529
535
|
const wallet = await this.getWallet({
|
|
530
|
-
accountAddress
|
|
536
|
+
accountAddress,
|
|
537
|
+
password,
|
|
538
|
+
walletOperation: WalletOperation.SIGN_MESSAGE
|
|
531
539
|
});
|
|
532
540
|
// Perform the server sign
|
|
533
541
|
const data = await this.serverSign({
|
|
@@ -545,11 +553,17 @@ class DynamicWalletClient {
|
|
|
545
553
|
});
|
|
546
554
|
return signature;
|
|
547
555
|
}
|
|
548
|
-
async refreshWalletAccountShares({ accountAddress, chainName }) {
|
|
549
|
-
|
|
556
|
+
async refreshWalletAccountShares({ accountAddress, chainName, password = undefined }) {
|
|
557
|
+
await this.verifyPassword({
|
|
550
558
|
accountAddress,
|
|
559
|
+
password,
|
|
551
560
|
walletOperation: WalletOperation.REFRESH
|
|
552
561
|
});
|
|
562
|
+
const wallet = await this.getWallet({
|
|
563
|
+
accountAddress,
|
|
564
|
+
walletOperation: WalletOperation.REFRESH,
|
|
565
|
+
password
|
|
566
|
+
});
|
|
553
567
|
const mpcSigner = getMPCSigner({
|
|
554
568
|
chainName,
|
|
555
569
|
baseRelayUrl: this.baseMPCRelayApiUrl
|
|
@@ -565,7 +579,7 @@ class DynamicWalletClient {
|
|
|
565
579
|
});
|
|
566
580
|
await this.storeEncryptedBackupByWallet({
|
|
567
581
|
accountAddress,
|
|
568
|
-
password:
|
|
582
|
+
password: password != null ? password : this.environmentId
|
|
569
583
|
});
|
|
570
584
|
return refreshResults;
|
|
571
585
|
}
|
|
@@ -618,7 +632,12 @@ class DynamicWalletClient {
|
|
|
618
632
|
existingClientKeyShares
|
|
619
633
|
};
|
|
620
634
|
}
|
|
621
|
-
async reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme }) {
|
|
635
|
+
async reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password = undefined }) {
|
|
636
|
+
await this.verifyPassword({
|
|
637
|
+
accountAddress,
|
|
638
|
+
password,
|
|
639
|
+
walletOperation: WalletOperation.RESHARE
|
|
640
|
+
});
|
|
622
641
|
const { existingClientShareCount } = getReshareConfig({
|
|
623
642
|
oldThresholdSignatureScheme,
|
|
624
643
|
newThresholdSignatureScheme
|
|
@@ -626,7 +645,8 @@ class DynamicWalletClient {
|
|
|
626
645
|
const wallet = await this.getWallet({
|
|
627
646
|
accountAddress,
|
|
628
647
|
walletOperation: WalletOperation.RESHARE,
|
|
629
|
-
shareCount: existingClientShareCount
|
|
648
|
+
shareCount: existingClientShareCount,
|
|
649
|
+
password
|
|
630
650
|
});
|
|
631
651
|
console.log(`Resharing from ${oldThresholdSignatureScheme} to ${newThresholdSignatureScheme}`);
|
|
632
652
|
const { newClientInitKeygenResults, newClientKeygenIds, existingClientKeygenIds, existingClientKeyShares } = await this.reshareStrategy({
|
|
@@ -668,13 +688,15 @@ class DynamicWalletClient {
|
|
|
668
688
|
});
|
|
669
689
|
await this.storeEncryptedBackupByWallet({
|
|
670
690
|
accountAddress,
|
|
671
|
-
password
|
|
691
|
+
password
|
|
672
692
|
});
|
|
673
693
|
return reshareResults;
|
|
674
694
|
}
|
|
675
|
-
async exportKey({ accountAddress, chainName }) {
|
|
695
|
+
async exportKey({ accountAddress, chainName, password = undefined }) {
|
|
676
696
|
const wallet = await this.getWallet({
|
|
677
|
-
accountAddress
|
|
697
|
+
accountAddress,
|
|
698
|
+
password,
|
|
699
|
+
walletOperation: WalletOperation.EXPORT_PRIVATE_KEY
|
|
678
700
|
});
|
|
679
701
|
const mpcSigner = getMPCSigner({
|
|
680
702
|
chainName,
|
|
@@ -749,9 +771,11 @@ class DynamicWalletClient {
|
|
|
749
771
|
const serializedEncryptedKeyShare = Buffer.from(JSON.stringify(encryptedKeyShare)).toString('base64');
|
|
750
772
|
return serializedEncryptedKeyShare;
|
|
751
773
|
}
|
|
752
|
-
async storeEncryptedBackupByWallet({ accountAddress, password }) {
|
|
774
|
+
async storeEncryptedBackupByWallet({ accountAddress, password = undefined, walletOperation = WalletOperation.REACH_ALL_PARTIES }) {
|
|
753
775
|
await this.getWallet({
|
|
754
|
-
accountAddress
|
|
776
|
+
accountAddress,
|
|
777
|
+
password,
|
|
778
|
+
walletOperation
|
|
755
779
|
});
|
|
756
780
|
const encryptedKeyShares = await Promise.all(this.walletMap[accountAddress].clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
757
781
|
keyShare,
|
|
@@ -764,6 +788,17 @@ class DynamicWalletClient {
|
|
|
764
788
|
});
|
|
765
789
|
return data;
|
|
766
790
|
}
|
|
791
|
+
async updatePassword({ accountAddress, existingPassword, newPassword }) {
|
|
792
|
+
await this.getWallet({
|
|
793
|
+
accountAddress,
|
|
794
|
+
password: existingPassword,
|
|
795
|
+
walletOperation: WalletOperation.REACH_ALL_PARTIES
|
|
796
|
+
});
|
|
797
|
+
await this.storeEncryptedBackupByWallet({
|
|
798
|
+
accountAddress,
|
|
799
|
+
password: newPassword
|
|
800
|
+
});
|
|
801
|
+
}
|
|
767
802
|
async decryptKeyShare({ keyShare, password }) {
|
|
768
803
|
const decodedKeyShare = JSON.parse(Buffer.from(keyShare, 'base64').toString());
|
|
769
804
|
const decryptedKeyShare = await decryptData({
|
|
@@ -782,29 +817,34 @@ class DynamicWalletClient {
|
|
|
782
817
|
* @param thresholdSignatureScheme - The signature scheme being used (2-of-2, 2-of-3, etc)
|
|
783
818
|
* @param walletOperation - The operation being performed (REFRESH, SIGN_MESSAGE, etc)
|
|
784
819
|
* @param shareCount - The number of shares to recover if specified for reshare operations
|
|
785
|
-
* @returns Object mapping backup locations to arrays of share IDs to recover
|
|
786
|
-
|
|
820
|
+
* @returns @shares: Object mapping backup locations to arrays of share IDs to recover
|
|
821
|
+
* @returns @requiredShareCount: The number of shares required to recover
|
|
822
|
+
*/ recoverStrategy({ clientKeyShareBackupInfo, thresholdSignatureScheme, walletOperation, shareCount = undefined }) {
|
|
787
823
|
const { backups } = clientKeyShareBackupInfo;
|
|
788
824
|
const { clientThreshold } = MPC_CONFIG[thresholdSignatureScheme];
|
|
789
|
-
let
|
|
790
|
-
// Override
|
|
825
|
+
let requiredShareCount = walletOperation === WalletOperation.REFRESH || walletOperation === WalletOperation.REACH_ALL_PARTIES || walletOperation === WalletOperation.RESHARE ? clientThreshold : 1;
|
|
826
|
+
// Override requiredShareCount if shareCount is provided
|
|
791
827
|
if (shareCount !== undefined) {
|
|
792
|
-
|
|
828
|
+
requiredShareCount = shareCount;
|
|
793
829
|
}
|
|
794
|
-
const dynamicShares = backups[BackupLocation.DYNAMIC].slice(0,
|
|
830
|
+
const dynamicShares = backups[BackupLocation.DYNAMIC].slice(0, requiredShareCount);
|
|
795
831
|
return {
|
|
796
|
-
|
|
832
|
+
shares: {
|
|
833
|
+
[BackupLocation.DYNAMIC]: dynamicShares
|
|
834
|
+
},
|
|
835
|
+
requiredShareCount
|
|
797
836
|
};
|
|
798
837
|
}
|
|
799
838
|
async recoverEncryptedBackupByWallet({ accountAddress, password, walletOperation, shareCount = undefined }) {
|
|
800
839
|
const wallet = this.walletMap[accountAddress];
|
|
801
840
|
this.logger.debug(`recoverEncryptedBackupByWallet wallet: ${walletOperation}`, wallet);
|
|
802
|
-
const {
|
|
841
|
+
const { shares } = this.recoverStrategy({
|
|
803
842
|
clientKeyShareBackupInfo: wallet.clientKeySharesBackupInfo,
|
|
804
843
|
thresholdSignatureScheme: wallet.thresholdSignatureScheme,
|
|
805
844
|
walletOperation,
|
|
806
845
|
shareCount
|
|
807
846
|
});
|
|
847
|
+
const { dynamic: dynamicKeyShareIds } = shares;
|
|
808
848
|
const data = await this.apiClient.recoverEncryptedBackupByWallet({
|
|
809
849
|
walletId: wallet.walletId,
|
|
810
850
|
keyShareIds: dynamicKeyShareIds
|
|
@@ -831,7 +871,8 @@ class DynamicWalletClient {
|
|
|
831
871
|
async backupKeySharesToGoogleDrive({ accountAddress, fileName, oauthAccountId, password }) {
|
|
832
872
|
await this.getWallet({
|
|
833
873
|
accountAddress,
|
|
834
|
-
walletOperation: WalletOperation.REACH_ALL_PARTIES
|
|
874
|
+
walletOperation: WalletOperation.REACH_ALL_PARTIES,
|
|
875
|
+
password
|
|
835
876
|
});
|
|
836
877
|
const clientKeyShares = this.walletMap[accountAddress].clientKeyShares;
|
|
837
878
|
if (clientKeyShares.length === 0) {
|
|
@@ -965,13 +1006,20 @@ class DynamicWalletClient {
|
|
|
965
1006
|
clientKeyShares: clientKeygenResults
|
|
966
1007
|
};
|
|
967
1008
|
}
|
|
968
|
-
async exportClientKeyshares({ accountAddress }) {
|
|
969
|
-
await this.
|
|
1009
|
+
async exportClientKeyshares({ accountAddress, password }) {
|
|
1010
|
+
await this.verifyPassword({
|
|
970
1011
|
accountAddress,
|
|
1012
|
+
password,
|
|
971
1013
|
walletOperation: WalletOperation.REACH_ALL_PARTIES
|
|
972
1014
|
});
|
|
1015
|
+
await this.getWallet({
|
|
1016
|
+
accountAddress,
|
|
1017
|
+
walletOperation: WalletOperation.REACH_ALL_PARTIES,
|
|
1018
|
+
password
|
|
1019
|
+
});
|
|
973
1020
|
const clientKeyShares = await this.getClientKeyShares({
|
|
974
|
-
accountAddress
|
|
1021
|
+
accountAddress,
|
|
1022
|
+
password
|
|
975
1023
|
});
|
|
976
1024
|
if (!accountAddress) {
|
|
977
1025
|
throw new Error('Must provide an account address');
|
|
@@ -992,9 +1040,11 @@ class DynamicWalletClient {
|
|
|
992
1040
|
a.download = `${CLIENT_KEYSHARE_EXPORT_FILENAME_PREFIX}-${accountAddress}.txt`;
|
|
993
1041
|
a.click();
|
|
994
1042
|
}
|
|
995
|
-
async getClientKeyShares({ accountAddress }) {
|
|
1043
|
+
async getClientKeyShares({ accountAddress, password }) {
|
|
996
1044
|
const wallet = await this.getWallet({
|
|
997
|
-
accountAddress
|
|
1045
|
+
accountAddress,
|
|
1046
|
+
password,
|
|
1047
|
+
walletOperation: WalletOperation.REACH_THRESHOLD
|
|
998
1048
|
});
|
|
999
1049
|
return wallet.clientKeyShares;
|
|
1000
1050
|
}
|
|
@@ -1019,7 +1069,7 @@ class DynamicWalletClient {
|
|
|
1019
1069
|
// check if wallet already exists with sufficient keyshares
|
|
1020
1070
|
if (existingWallet) {
|
|
1021
1071
|
var _existingWallet_clientKeyShares;
|
|
1022
|
-
const {
|
|
1072
|
+
const { shares } = this.recoverStrategy({
|
|
1023
1073
|
clientKeyShareBackupInfo: existingWallet.clientKeySharesBackupInfo || {
|
|
1024
1074
|
backups: getClientKeyShareBackupInfo()
|
|
1025
1075
|
},
|
|
@@ -1027,13 +1077,105 @@ class DynamicWalletClient {
|
|
|
1027
1077
|
walletOperation,
|
|
1028
1078
|
shareCount
|
|
1029
1079
|
});
|
|
1080
|
+
const { dynamic: requiredDynamicKeyShareIds = [] } = shares;
|
|
1030
1081
|
if (requiredDynamicKeyShareIds.length <= (((_existingWallet_clientKeyShares = existingWallet.clientKeyShares) == null ? void 0 : _existingWallet_clientKeyShares.length) || 0)) {
|
|
1031
1082
|
keyshareCheck = true;
|
|
1032
1083
|
}
|
|
1033
1084
|
}
|
|
1034
1085
|
return walletCheck && thresholdSignatureSchemeCheck && keyshareCheck;
|
|
1035
1086
|
}
|
|
1036
|
-
|
|
1087
|
+
/**
|
|
1088
|
+
* verifyPassword attempts to recover and decrypt 1 client key share using the provided password
|
|
1089
|
+
* if successful, the key share is encrypted with the new password and stored
|
|
1090
|
+
* if unsuccessful, throws an error
|
|
1091
|
+
*/ async verifyPassword({ accountAddress, password = undefined, walletOperation = WalletOperation.NO_OPERATION }) {
|
|
1092
|
+
await this.getWallet({
|
|
1093
|
+
accountAddress,
|
|
1094
|
+
password,
|
|
1095
|
+
walletOperation
|
|
1096
|
+
});
|
|
1097
|
+
if (await this.requiresPasswordForOperation({
|
|
1098
|
+
accountAddress,
|
|
1099
|
+
walletOperation
|
|
1100
|
+
}) && !password) {
|
|
1101
|
+
throw new Error('Password is required for operation but not provided');
|
|
1102
|
+
}
|
|
1103
|
+
// silent return if no password is provided and operation does not require a password
|
|
1104
|
+
if (!password) {
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1107
|
+
const { backups } = await this.getWalletClientKeyShareBackupInfo({
|
|
1108
|
+
accountAddress
|
|
1109
|
+
});
|
|
1110
|
+
const { dynamic: dynamicKeyShareIds = [] } = backups;
|
|
1111
|
+
if (!dynamicKeyShareIds || dynamicKeyShareIds.length === 0) {
|
|
1112
|
+
throw new Error('No dynamic key shares found');
|
|
1113
|
+
}
|
|
1114
|
+
try {
|
|
1115
|
+
await this.recoverEncryptedBackupByWallet({
|
|
1116
|
+
accountAddress,
|
|
1117
|
+
password,
|
|
1118
|
+
walletOperation: WalletOperation.NO_OPERATION
|
|
1119
|
+
});
|
|
1120
|
+
} catch (error) {
|
|
1121
|
+
this.logger.error('Error in verifying password', error);
|
|
1122
|
+
throw new Error('Incorrect password');
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
async isPasswordEncrypted({ accountAddress }) {
|
|
1126
|
+
const clientKeySharesBackupInfo = await this.getWalletClientKeyShareBackupInfo({
|
|
1127
|
+
accountAddress
|
|
1128
|
+
});
|
|
1129
|
+
return clientKeySharesBackupInfo == null ? void 0 : clientKeySharesBackupInfo.passwordEncrypted;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* check if the operation requires a password
|
|
1133
|
+
*/ async requiresPasswordForOperation({ accountAddress, walletOperation = WalletOperation.REACH_THRESHOLD }) {
|
|
1134
|
+
const isEncrypted = await this.isPasswordEncrypted({
|
|
1135
|
+
accountAddress
|
|
1136
|
+
});
|
|
1137
|
+
if (!isEncrypted) {
|
|
1138
|
+
return false;
|
|
1139
|
+
}
|
|
1140
|
+
return this.requiresRestoreBackupSharesForOperation({
|
|
1141
|
+
accountAddress,
|
|
1142
|
+
walletOperation
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* check if the operation requires restoring backup shares
|
|
1147
|
+
*/ async requiresRestoreBackupSharesForOperation({ accountAddress, walletOperation = WalletOperation.REACH_THRESHOLD }) {
|
|
1148
|
+
const clientKeySharesBackupInfo = await this.getWalletClientKeyShareBackupInfo({
|
|
1149
|
+
accountAddress
|
|
1150
|
+
});
|
|
1151
|
+
const clientKeyShares = this.walletMap[accountAddress].clientKeyShares || [];
|
|
1152
|
+
if (walletOperation === WalletOperation.REACH_ALL_PARTIES || walletOperation === WalletOperation.REFRESH || walletOperation === WalletOperation.RESHARE) {
|
|
1153
|
+
return true;
|
|
1154
|
+
}
|
|
1155
|
+
const { requiredShareCount } = this.recoverStrategy({
|
|
1156
|
+
clientKeyShareBackupInfo: clientKeySharesBackupInfo,
|
|
1157
|
+
thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme,
|
|
1158
|
+
walletOperation
|
|
1159
|
+
});
|
|
1160
|
+
if (clientKeyShares.length >= requiredShareCount) {
|
|
1161
|
+
return false;
|
|
1162
|
+
}
|
|
1163
|
+
return true;
|
|
1164
|
+
}
|
|
1165
|
+
async getWalletClientKeyShareBackupInfo({ accountAddress }) {
|
|
1166
|
+
var _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups_BackupLocation_DYNAMIC, _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups, _this_walletMap_accountAddress_clientKeySharesBackupInfo, _this_walletMap_accountAddress, _user_verifiedCredentials;
|
|
1167
|
+
// Return existing backup info if it exists
|
|
1168
|
+
if (((_this_walletMap_accountAddress = this.walletMap[accountAddress]) == null ? void 0 : (_this_walletMap_accountAddress_clientKeySharesBackupInfo = _this_walletMap_accountAddress.clientKeySharesBackupInfo) == null ? void 0 : (_this_walletMap_accountAddress_clientKeySharesBackupInfo_backups = _this_walletMap_accountAddress_clientKeySharesBackupInfo.backups) == null ? void 0 : (_this_walletMap_accountAddress_clientKeySharesBackupInfo_backups_BackupLocation_DYNAMIC = _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups[BackupLocation.DYNAMIC]) == null ? void 0 : _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups_BackupLocation_DYNAMIC.length) > 0) {
|
|
1169
|
+
return this.walletMap[accountAddress].clientKeySharesBackupInfo;
|
|
1170
|
+
}
|
|
1171
|
+
// Get backup info from server
|
|
1172
|
+
const user = await this.apiClient.getUser();
|
|
1173
|
+
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
|
|
1174
|
+
return getClientKeyShareBackupInfo({
|
|
1175
|
+
walletProperties: wallet == null ? void 0 : wallet.walletProperties
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
async getWallet({ accountAddress, walletOperation = WalletOperation.NO_OPERATION, shareCount = undefined, password = undefined }) {
|
|
1037
1179
|
var _user_verifiedCredentials;
|
|
1038
1180
|
const existingWalletCheck = await this.checkWalletFields({
|
|
1039
1181
|
accountAddress,
|
|
@@ -1059,14 +1201,18 @@ class DynamicWalletClient {
|
|
|
1059
1201
|
walletProperties
|
|
1060
1202
|
})
|
|
1061
1203
|
});
|
|
1062
|
-
|
|
1063
|
-
const decryptedKeyShares = await this.recoverEncryptedBackupByWallet({
|
|
1204
|
+
if (walletOperation !== WalletOperation.NO_OPERATION && await this.requiresRestoreBackupSharesForOperation({
|
|
1064
1205
|
accountAddress,
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1206
|
+
walletOperation
|
|
1207
|
+
})) {
|
|
1208
|
+
const decryptedKeyShares = await this.recoverEncryptedBackupByWallet({
|
|
1209
|
+
accountAddress,
|
|
1210
|
+
password: password != null ? password : this.environmentId,
|
|
1211
|
+
walletOperation: walletOperation,
|
|
1212
|
+
shareCount
|
|
1213
|
+
});
|
|
1214
|
+
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1215
|
+
}
|
|
1070
1216
|
const walletCount = Object.keys(this.walletMap).length;
|
|
1071
1217
|
if (walletCount === 0) {
|
|
1072
1218
|
throw new Error('No wallets found');
|
package/package.json
CHANGED
package/src/client.d.ts
CHANGED
|
@@ -64,14 +64,16 @@ export declare class DynamicWalletClient {
|
|
|
64
64
|
keyShare: ClientKeyShare;
|
|
65
65
|
derivationPath: Uint32Array | undefined;
|
|
66
66
|
}): Promise<Uint8Array | EcdsaSignature>;
|
|
67
|
-
sign({ accountAddress, message, chainName, }: {
|
|
67
|
+
sign({ accountAddress, message, chainName, password, }: {
|
|
68
68
|
accountAddress: string;
|
|
69
69
|
message: string | Uint8Array;
|
|
70
70
|
chainName: string;
|
|
71
|
+
password?: string;
|
|
71
72
|
}): Promise<Uint8Array | EcdsaSignature>;
|
|
72
|
-
refreshWalletAccountShares({ accountAddress, chainName, }: {
|
|
73
|
+
refreshWalletAccountShares({ accountAddress, chainName, password, }: {
|
|
73
74
|
accountAddress: string;
|
|
74
75
|
chainName: string;
|
|
76
|
+
password?: string;
|
|
75
77
|
}): Promise<(EcdsaKeygenResult | BIP340KeygenResult)[]>;
|
|
76
78
|
getExportId({ chainName, clientKeyShare, }: {
|
|
77
79
|
chainName: string;
|
|
@@ -102,15 +104,17 @@ export declare class DynamicWalletClient {
|
|
|
102
104
|
existingClientKeygenIds: string[];
|
|
103
105
|
existingClientKeyShares: ClientKeyShare[];
|
|
104
106
|
}>;
|
|
105
|
-
reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, }: {
|
|
107
|
+
reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password, }: {
|
|
106
108
|
chainName: string;
|
|
107
109
|
accountAddress: string;
|
|
108
110
|
oldThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
109
111
|
newThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
112
|
+
password?: string;
|
|
110
113
|
}): Promise<(EcdsaKeygenResult | BIP340KeygenResult)[]>;
|
|
111
|
-
exportKey({ accountAddress, chainName, }: {
|
|
114
|
+
exportKey({ accountAddress, chainName, password, }: {
|
|
112
115
|
accountAddress: string;
|
|
113
116
|
chainName: string;
|
|
117
|
+
password?: string;
|
|
114
118
|
}): Promise<{
|
|
115
119
|
derivedPrivateKey: string | undefined;
|
|
116
120
|
}>;
|
|
@@ -125,10 +129,16 @@ export declare class DynamicWalletClient {
|
|
|
125
129
|
keyShare: ClientKeyShare;
|
|
126
130
|
password?: string;
|
|
127
131
|
}): Promise<string>;
|
|
128
|
-
storeEncryptedBackupByWallet({ accountAddress, password, }: {
|
|
132
|
+
storeEncryptedBackupByWallet({ accountAddress, password, walletOperation, }: {
|
|
129
133
|
accountAddress: string;
|
|
130
134
|
password?: string;
|
|
135
|
+
walletOperation?: WalletOperation;
|
|
131
136
|
}): Promise<any>;
|
|
137
|
+
updatePassword({ accountAddress, existingPassword, newPassword, }: {
|
|
138
|
+
accountAddress: string;
|
|
139
|
+
existingPassword?: string;
|
|
140
|
+
newPassword?: string;
|
|
141
|
+
}): Promise<void>;
|
|
132
142
|
decryptKeyShare({ keyShare, password, }: {
|
|
133
143
|
keyShare: string;
|
|
134
144
|
password?: string;
|
|
@@ -142,14 +152,18 @@ export declare class DynamicWalletClient {
|
|
|
142
152
|
* @param thresholdSignatureScheme - The signature scheme being used (2-of-2, 2-of-3, etc)
|
|
143
153
|
* @param walletOperation - The operation being performed (REFRESH, SIGN_MESSAGE, etc)
|
|
144
154
|
* @param shareCount - The number of shares to recover if specified for reshare operations
|
|
145
|
-
* @returns Object mapping backup locations to arrays of share IDs to recover
|
|
155
|
+
* @returns @shares: Object mapping backup locations to arrays of share IDs to recover
|
|
156
|
+
* @returns @requiredShareCount: The number of shares required to recover
|
|
146
157
|
*/
|
|
147
158
|
recoverStrategy({ clientKeyShareBackupInfo, thresholdSignatureScheme, walletOperation, shareCount, }: {
|
|
148
159
|
clientKeyShareBackupInfo: KeyShareBackupInfo;
|
|
149
160
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
150
161
|
walletOperation: WalletOperation;
|
|
151
162
|
shareCount?: number;
|
|
152
|
-
}):
|
|
163
|
+
}): {
|
|
164
|
+
shares: Partial<Record<BackupLocation, string[]>>;
|
|
165
|
+
requiredShareCount: number;
|
|
166
|
+
};
|
|
153
167
|
recoverEncryptedBackupByWallet({ accountAddress, password, walletOperation, shareCount, }: {
|
|
154
168
|
accountAddress: string;
|
|
155
169
|
password?: string;
|
|
@@ -180,11 +194,13 @@ export declare class DynamicWalletClient {
|
|
|
180
194
|
rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
|
|
181
195
|
clientKeyShares: ClientKeyShare[];
|
|
182
196
|
}>;
|
|
183
|
-
exportClientKeyshares({ accountAddress }: {
|
|
197
|
+
exportClientKeyshares({ accountAddress, password }: {
|
|
184
198
|
accountAddress: string;
|
|
199
|
+
password?: string;
|
|
185
200
|
}): Promise<void>;
|
|
186
|
-
getClientKeyShares({ accountAddress }: {
|
|
201
|
+
getClientKeyShares({ accountAddress, password }: {
|
|
187
202
|
accountAddress: string;
|
|
203
|
+
password?: string;
|
|
188
204
|
}): Promise<ClientKeyShare[]>;
|
|
189
205
|
/**
|
|
190
206
|
* Helper function to check if the required wallet fields are present and valid
|
|
@@ -193,10 +209,41 @@ export declare class DynamicWalletClient {
|
|
|
193
209
|
* @returns boolean indicating if wallet needs to be re-fetched and restored from server
|
|
194
210
|
*/
|
|
195
211
|
private checkWalletFields;
|
|
196
|
-
|
|
212
|
+
/**
|
|
213
|
+
* verifyPassword attempts to recover and decrypt 1 client key share using the provided password
|
|
214
|
+
* if successful, the key share is encrypted with the new password and stored
|
|
215
|
+
* if unsuccessful, throws an error
|
|
216
|
+
*/
|
|
217
|
+
verifyPassword({ accountAddress, password, walletOperation, }: {
|
|
218
|
+
accountAddress: string;
|
|
219
|
+
password?: string;
|
|
220
|
+
walletOperation?: WalletOperation;
|
|
221
|
+
}): Promise<void>;
|
|
222
|
+
isPasswordEncrypted({ accountAddress }: {
|
|
223
|
+
accountAddress: string;
|
|
224
|
+
}): Promise<boolean>;
|
|
225
|
+
/**
|
|
226
|
+
* check if the operation requires a password
|
|
227
|
+
*/
|
|
228
|
+
requiresPasswordForOperation({ accountAddress, walletOperation, }: {
|
|
229
|
+
accountAddress: string;
|
|
230
|
+
walletOperation?: WalletOperation;
|
|
231
|
+
}): Promise<boolean>;
|
|
232
|
+
/**
|
|
233
|
+
* check if the operation requires restoring backup shares
|
|
234
|
+
*/
|
|
235
|
+
requiresRestoreBackupSharesForOperation({ accountAddress, walletOperation, }: {
|
|
236
|
+
accountAddress: string;
|
|
237
|
+
walletOperation?: WalletOperation;
|
|
238
|
+
}): Promise<boolean>;
|
|
239
|
+
getWalletClientKeyShareBackupInfo({ accountAddress, }: {
|
|
240
|
+
accountAddress: string;
|
|
241
|
+
}): Promise<KeyShareBackupInfo>;
|
|
242
|
+
getWallet({ accountAddress, walletOperation, shareCount, password, }: {
|
|
197
243
|
accountAddress: string;
|
|
198
244
|
walletOperation?: WalletOperation;
|
|
199
245
|
shareCount?: number;
|
|
246
|
+
password?: string;
|
|
200
247
|
}): Promise<WalletProperties>;
|
|
201
248
|
getWallets(): Promise<any>;
|
|
202
249
|
}
|
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,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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,CAAC;KACnC,GAAG,OAAO,CAAC,OAAO,CAAC;IA4Bd,iCAAiC,CAAC,EACtC,cAAc,GACf,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoBzB,SAAS,CAAC,EACd,cAAc,EACd,eAA8C,EAC9C,UAAsB,EACtB,QAAoB,GACrB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IA4DK,UAAU;CAiCjB"}
|
package/src/types.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export declare enum WalletOperation {
|
|
|
10
10
|
SIGN_TRANSACTION = "SIGN_TRANSACTION",
|
|
11
11
|
REFRESH = "REFRESH",
|
|
12
12
|
RESHARE = "RESHARE",
|
|
13
|
-
EXPORT_PRIVATE_KEY = "EXPORT_PRIVATE_KEY"
|
|
13
|
+
EXPORT_PRIVATE_KEY = "EXPORT_PRIVATE_KEY",
|
|
14
|
+
NO_OPERATION = "NO_OPERATION"
|
|
14
15
|
}
|
|
15
16
|
export interface WalletProperties {
|
|
16
17
|
chainName: string;
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../packages/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,GAAG,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,CAAC;AAEzD,oBAAY,eAAe;IACzB,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;IACvC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,OAAO,YAAY;IACn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