@dynamic-labs-wallet/node 0.0.0-beta.317 → 0.0.0-pr354.0
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 +57 -295
- package/index.esm.js +59 -286
- package/package.json +2 -3
- package/src/client.d.ts +7 -11
- package/src/client.d.ts.map +1 -1
- package/src/index.d.ts +2 -5
- package/src/index.d.ts.map +1 -1
- package/src/utils.d.ts.map +1 -1
- package/src/core/createCore.d.ts +0 -25
- package/src/core/createCore.d.ts.map +0 -1
- package/src/core/types.d.ts +0 -7
- package/src/core/types.d.ts.map +0 -1
- package/src/delegatedClient/createDelegatedClient.d.ts +0 -23
- package/src/delegatedClient/createDelegatedClient.d.ts.map +0 -1
- package/src/delegatedClient/index.d.ts +0 -5
- package/src/delegatedClient/index.d.ts.map +0 -1
- package/src/delegatedClient/modules/revokeDelegation.d.ts +0 -3
- package/src/delegatedClient/modules/revokeDelegation.d.ts.map +0 -1
- package/src/delegatedClient/modules/sign.d.ts +0 -31
- package/src/delegatedClient/modules/sign.d.ts.map +0 -1
package/index.cjs.js
CHANGED
|
@@ -68,8 +68,7 @@ const getExternalServerKeyShareBackupInfo = (params)=>{
|
|
|
68
68
|
[core.BackupLocation.GOOGLE_DRIVE]: [],
|
|
69
69
|
[core.BackupLocation.ICLOUD]: [],
|
|
70
70
|
[core.BackupLocation.USER]: [],
|
|
71
|
-
[core.BackupLocation.EXTERNAL]: []
|
|
72
|
-
[core.BackupLocation.DELEGATED]: []
|
|
71
|
+
[core.BackupLocation.EXTERNAL]: []
|
|
73
72
|
};
|
|
74
73
|
if (!(params == null ? void 0 : (_params_walletProperties = params.walletProperties) == null ? void 0 : _params_walletProperties.keyShares)) {
|
|
75
74
|
return {
|
|
@@ -240,7 +239,7 @@ const getKey = async ({ password, salt, encryptionConfig })=>{
|
|
|
240
239
|
cipher: bytesToBase64(new Uint8Array(encryptedData)),
|
|
241
240
|
version
|
|
242
241
|
};
|
|
243
|
-
} catch (
|
|
242
|
+
} catch (error) {
|
|
244
243
|
throw new Error('Error encrypting data');
|
|
245
244
|
}
|
|
246
245
|
};
|
|
@@ -481,7 +480,7 @@ class DynamicWalletClient {
|
|
|
481
480
|
externalServerKeyShares: externalServerKeygenResults
|
|
482
481
|
};
|
|
483
482
|
}
|
|
484
|
-
async dynamicServerSign({ walletId, message, isFormatted
|
|
483
|
+
async dynamicServerSign({ walletId, message, isFormatted }) {
|
|
485
484
|
const dynamicRequestId = uuid.v4();
|
|
486
485
|
this.ensureApiClientAuthenticated();
|
|
487
486
|
// Create the room and sign the message
|
|
@@ -492,9 +491,7 @@ class DynamicWalletClient {
|
|
|
492
491
|
walletId,
|
|
493
492
|
message,
|
|
494
493
|
isFormatted,
|
|
495
|
-
dynamicRequestId
|
|
496
|
-
context: context ? JSON.parse(JSON.stringify(context, (_key, value)=>typeof value === 'bigint' ? value.toString() : value)) : undefined,
|
|
497
|
-
onError
|
|
494
|
+
dynamicRequestId
|
|
498
495
|
});
|
|
499
496
|
return data;
|
|
500
497
|
}
|
|
@@ -512,45 +509,38 @@ class DynamicWalletClient {
|
|
|
512
509
|
throw error;
|
|
513
510
|
}
|
|
514
511
|
}
|
|
515
|
-
async sign({ accountAddress, externalServerKeyShares, message, chainName, password = undefined, isFormatted = false
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
throw new Error('External server key shares are required to sign a message');
|
|
530
|
-
}
|
|
531
|
-
// Perform the dynamic server sign
|
|
532
|
-
const data = await this.dynamicServerSign({
|
|
533
|
-
walletId: wallet.walletId,
|
|
534
|
-
message,
|
|
535
|
-
isFormatted,
|
|
536
|
-
context,
|
|
537
|
-
onError
|
|
538
|
-
});
|
|
539
|
-
const derivationPath = wallet.derivationPath && wallet.derivationPath != '' ? new Uint32Array(Object.values(JSON.parse(wallet.derivationPath))) : undefined;
|
|
540
|
-
// Perform the external server sign and return the signature
|
|
541
|
-
const signature = await this.externalServerSign({
|
|
542
|
-
chainName,
|
|
543
|
-
message,
|
|
544
|
-
roomId: data.roomId,
|
|
545
|
-
keyShare: externalServerKeyShares[0],
|
|
546
|
-
derivationPath,
|
|
547
|
-
isFormatted
|
|
548
|
-
});
|
|
549
|
-
return signature;
|
|
550
|
-
} catch (error) {
|
|
551
|
-
this.logger.error('Error in sign', error);
|
|
552
|
-
throw error;
|
|
512
|
+
async sign({ accountAddress, externalServerKeyShares, message, chainName, password = undefined, isFormatted = false }) {
|
|
513
|
+
await this.verifyPassword({
|
|
514
|
+
accountAddress,
|
|
515
|
+
password,
|
|
516
|
+
walletOperation: core.WalletOperation.SIGN_MESSAGE
|
|
517
|
+
});
|
|
518
|
+
const wallet = await this.getWallet({
|
|
519
|
+
accountAddress,
|
|
520
|
+
walletOperation: core.WalletOperation.SIGN_MESSAGE,
|
|
521
|
+
password
|
|
522
|
+
});
|
|
523
|
+
externalServerKeyShares = externalServerKeyShares != null ? externalServerKeyShares : wallet.externalServerKeyShares;
|
|
524
|
+
if (!externalServerKeyShares) {
|
|
525
|
+
throw new Error('External server key shares are required to sign a message');
|
|
553
526
|
}
|
|
527
|
+
// Perform the dynamic server sign
|
|
528
|
+
const data = await this.dynamicServerSign({
|
|
529
|
+
walletId: wallet.walletId,
|
|
530
|
+
message,
|
|
531
|
+
isFormatted
|
|
532
|
+
});
|
|
533
|
+
const derivationPath = wallet.derivationPath && wallet.derivationPath != '' ? new Uint32Array(Object.values(JSON.parse(wallet.derivationPath))) : undefined;
|
|
534
|
+
// Perform the external server sign and return the signature
|
|
535
|
+
const signature = await this.externalServerSign({
|
|
536
|
+
chainName,
|
|
537
|
+
message,
|
|
538
|
+
roomId: data.roomId,
|
|
539
|
+
keyShare: externalServerKeyShares[0],
|
|
540
|
+
derivationPath,
|
|
541
|
+
isFormatted
|
|
542
|
+
});
|
|
543
|
+
return signature;
|
|
554
544
|
}
|
|
555
545
|
async refreshWalletAccountShares({ accountAddress, chainName, password = undefined, externalServerKeyShares, backUpToClientShareService = false }) {
|
|
556
546
|
this.ensureApiClientAuthenticated();
|
|
@@ -938,14 +928,10 @@ class DynamicWalletClient {
|
|
|
938
928
|
if (shareCount !== undefined) {
|
|
939
929
|
requiredShareCount = shareCount;
|
|
940
930
|
}
|
|
941
|
-
const dynamicShares =
|
|
942
|
-
const externalShares = (backups[core.BackupLocation.EXTERNAL] || []).slice(0, requiredShareCount);
|
|
943
|
-
// If we have DYNAMIC shares, use those; otherwise use EXTERNAL shares
|
|
944
|
-
const sharesToUse = dynamicShares.length > 0 ? dynamicShares : externalShares;
|
|
945
|
-
const backupLocation = dynamicShares.length > 0 ? core.BackupLocation.DYNAMIC : core.BackupLocation.EXTERNAL;
|
|
931
|
+
const dynamicShares = backups[core.BackupLocation.DYNAMIC].slice(0, requiredShareCount);
|
|
946
932
|
return {
|
|
947
933
|
shares: {
|
|
948
|
-
[
|
|
934
|
+
[core.BackupLocation.DYNAMIC]: dynamicShares.map((ks)=>{
|
|
949
935
|
var _ks_externalKeyShareId, _ref;
|
|
950
936
|
return (_ref = (_ks_externalKeyShareId = ks.externalKeyShareId) != null ? _ks_externalKeyShareId : ks.keyShareId) != null ? _ref : '';
|
|
951
937
|
})
|
|
@@ -963,24 +949,12 @@ class DynamicWalletClient {
|
|
|
963
949
|
walletOperation,
|
|
964
950
|
shareCount
|
|
965
951
|
});
|
|
966
|
-
|
|
967
|
-
const
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
data = await this.apiClient.recoverEncryptedBackupByWallet({
|
|
973
|
-
walletId: wallet.walletId,
|
|
974
|
-
keyShareIds: dynamicKeyShareIds,
|
|
975
|
-
requiresSignedSessionId: false
|
|
976
|
-
});
|
|
977
|
-
} else if (externalKeyShareIds.length > 0) {
|
|
978
|
-
this.logger.debug('Skipping recovery - only EXTERNAL shares available (backUpToClientShareService: false)');
|
|
979
|
-
return []; // Return empty array since we can't recover EXTERNAL shares via API
|
|
980
|
-
} else {
|
|
981
|
-
this.logger.debug('No shares available for recovery');
|
|
982
|
-
return []; // Return empty array if no shares are available
|
|
983
|
-
}
|
|
952
|
+
const { dynamic: dynamicKeyShareIds } = shares;
|
|
953
|
+
const data = await this.apiClient.recoverEncryptedBackupByWallet({
|
|
954
|
+
walletId: wallet.walletId,
|
|
955
|
+
keyShareIds: dynamicKeyShareIds,
|
|
956
|
+
requiresSignedSessionId: false
|
|
957
|
+
});
|
|
984
958
|
const dynamicKeyShares = data.keyShares.filter((keyShare)=>keyShare.encryptedAccountCredential !== null && keyShare.backupLocation === core.BackupLocation.DYNAMIC);
|
|
985
959
|
const decryptedKeyShares = await Promise.all(dynamicKeyShares.map((keyShare)=>this.decryptKeyShare({
|
|
986
960
|
keyShare: keyShare.encryptedAccountCredential,
|
|
@@ -1011,7 +985,6 @@ class DynamicWalletClient {
|
|
|
1011
985
|
* @param walletOperation - The wallet operation that determines required fields
|
|
1012
986
|
* @returns boolean indicating if wallet needs to be re-fetched and restored from server
|
|
1013
987
|
*/ async checkWalletFields({ accountAddress, walletOperation = core.WalletOperation.REACH_THRESHOLD, shareCount }) {
|
|
1014
|
-
var _existingWallet_externalServerKeyShares;
|
|
1015
988
|
let keyshareCheck = false;
|
|
1016
989
|
let walletCheck = false;
|
|
1017
990
|
let thresholdSignatureSchemeCheck = false;
|
|
@@ -1031,7 +1004,7 @@ class DynamicWalletClient {
|
|
|
1031
1004
|
}
|
|
1032
1005
|
// check if wallet already exists with sufficient keyshares
|
|
1033
1006
|
if (existingWallet) {
|
|
1034
|
-
var
|
|
1007
|
+
var _existingWallet_externalServerKeyShares;
|
|
1035
1008
|
const { shares } = this.recoverStrategy({
|
|
1036
1009
|
externalServerKeySharesBackupInfo: existingWallet.externalServerKeySharesBackupInfo || {
|
|
1037
1010
|
backups: getExternalServerKeyShareBackupInfo()
|
|
@@ -1041,35 +1014,11 @@ class DynamicWalletClient {
|
|
|
1041
1014
|
shareCount
|
|
1042
1015
|
});
|
|
1043
1016
|
const { dynamic: requiredDynamicKeyShareIds = [] } = shares;
|
|
1044
|
-
|
|
1045
|
-
// Check if we have enough shares from any backup location
|
|
1046
|
-
const totalRequiredShares = requiredDynamicKeyShareIds.length + requiredExternalKeyShareIds.length;
|
|
1047
|
-
// Check if we have the required shares either loaded OR available in backup
|
|
1048
|
-
const hasLoadedShares = totalRequiredShares <= (((_existingWallet_externalServerKeyShares1 = existingWallet.externalServerKeyShares) == null ? void 0 : _existingWallet_externalServerKeyShares1.length) || 0);
|
|
1049
|
-
// Check if backup contains the specific required share IDs
|
|
1050
|
-
const hasBackupShares = existingWallet.externalServerKeySharesBackupInfo && (()=>{
|
|
1051
|
-
const backupShares = existingWallet.externalServerKeySharesBackupInfo.backups.dynamic;
|
|
1052
|
-
const allRequiredIds = [
|
|
1053
|
-
...requiredDynamicKeyShareIds,
|
|
1054
|
-
...requiredExternalKeyShareIds
|
|
1055
|
-
];
|
|
1056
|
-
return allRequiredIds.every((requiredId)=>backupShares.some((backupShare)=>backupShare.externalKeyShareId === requiredId || backupShare.keyShareId === requiredId));
|
|
1057
|
-
})();
|
|
1058
|
-
if (hasLoadedShares || hasBackupShares) {
|
|
1017
|
+
if (requiredDynamicKeyShareIds.length <= (((_existingWallet_externalServerKeyShares = existingWallet.externalServerKeyShares) == null ? void 0 : _existingWallet_externalServerKeyShares.length) || 0)) {
|
|
1059
1018
|
keyshareCheck = true;
|
|
1060
1019
|
}
|
|
1061
1020
|
}
|
|
1062
|
-
|
|
1063
|
-
this.logger.debug('Wallet checks:', {
|
|
1064
|
-
walletCheck,
|
|
1065
|
-
thresholdSignatureSchemeCheck,
|
|
1066
|
-
keyshareCheck,
|
|
1067
|
-
derivationPathCheck,
|
|
1068
|
-
existingWallet: !!existingWallet,
|
|
1069
|
-
keySharesLength: existingWallet == null ? void 0 : (_existingWallet_externalServerKeyShares = existingWallet.externalServerKeyShares) == null ? void 0 : _existingWallet_externalServerKeyShares.length,
|
|
1070
|
-
result
|
|
1071
|
-
});
|
|
1072
|
-
return result;
|
|
1021
|
+
return walletCheck && thresholdSignatureSchemeCheck && keyshareCheck && derivationPathCheck;
|
|
1073
1022
|
}
|
|
1074
1023
|
/**
|
|
1075
1024
|
* verifyPassword attempts to recover and decrypt a single client key share using the provided password.
|
|
@@ -1095,10 +1044,8 @@ class DynamicWalletClient {
|
|
|
1095
1044
|
accountAddress
|
|
1096
1045
|
});
|
|
1097
1046
|
const { dynamic: dynamicKeyShareIds = [] } = backups;
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
if (dynamicKeyShareIds.length === 0 && externalKeyShareIds.length === 0) {
|
|
1101
|
-
throw new Error('No key shares found');
|
|
1047
|
+
if (!dynamicKeyShareIds || dynamicKeyShareIds.length === 0) {
|
|
1048
|
+
throw new Error('No dynamic key shares found');
|
|
1102
1049
|
}
|
|
1103
1050
|
try {
|
|
1104
1051
|
await this.recoverEncryptedBackupByWallet({
|
|
@@ -1143,16 +1090,12 @@ class DynamicWalletClient {
|
|
|
1143
1090
|
if (walletOperation === core.WalletOperation.REACH_ALL_PARTIES || walletOperation === core.WalletOperation.REFRESH || walletOperation === core.WalletOperation.RESHARE) {
|
|
1144
1091
|
return true;
|
|
1145
1092
|
}
|
|
1146
|
-
const {
|
|
1093
|
+
const { requiredShareCount } = this.recoverStrategy({
|
|
1147
1094
|
externalServerKeySharesBackupInfo,
|
|
1148
1095
|
thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme,
|
|
1149
1096
|
walletOperation
|
|
1150
1097
|
});
|
|
1151
|
-
|
|
1152
|
-
const externalKeyShareIds = shares[core.BackupLocation.EXTERNAL] || [];
|
|
1153
|
-
// Check if we have enough shares from either location
|
|
1154
|
-
const totalAvailableShares = externalServerKeyShares.length + dynamicKeyShareIds.length + externalKeyShareIds.length;
|
|
1155
|
-
if (totalAvailableShares >= requiredShareCount) {
|
|
1098
|
+
if (externalServerKeyShares.length >= requiredShareCount) {
|
|
1156
1099
|
return false;
|
|
1157
1100
|
}
|
|
1158
1101
|
return true;
|
|
@@ -1234,8 +1177,8 @@ class DynamicWalletClient {
|
|
|
1234
1177
|
const user = await this.apiClient.getUser(uuid.v4());
|
|
1235
1178
|
const waasWallets = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.filter((vc)=>vc.walletName === 'dynamicwaas');
|
|
1236
1179
|
const wallets = waasWallets.map((vc)=>{
|
|
1237
|
-
var _this_walletMap_vc_address,
|
|
1238
|
-
var
|
|
1180
|
+
var _this_walletMap_vc_address, _this_walletMap_vc_address1, _vc_walletProperties;
|
|
1181
|
+
var _this_walletMap_vc_address_derivationPath;
|
|
1239
1182
|
return {
|
|
1240
1183
|
walletId: vc.id,
|
|
1241
1184
|
chainName: vc.chain,
|
|
@@ -1244,18 +1187,20 @@ class DynamicWalletClient {
|
|
|
1244
1187
|
walletProperties: vc.walletProperties || {}
|
|
1245
1188
|
}),
|
|
1246
1189
|
externalServerKeyShares: ((_this_walletMap_vc_address = this.walletMap[vc.address]) == null ? void 0 : _this_walletMap_vc_address.externalServerKeyShares) || [],
|
|
1247
|
-
derivationPath: (
|
|
1248
|
-
thresholdSignatureScheme: (
|
|
1190
|
+
derivationPath: (_this_walletMap_vc_address_derivationPath = (_this_walletMap_vc_address1 = this.walletMap[vc.address]) == null ? void 0 : _this_walletMap_vc_address1.derivationPath) != null ? _this_walletMap_vc_address_derivationPath : undefined,
|
|
1191
|
+
thresholdSignatureScheme: (_vc_walletProperties = vc.walletProperties) == null ? void 0 : _vc_walletProperties.thresholdSignatureScheme
|
|
1249
1192
|
};
|
|
1250
1193
|
});
|
|
1251
1194
|
this.walletMap = wallets.reduce((acc, wallet)=>{
|
|
1195
|
+
var _acc_accountAddress;
|
|
1196
|
+
const accountAddress = wallet.accountAddress;
|
|
1252
1197
|
acc[wallet.accountAddress] = {
|
|
1253
1198
|
walletId: wallet.walletId,
|
|
1254
1199
|
chainName: wallet.chainName,
|
|
1255
1200
|
accountAddress: wallet.accountAddress,
|
|
1256
1201
|
externalServerKeyShares: wallet.externalServerKeyShares || [],
|
|
1257
1202
|
externalServerKeySharesBackupInfo: wallet.externalServerKeySharesBackupInfo,
|
|
1258
|
-
derivationPath:
|
|
1203
|
+
derivationPath: ((_acc_accountAddress = acc[accountAddress]) == null ? void 0 : _acc_accountAddress.derivationPath) || undefined,
|
|
1259
1204
|
thresholdSignatureScheme: wallet.thresholdSignatureScheme
|
|
1260
1205
|
};
|
|
1261
1206
|
return acc;
|
|
@@ -1275,199 +1220,17 @@ class DynamicWalletClient {
|
|
|
1275
1220
|
}
|
|
1276
1221
|
}
|
|
1277
1222
|
|
|
1278
|
-
const createCore = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug = false })=>{
|
|
1279
|
-
const coreLogger = logger;
|
|
1280
|
-
coreLogger.setLogLevel(debug ? 'DEBUG' : DEFAULT_LOG_LEVEL);
|
|
1281
|
-
const createApiClient = (options = {})=>{
|
|
1282
|
-
return new core.DynamicApiClient(_extends({
|
|
1283
|
-
environmentId,
|
|
1284
|
-
baseApiUrl
|
|
1285
|
-
}, options));
|
|
1286
|
-
};
|
|
1287
|
-
return {
|
|
1288
|
-
environmentId,
|
|
1289
|
-
createApiClient,
|
|
1290
|
-
logger: coreLogger,
|
|
1291
|
-
baseMPCRelayApiUrl,
|
|
1292
|
-
baseApiUrl,
|
|
1293
|
-
debug
|
|
1294
|
-
};
|
|
1295
|
-
};
|
|
1296
|
-
|
|
1297
|
-
// Helper function to create API client for delegated operations
|
|
1298
|
-
const createDelegatedApiClient = (client, options = {})=>{
|
|
1299
|
-
return client.createApiClient(options);
|
|
1300
|
-
};
|
|
1301
|
-
// Helper function to create API client with wallet-specific headers
|
|
1302
|
-
const createDelegatedApiClientWithWalletKey = (client, walletApiKey)=>{
|
|
1303
|
-
const apiClient = client.createApiClient();
|
|
1304
|
-
// Add the wallet-specific API key header to all requests from this client
|
|
1305
|
-
apiClient.apiClient.defaults.headers['x-dyn-wallet-api-key'] = walletApiKey;
|
|
1306
|
-
return apiClient;
|
|
1307
|
-
};
|
|
1308
|
-
const createDelegatedWalletClient = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, apiKey, debug = false })=>{
|
|
1309
|
-
const core = createCore({
|
|
1310
|
-
environmentId,
|
|
1311
|
-
baseApiUrl,
|
|
1312
|
-
baseMPCRelayApiUrl,
|
|
1313
|
-
debug
|
|
1314
|
-
});
|
|
1315
|
-
// Store the API key for use in delegated operations
|
|
1316
|
-
core.apiKey = apiKey;
|
|
1317
|
-
const walletMap = {};
|
|
1318
|
-
const client = {
|
|
1319
|
-
get environmentId () {
|
|
1320
|
-
return core.environmentId;
|
|
1321
|
-
},
|
|
1322
|
-
get debug () {
|
|
1323
|
-
return core.debug;
|
|
1324
|
-
},
|
|
1325
|
-
get wallets () {
|
|
1326
|
-
return walletMap;
|
|
1327
|
-
},
|
|
1328
|
-
createApiClient: (options = {})=>{
|
|
1329
|
-
return core.createApiClient(_extends({
|
|
1330
|
-
authToken: apiKey
|
|
1331
|
-
}, options));
|
|
1332
|
-
},
|
|
1333
|
-
logger: core.logger,
|
|
1334
|
-
apiKey,
|
|
1335
|
-
baseMPCRelayApiUrl: core.baseMPCRelayApiUrl
|
|
1336
|
-
};
|
|
1337
|
-
return client;
|
|
1338
|
-
};
|
|
1339
|
-
|
|
1340
|
-
const dynamicDelegatedSign = async (client, { walletId, message, isFormatted, walletApiKey, onError, context })=>{
|
|
1341
|
-
const dynamicRequestId = uuid.v4();
|
|
1342
|
-
// Convert message to hex if it's a Uint8Array
|
|
1343
|
-
if (typeof message !== 'string') {
|
|
1344
|
-
message = '0x' + Buffer.from(message).toString('hex');
|
|
1345
|
-
}
|
|
1346
|
-
const apiClient = createDelegatedApiClientWithWalletKey(client, walletApiKey);
|
|
1347
|
-
const data = await apiClient.delegatedSignMessage({
|
|
1348
|
-
walletId,
|
|
1349
|
-
message,
|
|
1350
|
-
isFormatted,
|
|
1351
|
-
dynamicRequestId,
|
|
1352
|
-
onError,
|
|
1353
|
-
context: context ? JSON.parse(JSON.stringify(context, (_key, value)=>typeof value === 'bigint' ? value.toString() : value)) : undefined
|
|
1354
|
-
});
|
|
1355
|
-
return data;
|
|
1356
|
-
};
|
|
1357
|
-
const delegatedSign = async (client, { chainName, message, roomId, keyShare, derivationPath, isFormatted })=>{
|
|
1358
|
-
try {
|
|
1359
|
-
const mpcSigner = getMPCSigner({
|
|
1360
|
-
chainName,
|
|
1361
|
-
baseRelayUrl: client.baseMPCRelayApiUrl
|
|
1362
|
-
});
|
|
1363
|
-
const formattedMessage = isFormatted ? new node.MessageHash(message) : formatMessage(chainName, message);
|
|
1364
|
-
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
1365
|
-
return signature;
|
|
1366
|
-
} catch (error) {
|
|
1367
|
-
client.logger.error('Error in delegatedSign', error);
|
|
1368
|
-
throw error;
|
|
1369
|
-
}
|
|
1370
|
-
};
|
|
1371
|
-
const delegatedSignMessage = async (client, { walletId, walletApiKey, keyShare, message, chainName, isFormatted = false, onError, context })=>{
|
|
1372
|
-
// Validate required parameters
|
|
1373
|
-
if (!keyShare) {
|
|
1374
|
-
throw new Error('Delegated key share is required to sign a message');
|
|
1375
|
-
}
|
|
1376
|
-
const wallet = await getWallet(client, {
|
|
1377
|
-
walletId
|
|
1378
|
-
});
|
|
1379
|
-
// Perform the dynamic server sign
|
|
1380
|
-
const data = await dynamicDelegatedSign(client, {
|
|
1381
|
-
walletId,
|
|
1382
|
-
walletApiKey,
|
|
1383
|
-
message,
|
|
1384
|
-
isFormatted,
|
|
1385
|
-
onError,
|
|
1386
|
-
context
|
|
1387
|
-
});
|
|
1388
|
-
const derivationPath = wallet.derivationPath && wallet.derivationPath !== '' ? new Uint32Array(Object.values(JSON.parse(wallet.derivationPath))) : undefined;
|
|
1389
|
-
// Perform the external server sign and return the signature
|
|
1390
|
-
const signature = await delegatedSign(client, {
|
|
1391
|
-
chainName,
|
|
1392
|
-
message,
|
|
1393
|
-
roomId: data.roomId,
|
|
1394
|
-
keyShare,
|
|
1395
|
-
derivationPath,
|
|
1396
|
-
isFormatted
|
|
1397
|
-
});
|
|
1398
|
-
return signature;
|
|
1399
|
-
};
|
|
1400
|
-
// Helper function to get wallet (to be implemented in wallet module)
|
|
1401
|
-
const getWallet = async (client, { walletId })=>{
|
|
1402
|
-
const wallets = client.wallets;
|
|
1403
|
-
// Check if wallet is already cached
|
|
1404
|
-
if (wallets[walletId]) {
|
|
1405
|
-
return wallets[walletId];
|
|
1406
|
-
}
|
|
1407
|
-
// Fetch wallet from API
|
|
1408
|
-
const apiClient = createDelegatedApiClient(client);
|
|
1409
|
-
const { wallet } = await apiClient.getWaasWalletById({
|
|
1410
|
-
walletId
|
|
1411
|
-
});
|
|
1412
|
-
const waasWallet = {
|
|
1413
|
-
walletId,
|
|
1414
|
-
chainName: wallet.chainName,
|
|
1415
|
-
accountAddress: wallet.accountAddress,
|
|
1416
|
-
externalServerKeyShares: [],
|
|
1417
|
-
derivationPath: wallet.derivationPath,
|
|
1418
|
-
thresholdSignatureScheme: wallet.thresholdSignatureScheme,
|
|
1419
|
-
externalServerKeySharesBackupInfo: {
|
|
1420
|
-
passwordEncrypted: false,
|
|
1421
|
-
backups: {
|
|
1422
|
-
dynamic: [],
|
|
1423
|
-
googleDrive: [],
|
|
1424
|
-
iCloud: [],
|
|
1425
|
-
user: [],
|
|
1426
|
-
external: [],
|
|
1427
|
-
delegated: []
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
};
|
|
1431
|
-
// Cache the wallet
|
|
1432
|
-
wallets[walletId] = waasWallet;
|
|
1433
|
-
return waasWallet;
|
|
1434
|
-
};
|
|
1435
|
-
|
|
1436
|
-
const revokeDelegation = async (client, walletId)=>{
|
|
1437
|
-
try {
|
|
1438
|
-
// TODO: Uncomment when API method is implemented
|
|
1439
|
-
// const apiClient = createDelegatedApiClient(client);
|
|
1440
|
-
// await apiClient.revokeDelegation({
|
|
1441
|
-
// walletId,
|
|
1442
|
-
// });
|
|
1443
|
-
client.logger.info(`Delegation revoked for wallet: ${walletId}`);
|
|
1444
|
-
} catch (error) {
|
|
1445
|
-
client.logger.error('Error revoking delegation', error);
|
|
1446
|
-
throw new Error('Failed to revoke delegation');
|
|
1447
|
-
}
|
|
1448
|
-
};
|
|
1449
|
-
|
|
1450
1223
|
Object.defineProperty(exports, "SOLANA_RPC_URL", {
|
|
1451
1224
|
enumerable: true,
|
|
1452
1225
|
get: function () { return core.SOLANA_RPC_URL; }
|
|
1453
1226
|
});
|
|
1454
|
-
Object.defineProperty(exports, "ThresholdSignatureScheme", {
|
|
1455
|
-
enumerable: true,
|
|
1456
|
-
get: function () { return core.ThresholdSignatureScheme; }
|
|
1457
|
-
});
|
|
1458
1227
|
Object.defineProperty(exports, "WalletOperation", {
|
|
1459
1228
|
enumerable: true,
|
|
1460
1229
|
get: function () { return core.WalletOperation; }
|
|
1461
1230
|
});
|
|
1462
|
-
Object.defineProperty(exports, "getMPCChainConfig", {
|
|
1463
|
-
enumerable: true,
|
|
1464
|
-
get: function () { return core.getMPCChainConfig; }
|
|
1465
|
-
});
|
|
1466
1231
|
exports.DynamicWalletClient = DynamicWalletClient;
|
|
1467
1232
|
exports.base64ToBytes = base64ToBytes;
|
|
1468
1233
|
exports.bytesToBase64 = bytesToBase64;
|
|
1469
|
-
exports.createDelegatedWalletClient = createDelegatedWalletClient;
|
|
1470
|
-
exports.delegatedSignMessage = delegatedSignMessage;
|
|
1471
1234
|
exports.ensureBase64Padding = ensureBase64Padding;
|
|
1472
1235
|
exports.formatEvmMessage = formatEvmMessage;
|
|
1473
1236
|
exports.formatMessage = formatMessage;
|
|
@@ -1477,7 +1240,6 @@ exports.getMPCSigner = getMPCSigner;
|
|
|
1477
1240
|
exports.isHexString = isHexString;
|
|
1478
1241
|
exports.mergeUniqueKeyShares = mergeUniqueKeyShares;
|
|
1479
1242
|
exports.retryPromise = retryPromise;
|
|
1480
|
-
exports.revokeDelegation = revokeDelegation;
|
|
1481
1243
|
exports.stringToBytes = stringToBytes;
|
|
1482
1244
|
Object.keys(core$1).forEach(function (k) {
|
|
1483
1245
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '#internal/core';
|
|
2
2
|
import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, BackupLocation, DynamicApiClient, getClientThreshold, MPC_CONFIG, getTSSConfig, WalletOperation, getServerWalletReshareConfig } from '@dynamic-labs-wallet/core';
|
|
3
|
-
export { SOLANA_RPC_URL,
|
|
3
|
+
export { SOLANA_RPC_URL, WalletOperation } from '@dynamic-labs-wallet/core';
|
|
4
4
|
import { BIP340, ExportableEd25519, Ecdsa, MessageHash, EcdsaKeygenResult, ExportableEd25519KeygenResult, BIP340KeygenResult } from '#internal/node';
|
|
5
5
|
import { v4 } from 'uuid';
|
|
6
6
|
import { Logger } from '@dynamic-labs/logger';
|
|
@@ -67,8 +67,7 @@ const getExternalServerKeyShareBackupInfo = (params)=>{
|
|
|
67
67
|
[BackupLocation.GOOGLE_DRIVE]: [],
|
|
68
68
|
[BackupLocation.ICLOUD]: [],
|
|
69
69
|
[BackupLocation.USER]: [],
|
|
70
|
-
[BackupLocation.EXTERNAL]: []
|
|
71
|
-
[BackupLocation.DELEGATED]: []
|
|
70
|
+
[BackupLocation.EXTERNAL]: []
|
|
72
71
|
};
|
|
73
72
|
if (!(params == null ? void 0 : (_params_walletProperties = params.walletProperties) == null ? void 0 : _params_walletProperties.keyShares)) {
|
|
74
73
|
return {
|
|
@@ -239,7 +238,7 @@ const getKey = async ({ password, salt, encryptionConfig })=>{
|
|
|
239
238
|
cipher: bytesToBase64(new Uint8Array(encryptedData)),
|
|
240
239
|
version
|
|
241
240
|
};
|
|
242
|
-
} catch (
|
|
241
|
+
} catch (error) {
|
|
243
242
|
throw new Error('Error encrypting data');
|
|
244
243
|
}
|
|
245
244
|
};
|
|
@@ -480,7 +479,7 @@ class DynamicWalletClient {
|
|
|
480
479
|
externalServerKeyShares: externalServerKeygenResults
|
|
481
480
|
};
|
|
482
481
|
}
|
|
483
|
-
async dynamicServerSign({ walletId, message, isFormatted
|
|
482
|
+
async dynamicServerSign({ walletId, message, isFormatted }) {
|
|
484
483
|
const dynamicRequestId = v4();
|
|
485
484
|
this.ensureApiClientAuthenticated();
|
|
486
485
|
// Create the room and sign the message
|
|
@@ -491,9 +490,7 @@ class DynamicWalletClient {
|
|
|
491
490
|
walletId,
|
|
492
491
|
message,
|
|
493
492
|
isFormatted,
|
|
494
|
-
dynamicRequestId
|
|
495
|
-
context: context ? JSON.parse(JSON.stringify(context, (_key, value)=>typeof value === 'bigint' ? value.toString() : value)) : undefined,
|
|
496
|
-
onError
|
|
493
|
+
dynamicRequestId
|
|
497
494
|
});
|
|
498
495
|
return data;
|
|
499
496
|
}
|
|
@@ -511,45 +508,38 @@ class DynamicWalletClient {
|
|
|
511
508
|
throw error;
|
|
512
509
|
}
|
|
513
510
|
}
|
|
514
|
-
async sign({ accountAddress, externalServerKeyShares, message, chainName, password = undefined, isFormatted = false
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
throw new Error('External server key shares are required to sign a message');
|
|
529
|
-
}
|
|
530
|
-
// Perform the dynamic server sign
|
|
531
|
-
const data = await this.dynamicServerSign({
|
|
532
|
-
walletId: wallet.walletId,
|
|
533
|
-
message,
|
|
534
|
-
isFormatted,
|
|
535
|
-
context,
|
|
536
|
-
onError
|
|
537
|
-
});
|
|
538
|
-
const derivationPath = wallet.derivationPath && wallet.derivationPath != '' ? new Uint32Array(Object.values(JSON.parse(wallet.derivationPath))) : undefined;
|
|
539
|
-
// Perform the external server sign and return the signature
|
|
540
|
-
const signature = await this.externalServerSign({
|
|
541
|
-
chainName,
|
|
542
|
-
message,
|
|
543
|
-
roomId: data.roomId,
|
|
544
|
-
keyShare: externalServerKeyShares[0],
|
|
545
|
-
derivationPath,
|
|
546
|
-
isFormatted
|
|
547
|
-
});
|
|
548
|
-
return signature;
|
|
549
|
-
} catch (error) {
|
|
550
|
-
this.logger.error('Error in sign', error);
|
|
551
|
-
throw error;
|
|
511
|
+
async sign({ accountAddress, externalServerKeyShares, message, chainName, password = undefined, isFormatted = false }) {
|
|
512
|
+
await this.verifyPassword({
|
|
513
|
+
accountAddress,
|
|
514
|
+
password,
|
|
515
|
+
walletOperation: WalletOperation.SIGN_MESSAGE
|
|
516
|
+
});
|
|
517
|
+
const wallet = await this.getWallet({
|
|
518
|
+
accountAddress,
|
|
519
|
+
walletOperation: WalletOperation.SIGN_MESSAGE,
|
|
520
|
+
password
|
|
521
|
+
});
|
|
522
|
+
externalServerKeyShares = externalServerKeyShares != null ? externalServerKeyShares : wallet.externalServerKeyShares;
|
|
523
|
+
if (!externalServerKeyShares) {
|
|
524
|
+
throw new Error('External server key shares are required to sign a message');
|
|
552
525
|
}
|
|
526
|
+
// Perform the dynamic server sign
|
|
527
|
+
const data = await this.dynamicServerSign({
|
|
528
|
+
walletId: wallet.walletId,
|
|
529
|
+
message,
|
|
530
|
+
isFormatted
|
|
531
|
+
});
|
|
532
|
+
const derivationPath = wallet.derivationPath && wallet.derivationPath != '' ? new Uint32Array(Object.values(JSON.parse(wallet.derivationPath))) : undefined;
|
|
533
|
+
// Perform the external server sign and return the signature
|
|
534
|
+
const signature = await this.externalServerSign({
|
|
535
|
+
chainName,
|
|
536
|
+
message,
|
|
537
|
+
roomId: data.roomId,
|
|
538
|
+
keyShare: externalServerKeyShares[0],
|
|
539
|
+
derivationPath,
|
|
540
|
+
isFormatted
|
|
541
|
+
});
|
|
542
|
+
return signature;
|
|
553
543
|
}
|
|
554
544
|
async refreshWalletAccountShares({ accountAddress, chainName, password = undefined, externalServerKeyShares, backUpToClientShareService = false }) {
|
|
555
545
|
this.ensureApiClientAuthenticated();
|
|
@@ -937,14 +927,10 @@ class DynamicWalletClient {
|
|
|
937
927
|
if (shareCount !== undefined) {
|
|
938
928
|
requiredShareCount = shareCount;
|
|
939
929
|
}
|
|
940
|
-
const dynamicShares =
|
|
941
|
-
const externalShares = (backups[BackupLocation.EXTERNAL] || []).slice(0, requiredShareCount);
|
|
942
|
-
// If we have DYNAMIC shares, use those; otherwise use EXTERNAL shares
|
|
943
|
-
const sharesToUse = dynamicShares.length > 0 ? dynamicShares : externalShares;
|
|
944
|
-
const backupLocation = dynamicShares.length > 0 ? BackupLocation.DYNAMIC : BackupLocation.EXTERNAL;
|
|
930
|
+
const dynamicShares = backups[BackupLocation.DYNAMIC].slice(0, requiredShareCount);
|
|
945
931
|
return {
|
|
946
932
|
shares: {
|
|
947
|
-
[
|
|
933
|
+
[BackupLocation.DYNAMIC]: dynamicShares.map((ks)=>{
|
|
948
934
|
var _ks_externalKeyShareId, _ref;
|
|
949
935
|
return (_ref = (_ks_externalKeyShareId = ks.externalKeyShareId) != null ? _ks_externalKeyShareId : ks.keyShareId) != null ? _ref : '';
|
|
950
936
|
})
|
|
@@ -962,24 +948,12 @@ class DynamicWalletClient {
|
|
|
962
948
|
walletOperation,
|
|
963
949
|
shareCount
|
|
964
950
|
});
|
|
965
|
-
|
|
966
|
-
const
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
data = await this.apiClient.recoverEncryptedBackupByWallet({
|
|
972
|
-
walletId: wallet.walletId,
|
|
973
|
-
keyShareIds: dynamicKeyShareIds,
|
|
974
|
-
requiresSignedSessionId: false
|
|
975
|
-
});
|
|
976
|
-
} else if (externalKeyShareIds.length > 0) {
|
|
977
|
-
this.logger.debug('Skipping recovery - only EXTERNAL shares available (backUpToClientShareService: false)');
|
|
978
|
-
return []; // Return empty array since we can't recover EXTERNAL shares via API
|
|
979
|
-
} else {
|
|
980
|
-
this.logger.debug('No shares available for recovery');
|
|
981
|
-
return []; // Return empty array if no shares are available
|
|
982
|
-
}
|
|
951
|
+
const { dynamic: dynamicKeyShareIds } = shares;
|
|
952
|
+
const data = await this.apiClient.recoverEncryptedBackupByWallet({
|
|
953
|
+
walletId: wallet.walletId,
|
|
954
|
+
keyShareIds: dynamicKeyShareIds,
|
|
955
|
+
requiresSignedSessionId: false
|
|
956
|
+
});
|
|
983
957
|
const dynamicKeyShares = data.keyShares.filter((keyShare)=>keyShare.encryptedAccountCredential !== null && keyShare.backupLocation === BackupLocation.DYNAMIC);
|
|
984
958
|
const decryptedKeyShares = await Promise.all(dynamicKeyShares.map((keyShare)=>this.decryptKeyShare({
|
|
985
959
|
keyShare: keyShare.encryptedAccountCredential,
|
|
@@ -1010,7 +984,6 @@ class DynamicWalletClient {
|
|
|
1010
984
|
* @param walletOperation - The wallet operation that determines required fields
|
|
1011
985
|
* @returns boolean indicating if wallet needs to be re-fetched and restored from server
|
|
1012
986
|
*/ async checkWalletFields({ accountAddress, walletOperation = WalletOperation.REACH_THRESHOLD, shareCount }) {
|
|
1013
|
-
var _existingWallet_externalServerKeyShares;
|
|
1014
987
|
let keyshareCheck = false;
|
|
1015
988
|
let walletCheck = false;
|
|
1016
989
|
let thresholdSignatureSchemeCheck = false;
|
|
@@ -1030,7 +1003,7 @@ class DynamicWalletClient {
|
|
|
1030
1003
|
}
|
|
1031
1004
|
// check if wallet already exists with sufficient keyshares
|
|
1032
1005
|
if (existingWallet) {
|
|
1033
|
-
var
|
|
1006
|
+
var _existingWallet_externalServerKeyShares;
|
|
1034
1007
|
const { shares } = this.recoverStrategy({
|
|
1035
1008
|
externalServerKeySharesBackupInfo: existingWallet.externalServerKeySharesBackupInfo || {
|
|
1036
1009
|
backups: getExternalServerKeyShareBackupInfo()
|
|
@@ -1040,35 +1013,11 @@ class DynamicWalletClient {
|
|
|
1040
1013
|
shareCount
|
|
1041
1014
|
});
|
|
1042
1015
|
const { dynamic: requiredDynamicKeyShareIds = [] } = shares;
|
|
1043
|
-
|
|
1044
|
-
// Check if we have enough shares from any backup location
|
|
1045
|
-
const totalRequiredShares = requiredDynamicKeyShareIds.length + requiredExternalKeyShareIds.length;
|
|
1046
|
-
// Check if we have the required shares either loaded OR available in backup
|
|
1047
|
-
const hasLoadedShares = totalRequiredShares <= (((_existingWallet_externalServerKeyShares1 = existingWallet.externalServerKeyShares) == null ? void 0 : _existingWallet_externalServerKeyShares1.length) || 0);
|
|
1048
|
-
// Check if backup contains the specific required share IDs
|
|
1049
|
-
const hasBackupShares = existingWallet.externalServerKeySharesBackupInfo && (()=>{
|
|
1050
|
-
const backupShares = existingWallet.externalServerKeySharesBackupInfo.backups.dynamic;
|
|
1051
|
-
const allRequiredIds = [
|
|
1052
|
-
...requiredDynamicKeyShareIds,
|
|
1053
|
-
...requiredExternalKeyShareIds
|
|
1054
|
-
];
|
|
1055
|
-
return allRequiredIds.every((requiredId)=>backupShares.some((backupShare)=>backupShare.externalKeyShareId === requiredId || backupShare.keyShareId === requiredId));
|
|
1056
|
-
})();
|
|
1057
|
-
if (hasLoadedShares || hasBackupShares) {
|
|
1016
|
+
if (requiredDynamicKeyShareIds.length <= (((_existingWallet_externalServerKeyShares = existingWallet.externalServerKeyShares) == null ? void 0 : _existingWallet_externalServerKeyShares.length) || 0)) {
|
|
1058
1017
|
keyshareCheck = true;
|
|
1059
1018
|
}
|
|
1060
1019
|
}
|
|
1061
|
-
|
|
1062
|
-
this.logger.debug('Wallet checks:', {
|
|
1063
|
-
walletCheck,
|
|
1064
|
-
thresholdSignatureSchemeCheck,
|
|
1065
|
-
keyshareCheck,
|
|
1066
|
-
derivationPathCheck,
|
|
1067
|
-
existingWallet: !!existingWallet,
|
|
1068
|
-
keySharesLength: existingWallet == null ? void 0 : (_existingWallet_externalServerKeyShares = existingWallet.externalServerKeyShares) == null ? void 0 : _existingWallet_externalServerKeyShares.length,
|
|
1069
|
-
result
|
|
1070
|
-
});
|
|
1071
|
-
return result;
|
|
1020
|
+
return walletCheck && thresholdSignatureSchemeCheck && keyshareCheck && derivationPathCheck;
|
|
1072
1021
|
}
|
|
1073
1022
|
/**
|
|
1074
1023
|
* verifyPassword attempts to recover and decrypt a single client key share using the provided password.
|
|
@@ -1094,10 +1043,8 @@ class DynamicWalletClient {
|
|
|
1094
1043
|
accountAddress
|
|
1095
1044
|
});
|
|
1096
1045
|
const { dynamic: dynamicKeyShareIds = [] } = backups;
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
if (dynamicKeyShareIds.length === 0 && externalKeyShareIds.length === 0) {
|
|
1100
|
-
throw new Error('No key shares found');
|
|
1046
|
+
if (!dynamicKeyShareIds || dynamicKeyShareIds.length === 0) {
|
|
1047
|
+
throw new Error('No dynamic key shares found');
|
|
1101
1048
|
}
|
|
1102
1049
|
try {
|
|
1103
1050
|
await this.recoverEncryptedBackupByWallet({
|
|
@@ -1142,16 +1089,12 @@ class DynamicWalletClient {
|
|
|
1142
1089
|
if (walletOperation === WalletOperation.REACH_ALL_PARTIES || walletOperation === WalletOperation.REFRESH || walletOperation === WalletOperation.RESHARE) {
|
|
1143
1090
|
return true;
|
|
1144
1091
|
}
|
|
1145
|
-
const {
|
|
1092
|
+
const { requiredShareCount } = this.recoverStrategy({
|
|
1146
1093
|
externalServerKeySharesBackupInfo,
|
|
1147
1094
|
thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme,
|
|
1148
1095
|
walletOperation
|
|
1149
1096
|
});
|
|
1150
|
-
|
|
1151
|
-
const externalKeyShareIds = shares[BackupLocation.EXTERNAL] || [];
|
|
1152
|
-
// Check if we have enough shares from either location
|
|
1153
|
-
const totalAvailableShares = externalServerKeyShares.length + dynamicKeyShareIds.length + externalKeyShareIds.length;
|
|
1154
|
-
if (totalAvailableShares >= requiredShareCount) {
|
|
1097
|
+
if (externalServerKeyShares.length >= requiredShareCount) {
|
|
1155
1098
|
return false;
|
|
1156
1099
|
}
|
|
1157
1100
|
return true;
|
|
@@ -1233,8 +1176,8 @@ class DynamicWalletClient {
|
|
|
1233
1176
|
const user = await this.apiClient.getUser(v4());
|
|
1234
1177
|
const waasWallets = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.filter((vc)=>vc.walletName === 'dynamicwaas');
|
|
1235
1178
|
const wallets = waasWallets.map((vc)=>{
|
|
1236
|
-
var _this_walletMap_vc_address,
|
|
1237
|
-
var
|
|
1179
|
+
var _this_walletMap_vc_address, _this_walletMap_vc_address1, _vc_walletProperties;
|
|
1180
|
+
var _this_walletMap_vc_address_derivationPath;
|
|
1238
1181
|
return {
|
|
1239
1182
|
walletId: vc.id,
|
|
1240
1183
|
chainName: vc.chain,
|
|
@@ -1243,18 +1186,20 @@ class DynamicWalletClient {
|
|
|
1243
1186
|
walletProperties: vc.walletProperties || {}
|
|
1244
1187
|
}),
|
|
1245
1188
|
externalServerKeyShares: ((_this_walletMap_vc_address = this.walletMap[vc.address]) == null ? void 0 : _this_walletMap_vc_address.externalServerKeyShares) || [],
|
|
1246
|
-
derivationPath: (
|
|
1247
|
-
thresholdSignatureScheme: (
|
|
1189
|
+
derivationPath: (_this_walletMap_vc_address_derivationPath = (_this_walletMap_vc_address1 = this.walletMap[vc.address]) == null ? void 0 : _this_walletMap_vc_address1.derivationPath) != null ? _this_walletMap_vc_address_derivationPath : undefined,
|
|
1190
|
+
thresholdSignatureScheme: (_vc_walletProperties = vc.walletProperties) == null ? void 0 : _vc_walletProperties.thresholdSignatureScheme
|
|
1248
1191
|
};
|
|
1249
1192
|
});
|
|
1250
1193
|
this.walletMap = wallets.reduce((acc, wallet)=>{
|
|
1194
|
+
var _acc_accountAddress;
|
|
1195
|
+
const accountAddress = wallet.accountAddress;
|
|
1251
1196
|
acc[wallet.accountAddress] = {
|
|
1252
1197
|
walletId: wallet.walletId,
|
|
1253
1198
|
chainName: wallet.chainName,
|
|
1254
1199
|
accountAddress: wallet.accountAddress,
|
|
1255
1200
|
externalServerKeyShares: wallet.externalServerKeyShares || [],
|
|
1256
1201
|
externalServerKeySharesBackupInfo: wallet.externalServerKeySharesBackupInfo,
|
|
1257
|
-
derivationPath:
|
|
1202
|
+
derivationPath: ((_acc_accountAddress = acc[accountAddress]) == null ? void 0 : _acc_accountAddress.derivationPath) || undefined,
|
|
1258
1203
|
thresholdSignatureScheme: wallet.thresholdSignatureScheme
|
|
1259
1204
|
};
|
|
1260
1205
|
return acc;
|
|
@@ -1274,176 +1219,4 @@ class DynamicWalletClient {
|
|
|
1274
1219
|
}
|
|
1275
1220
|
}
|
|
1276
1221
|
|
|
1277
|
-
|
|
1278
|
-
const coreLogger = logger;
|
|
1279
|
-
coreLogger.setLogLevel(debug ? 'DEBUG' : DEFAULT_LOG_LEVEL);
|
|
1280
|
-
const createApiClient = (options = {})=>{
|
|
1281
|
-
return new DynamicApiClient(_extends({
|
|
1282
|
-
environmentId,
|
|
1283
|
-
baseApiUrl
|
|
1284
|
-
}, options));
|
|
1285
|
-
};
|
|
1286
|
-
return {
|
|
1287
|
-
environmentId,
|
|
1288
|
-
createApiClient,
|
|
1289
|
-
logger: coreLogger,
|
|
1290
|
-
baseMPCRelayApiUrl,
|
|
1291
|
-
baseApiUrl,
|
|
1292
|
-
debug
|
|
1293
|
-
};
|
|
1294
|
-
};
|
|
1295
|
-
|
|
1296
|
-
// Helper function to create API client for delegated operations
|
|
1297
|
-
const createDelegatedApiClient = (client, options = {})=>{
|
|
1298
|
-
return client.createApiClient(options);
|
|
1299
|
-
};
|
|
1300
|
-
// Helper function to create API client with wallet-specific headers
|
|
1301
|
-
const createDelegatedApiClientWithWalletKey = (client, walletApiKey)=>{
|
|
1302
|
-
const apiClient = client.createApiClient();
|
|
1303
|
-
// Add the wallet-specific API key header to all requests from this client
|
|
1304
|
-
apiClient.apiClient.defaults.headers['x-dyn-wallet-api-key'] = walletApiKey;
|
|
1305
|
-
return apiClient;
|
|
1306
|
-
};
|
|
1307
|
-
const createDelegatedWalletClient = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, apiKey, debug = false })=>{
|
|
1308
|
-
const core = createCore({
|
|
1309
|
-
environmentId,
|
|
1310
|
-
baseApiUrl,
|
|
1311
|
-
baseMPCRelayApiUrl,
|
|
1312
|
-
debug
|
|
1313
|
-
});
|
|
1314
|
-
// Store the API key for use in delegated operations
|
|
1315
|
-
core.apiKey = apiKey;
|
|
1316
|
-
const walletMap = {};
|
|
1317
|
-
const client = {
|
|
1318
|
-
get environmentId () {
|
|
1319
|
-
return core.environmentId;
|
|
1320
|
-
},
|
|
1321
|
-
get debug () {
|
|
1322
|
-
return core.debug;
|
|
1323
|
-
},
|
|
1324
|
-
get wallets () {
|
|
1325
|
-
return walletMap;
|
|
1326
|
-
},
|
|
1327
|
-
createApiClient: (options = {})=>{
|
|
1328
|
-
return core.createApiClient(_extends({
|
|
1329
|
-
authToken: apiKey
|
|
1330
|
-
}, options));
|
|
1331
|
-
},
|
|
1332
|
-
logger: core.logger,
|
|
1333
|
-
apiKey,
|
|
1334
|
-
baseMPCRelayApiUrl: core.baseMPCRelayApiUrl
|
|
1335
|
-
};
|
|
1336
|
-
return client;
|
|
1337
|
-
};
|
|
1338
|
-
|
|
1339
|
-
const dynamicDelegatedSign = async (client, { walletId, message, isFormatted, walletApiKey, onError, context })=>{
|
|
1340
|
-
const dynamicRequestId = v4();
|
|
1341
|
-
// Convert message to hex if it's a Uint8Array
|
|
1342
|
-
if (typeof message !== 'string') {
|
|
1343
|
-
message = '0x' + Buffer.from(message).toString('hex');
|
|
1344
|
-
}
|
|
1345
|
-
const apiClient = createDelegatedApiClientWithWalletKey(client, walletApiKey);
|
|
1346
|
-
const data = await apiClient.delegatedSignMessage({
|
|
1347
|
-
walletId,
|
|
1348
|
-
message,
|
|
1349
|
-
isFormatted,
|
|
1350
|
-
dynamicRequestId,
|
|
1351
|
-
onError,
|
|
1352
|
-
context: context ? JSON.parse(JSON.stringify(context, (_key, value)=>typeof value === 'bigint' ? value.toString() : value)) : undefined
|
|
1353
|
-
});
|
|
1354
|
-
return data;
|
|
1355
|
-
};
|
|
1356
|
-
const delegatedSign = async (client, { chainName, message, roomId, keyShare, derivationPath, isFormatted })=>{
|
|
1357
|
-
try {
|
|
1358
|
-
const mpcSigner = getMPCSigner({
|
|
1359
|
-
chainName,
|
|
1360
|
-
baseRelayUrl: client.baseMPCRelayApiUrl
|
|
1361
|
-
});
|
|
1362
|
-
const formattedMessage = isFormatted ? new MessageHash(message) : formatMessage(chainName, message);
|
|
1363
|
-
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
1364
|
-
return signature;
|
|
1365
|
-
} catch (error) {
|
|
1366
|
-
client.logger.error('Error in delegatedSign', error);
|
|
1367
|
-
throw error;
|
|
1368
|
-
}
|
|
1369
|
-
};
|
|
1370
|
-
const delegatedSignMessage = async (client, { walletId, walletApiKey, keyShare, message, chainName, isFormatted = false, onError, context })=>{
|
|
1371
|
-
// Validate required parameters
|
|
1372
|
-
if (!keyShare) {
|
|
1373
|
-
throw new Error('Delegated key share is required to sign a message');
|
|
1374
|
-
}
|
|
1375
|
-
const wallet = await getWallet(client, {
|
|
1376
|
-
walletId
|
|
1377
|
-
});
|
|
1378
|
-
// Perform the dynamic server sign
|
|
1379
|
-
const data = await dynamicDelegatedSign(client, {
|
|
1380
|
-
walletId,
|
|
1381
|
-
walletApiKey,
|
|
1382
|
-
message,
|
|
1383
|
-
isFormatted,
|
|
1384
|
-
onError,
|
|
1385
|
-
context
|
|
1386
|
-
});
|
|
1387
|
-
const derivationPath = wallet.derivationPath && wallet.derivationPath !== '' ? new Uint32Array(Object.values(JSON.parse(wallet.derivationPath))) : undefined;
|
|
1388
|
-
// Perform the external server sign and return the signature
|
|
1389
|
-
const signature = await delegatedSign(client, {
|
|
1390
|
-
chainName,
|
|
1391
|
-
message,
|
|
1392
|
-
roomId: data.roomId,
|
|
1393
|
-
keyShare,
|
|
1394
|
-
derivationPath,
|
|
1395
|
-
isFormatted
|
|
1396
|
-
});
|
|
1397
|
-
return signature;
|
|
1398
|
-
};
|
|
1399
|
-
// Helper function to get wallet (to be implemented in wallet module)
|
|
1400
|
-
const getWallet = async (client, { walletId })=>{
|
|
1401
|
-
const wallets = client.wallets;
|
|
1402
|
-
// Check if wallet is already cached
|
|
1403
|
-
if (wallets[walletId]) {
|
|
1404
|
-
return wallets[walletId];
|
|
1405
|
-
}
|
|
1406
|
-
// Fetch wallet from API
|
|
1407
|
-
const apiClient = createDelegatedApiClient(client);
|
|
1408
|
-
const { wallet } = await apiClient.getWaasWalletById({
|
|
1409
|
-
walletId
|
|
1410
|
-
});
|
|
1411
|
-
const waasWallet = {
|
|
1412
|
-
walletId,
|
|
1413
|
-
chainName: wallet.chainName,
|
|
1414
|
-
accountAddress: wallet.accountAddress,
|
|
1415
|
-
externalServerKeyShares: [],
|
|
1416
|
-
derivationPath: wallet.derivationPath,
|
|
1417
|
-
thresholdSignatureScheme: wallet.thresholdSignatureScheme,
|
|
1418
|
-
externalServerKeySharesBackupInfo: {
|
|
1419
|
-
passwordEncrypted: false,
|
|
1420
|
-
backups: {
|
|
1421
|
-
dynamic: [],
|
|
1422
|
-
googleDrive: [],
|
|
1423
|
-
iCloud: [],
|
|
1424
|
-
user: [],
|
|
1425
|
-
external: [],
|
|
1426
|
-
delegated: []
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
};
|
|
1430
|
-
// Cache the wallet
|
|
1431
|
-
wallets[walletId] = waasWallet;
|
|
1432
|
-
return waasWallet;
|
|
1433
|
-
};
|
|
1434
|
-
|
|
1435
|
-
const revokeDelegation = async (client, walletId)=>{
|
|
1436
|
-
try {
|
|
1437
|
-
// TODO: Uncomment when API method is implemented
|
|
1438
|
-
// const apiClient = createDelegatedApiClient(client);
|
|
1439
|
-
// await apiClient.revokeDelegation({
|
|
1440
|
-
// walletId,
|
|
1441
|
-
// });
|
|
1442
|
-
client.logger.info(`Delegation revoked for wallet: ${walletId}`);
|
|
1443
|
-
} catch (error) {
|
|
1444
|
-
client.logger.error('Error revoking delegation', error);
|
|
1445
|
-
throw new Error('Failed to revoke delegation');
|
|
1446
|
-
}
|
|
1447
|
-
};
|
|
1448
|
-
|
|
1449
|
-
export { DynamicWalletClient, base64ToBytes, bytesToBase64, createDelegatedWalletClient, delegatedSignMessage, ensureBase64Padding, formatEvmMessage, formatMessage, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, mergeUniqueKeyShares, retryPromise, revokeDelegation, stringToBytes };
|
|
1222
|
+
export { DynamicWalletClient, base64ToBytes, bytesToBase64, ensureBase64Padding, formatEvmMessage, formatMessage, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, mergeUniqueKeyShares, retryPromise, stringToBytes };
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-pr354.0",
|
|
4
4
|
"license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/core": "0.0.0-
|
|
7
|
+
"@dynamic-labs-wallet/core": "0.0.0-pr354.0",
|
|
8
8
|
"@dynamic-labs/logger": "^4.25.3",
|
|
9
|
-
"@dynamic-labs/sdk-api-core": "^0.0.764",
|
|
10
9
|
"uuid": "11.1.0",
|
|
11
10
|
"@noble/hashes": "1.7.1"
|
|
12
11
|
},
|
package/src/client.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { EcdsaKeygenResult, BIP340KeygenResult, type EcdsaPublicKey, type EcdsaSignature } from '#internal/node';
|
|
1
|
+
import { EcdsaKeygenResult, BIP340KeygenResult, type EcdsaPublicKey, type EcdsaSignature, ExportableEd25519KeygenResult } from '#internal/node';
|
|
2
2
|
import { type ThresholdSignatureScheme, DynamicApiClient, WalletOperation, type KeyShareBackupInfo, BackupLocation } from '@dynamic-labs-wallet/core';
|
|
3
|
-
import type { ServerKeyShare } from './mpc/index.js';
|
|
4
3
|
import type { ServerInitKeygenResult } from './mpc/types.js';
|
|
5
4
|
import type { WalletProperties } from './types.js';
|
|
6
|
-
|
|
5
|
+
type ServerKeyShare = EcdsaKeygenResult | BIP340KeygenResult | ExportableEd25519KeygenResult;
|
|
7
6
|
export declare class DynamicWalletClient {
|
|
8
7
|
environmentId: string;
|
|
9
8
|
debug: boolean;
|
|
@@ -68,12 +67,10 @@ export declare class DynamicWalletClient {
|
|
|
68
67
|
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
69
68
|
externalServerKeyShares: ServerKeyShare[];
|
|
70
69
|
}>;
|
|
71
|
-
dynamicServerSign({ walletId, message, isFormatted,
|
|
70
|
+
dynamicServerSign({ walletId, message, isFormatted, }: {
|
|
72
71
|
walletId: string;
|
|
73
72
|
message: string | Uint8Array;
|
|
74
73
|
isFormatted?: boolean;
|
|
75
|
-
context?: SignMessageContext;
|
|
76
|
-
onError?: (error: Error) => void;
|
|
77
74
|
}): Promise<import("@dynamic-labs-wallet/core").OpenRoomResponse>;
|
|
78
75
|
externalServerSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted, }: {
|
|
79
76
|
chainName: string;
|
|
@@ -83,15 +80,13 @@ export declare class DynamicWalletClient {
|
|
|
83
80
|
derivationPath: Uint32Array | undefined;
|
|
84
81
|
isFormatted?: boolean;
|
|
85
82
|
}): Promise<Uint8Array | EcdsaSignature>;
|
|
86
|
-
sign({ accountAddress, externalServerKeyShares, message, chainName, password, isFormatted,
|
|
83
|
+
sign({ accountAddress, externalServerKeyShares, message, chainName, password, isFormatted, }: {
|
|
87
84
|
accountAddress: string;
|
|
88
85
|
externalServerKeyShares?: ServerKeyShare[];
|
|
89
86
|
message: string | Uint8Array;
|
|
90
87
|
chainName: string;
|
|
91
88
|
password?: string;
|
|
92
89
|
isFormatted?: boolean;
|
|
93
|
-
context?: SignMessageContext;
|
|
94
|
-
onError?: (error: Error) => void;
|
|
95
90
|
}): Promise<Uint8Array | EcdsaSignature>;
|
|
96
91
|
refreshWalletAccountShares({ accountAddress, chainName, password, externalServerKeyShares, backUpToClientShareService, }: {
|
|
97
92
|
accountAddress: string;
|
|
@@ -175,7 +170,7 @@ export declare class DynamicWalletClient {
|
|
|
175
170
|
getExternalServerKeyShares({ accountAddress, password, }: {
|
|
176
171
|
accountAddress: string;
|
|
177
172
|
password?: string;
|
|
178
|
-
}): Promise<ServerKeyShare[]>;
|
|
173
|
+
}): Promise<import("./index.js").ServerKeyShare[]>;
|
|
179
174
|
updatePassword({ accountAddress, existingPassword, newPassword, backUpToClientShareService, }: {
|
|
180
175
|
accountAddress: string;
|
|
181
176
|
existingPassword?: string;
|
|
@@ -217,7 +212,7 @@ export declare class DynamicWalletClient {
|
|
|
217
212
|
exportExternalServerKeyShares({ accountAddress, password, }: {
|
|
218
213
|
accountAddress: string;
|
|
219
214
|
password?: string;
|
|
220
|
-
}): Promise<ServerKeyShare[]>;
|
|
215
|
+
}): Promise<import("./index.js").ServerKeyShare[]>;
|
|
221
216
|
/**
|
|
222
217
|
* Helper function to check if the required wallet fields are present and valid
|
|
223
218
|
* @param accountAddress - The account address of the wallet to check
|
|
@@ -263,4 +258,5 @@ export declare class DynamicWalletClient {
|
|
|
263
258
|
}): Promise<WalletProperties>;
|
|
264
259
|
getWallets(): Promise<any>;
|
|
265
260
|
}
|
|
261
|
+
export {};
|
|
266
262
|
//# 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":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,cAAc,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B,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;IA2EK,UAAU;CAuCjB"}
|
package/src/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
export * from '#internal/core';
|
|
2
|
-
export { ThresholdSignatureScheme } from '@dynamic-labs-wallet/core';
|
|
3
|
-
export { WalletOperation, SOLANA_RPC_URL
|
|
2
|
+
export type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/core';
|
|
3
|
+
export { WalletOperation, SOLANA_RPC_URL } from '@dynamic-labs-wallet/core';
|
|
4
4
|
export { getMPCSignatureScheme, getMPCSigner } from './mpc/index.js';
|
|
5
5
|
export type { ServerInitKeygenResult, ServerKeyShare, SignMessage, } from './mpc/index.js';
|
|
6
6
|
export * from './client.js';
|
|
7
7
|
export * from './types.js';
|
|
8
8
|
export * from './utils.js';
|
|
9
|
-
export * from './mpc/index.js';
|
|
10
|
-
export { createDelegatedWalletClient, delegatedSignMessage, revokeDelegation, } from './delegatedClient/index.js';
|
|
11
|
-
export type { DelegatedWalletClient, DelegatedClientConfig, CreateDelegatedClientProps, } from './delegatedClient/index.js';
|
|
12
9
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG5E,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrE,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAGxB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
package/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAExB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,eAAO,MAAM,aAAa,QAAS,UAAU,WAE5C,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,MAAM,eAExC,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,MAAM,eAE3C,CAAC;AAGF,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,MAEjD,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,MAAM,YAKtC,CAAC;AAEF,eAAO,MAAM,mCAAmC,YAAa;IAC3D,gBAAgB,EAAE,oBAAoB,CAAC;CACxC,KAAG,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAExB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,eAAO,MAAM,aAAa,QAAS,UAAU,WAE5C,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,MAAM,eAExC,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,MAAM,eAE3C,CAAC;AAGF,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,MAEjD,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,MAAM,YAKtC,CAAC;AAEF,eAAO,MAAM,mCAAmC,YAAa;IAC3D,gBAAgB,EAAE,oBAAoB,CAAC;CACxC,KAAG,kBAsCH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,sBACZ,cAAc,EAAE,gBACrB,cAAc,EAAE,KAC7B,cAAc,EAchB,CAAC;AAEF,UAAU,WAAW;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,EACE,WAAe,EACf,aAAmB,EACnB,aAA2B,EAC3B,UAAe,GAChB,GAAE,WAAgB,GAClB,OAAO,CAAC,CAAC,CAAC,CA0BZ;AACD,eAAO,MAAM,gBAAgB,YAAa,MAAM,GAAG,UAAU,gBAS5D,CAAC;AAeF,eAAO,MAAM,aAAa,cACb,MAAM,WACR,MAAM,GAAG,UAAU,KAC3B,MAAM,GAAG,UAAU,GAAG,WAWxB,CAAC"}
|
package/src/core/createCore.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { DynamicApiClient } from '@dynamic-labs-wallet/core';
|
|
2
|
-
import { logger } from '../services/logger.js';
|
|
3
|
-
export type CoreConfig = {
|
|
4
|
-
environmentId: string;
|
|
5
|
-
baseApiUrl?: string;
|
|
6
|
-
baseMPCRelayApiUrl?: string;
|
|
7
|
-
debug?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type Core = {
|
|
10
|
-
environmentId: string;
|
|
11
|
-
createApiClient: (options?: Partial<DynamicApiClientConfig>) => DynamicApiClient;
|
|
12
|
-
logger: typeof logger;
|
|
13
|
-
baseMPCRelayApiUrl?: string;
|
|
14
|
-
baseApiUrl?: string;
|
|
15
|
-
debug: boolean;
|
|
16
|
-
apiKey?: string;
|
|
17
|
-
};
|
|
18
|
-
export type DynamicApiClientConfig = {
|
|
19
|
-
environmentId: string;
|
|
20
|
-
authToken?: string;
|
|
21
|
-
baseApiUrl?: string;
|
|
22
|
-
sdkVersion?: string;
|
|
23
|
-
};
|
|
24
|
-
export declare const createCore: ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, }: CoreConfig) => Core;
|
|
25
|
-
//# sourceMappingURL=createCore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createCore.d.ts","sourceRoot":"","sources":["../../src/core/createCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C,MAAM,MAAM,UAAU,GAAG;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,CACf,OAAO,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,KACtC,gBAAgB,CAAC;IACtB,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,8DAKpB,UAAU,KAAG,IAsBf,CAAC"}
|
package/src/core/types.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Core } from './createCore.js';
|
|
2
|
-
export type WithCore<T> = T & {
|
|
3
|
-
_core: Core;
|
|
4
|
-
};
|
|
5
|
-
export declare const assignCore: <T extends object>(target: T, core: Core) => T;
|
|
6
|
-
export declare const getCore: <T extends object>(obj: WithCore<T>) => Core;
|
|
7
|
-
//# sourceMappingURL=types.d.ts.map
|
package/src/core/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG;IAC5B,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,UAAU,CAAC,QAAQ,IAAI,KAAG,CAOpE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAG,IAE5D,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { DynamicApiClient } from '@dynamic-labs-wallet/core';
|
|
2
|
-
import type { WalletProperties } from '../types.js';
|
|
3
|
-
export type DelegatedClientConfig = {
|
|
4
|
-
environmentId: string;
|
|
5
|
-
baseApiUrl?: string;
|
|
6
|
-
baseMPCRelayApiUrl?: string;
|
|
7
|
-
apiKey: string;
|
|
8
|
-
debug?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type DelegatedWalletClient = {
|
|
11
|
-
get environmentId(): string;
|
|
12
|
-
get debug(): boolean;
|
|
13
|
-
get wallets(): Record<string, WalletProperties>;
|
|
14
|
-
createApiClient: (options?: Record<string, any>) => DynamicApiClient;
|
|
15
|
-
logger: any;
|
|
16
|
-
apiKey: string;
|
|
17
|
-
baseMPCRelayApiUrl?: string;
|
|
18
|
-
};
|
|
19
|
-
export type CreateDelegatedClientProps = DelegatedClientConfig;
|
|
20
|
-
export declare const createDelegatedApiClient: (client: DelegatedWalletClient, options?: Record<string, any>) => DynamicApiClient;
|
|
21
|
-
export declare const createDelegatedApiClientWithWalletKey: (client: DelegatedWalletClient, walletApiKey: string) => DynamicApiClient;
|
|
22
|
-
export declare const createDelegatedWalletClient: ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, apiKey, debug, }: CreateDelegatedClientProps) => DelegatedWalletClient;
|
|
23
|
-
//# sourceMappingURL=createDelegatedClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDelegatedClient.d.ts","sourceRoot":"","sources":["../../src/delegatedClient/createDelegatedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,aAAa,IAAI,MAAM,CAAC;IAC5B,IAAI,KAAK,IAAI,OAAO,CAAC;IACrB,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAChD,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,gBAAgB,CAAC;IACrE,MAAM,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,CAAC;AAG/D,eAAO,MAAM,wBAAwB,WAC3B,qBAAqB,YACpB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC3B,gBAEF,CAAC;AAGF,eAAO,MAAM,qCAAqC,WACxC,qBAAqB,gBACf,MAAM,KACnB,gBAOF,CAAC;AAEF,eAAO,MAAM,2BAA2B,sEAMrC,0BAA0B,0BAmC5B,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { createDelegatedWalletClient } from './createDelegatedClient.js';
|
|
2
|
-
export type { DelegatedWalletClient, DelegatedClientConfig, CreateDelegatedClientProps, } from './createDelegatedClient.js';
|
|
3
|
-
export { delegatedSignMessage } from './modules/sign.js';
|
|
4
|
-
export { revokeDelegation } from './modules/revokeDelegation.js';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delegatedClient/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"revokeDelegation.d.ts","sourceRoot":"","sources":["../../../src/delegatedClient/modules/revokeDelegation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAEtB,MAAM,6BAA6B,CAAC;AAErC,eAAO,MAAM,gBAAgB,WACnB,qBAAqB,YACnB,MAAM,KACf,OAAO,CAAC,IAAI,CAad,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { EcdsaSignature } from '#internal/node';
|
|
2
|
-
import type { ServerKeyShare } from '../../mpc/types.js';
|
|
3
|
-
import type { DelegatedWalletClient } from '../createDelegatedClient.js';
|
|
4
|
-
import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
|
|
5
|
-
export declare const dynamicDelegatedSign: (client: DelegatedWalletClient, { walletId, message, isFormatted, walletApiKey, onError, context, }: {
|
|
6
|
-
walletId: string;
|
|
7
|
-
message: string | Uint8Array;
|
|
8
|
-
isFormatted?: boolean;
|
|
9
|
-
walletApiKey: string;
|
|
10
|
-
onError?: (error: Error) => void;
|
|
11
|
-
context?: SignMessageContext;
|
|
12
|
-
}) => Promise<import("@dynamic-labs-wallet/core").OpenRoomResponse>;
|
|
13
|
-
export declare const delegatedSign: (client: DelegatedWalletClient, { chainName, message, roomId, keyShare, derivationPath, isFormatted, }: {
|
|
14
|
-
chainName: string;
|
|
15
|
-
message: string | Uint8Array;
|
|
16
|
-
roomId: string;
|
|
17
|
-
keyShare: ServerKeyShare;
|
|
18
|
-
derivationPath: Uint32Array | undefined;
|
|
19
|
-
isFormatted?: boolean;
|
|
20
|
-
}) => Promise<Uint8Array | EcdsaSignature>;
|
|
21
|
-
export declare const delegatedSignMessage: (client: DelegatedWalletClient, { walletId, walletApiKey, keyShare, message, chainName, isFormatted, onError, context, }: {
|
|
22
|
-
walletId: string;
|
|
23
|
-
walletApiKey: string;
|
|
24
|
-
keyShare: ServerKeyShare;
|
|
25
|
-
message: string | Uint8Array;
|
|
26
|
-
chainName: string;
|
|
27
|
-
isFormatted?: boolean;
|
|
28
|
-
onError?: (error: Error) => void;
|
|
29
|
-
context?: SignMessageContext;
|
|
30
|
-
}) => Promise<Uint8Array | EcdsaSignature>;
|
|
31
|
-
//# sourceMappingURL=sign.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../src/delegatedClient/modules/sign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAOzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,eAAO,MAAM,oBAAoB,WACvB,qBAAqB,uEAQ1B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B,kEA0BF,CAAC;AAEF,eAAO,MAAM,aAAa,WAChB,qBAAqB,0EAQ1B;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,cAAc,CAAC;IACzB,cAAc,EAAE,WAAW,GAAG,SAAS,CAAC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,KACA,OAAO,CAAC,UAAU,GAAG,cAAc,CAuBrC,CAAC;AAEF,eAAO,MAAM,oBAAoB,WACvB,qBAAqB,4FAU1B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,M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