@dynamic-labs-wallet/node 0.0.0-beta.329 → 0.0.0-beta.331

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -6,6 +6,7 @@ var node = require('#internal/node');
6
6
  var uuid = require('uuid');
7
7
  var crypto = require('crypto');
8
8
  var logger$1 = require('@dynamic-labs/logger');
9
+ require('node:crypto');
9
10
 
10
11
  // Removed duplicate exports - these are already exported from #internal/core
11
12
  const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = core.MPC_RELAY_PROD_API_URL })=>{
@@ -81,7 +82,8 @@ const getExternalServerKeyShareBackupInfo = (params)=>{
81
82
  if (backups[keyShare.backupLocation]) {
82
83
  backups[keyShare.backupLocation].push({
83
84
  location: keyShare.backupLocation,
84
- keyShareId: keyShare.id
85
+ keyShareId: keyShare.id,
86
+ passwordEncrypted: keyShare.passwordEncrypted
85
87
  });
86
88
  }
87
89
  });
@@ -536,10 +538,12 @@ class DynamicWalletClient {
536
538
  chainName
537
539
  });
538
540
  this.logger.info('Forward MPC enabled, signing message with forward MPC');
541
+ const environment = core.getEnvironmentFromUrl(this.baseApiUrl);
542
+ const defaultRelayUrl = core.MPC_RELAY_URL_MAP[environment];
539
543
  const signature = await this.apiClient.forwardMPCClient.signMessage({
540
544
  keyshare: keyShare,
541
545
  message: chainName === 'SVM' ? formattedMessage : messageForForwardMPC,
542
- relayDomain: this.baseMPCRelayApiUrl || '',
546
+ relayDomain: this.baseMPCRelayApiUrl || defaultRelayUrl,
543
547
  signingAlgo: chainName === 'EVM' ? 'ECDSA' : 'ED25519',
544
548
  hashAlgo: chainName === 'EVM' && !isFormatted ? 'keccak256' : undefined,
545
549
  derivationPath: derivationPath,
@@ -896,19 +900,21 @@ class DynamicWalletClient {
896
900
  if (!this.walletMap[accountAddress] || !this.walletMap[accountAddress].walletId) {
897
901
  throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
898
902
  }
903
+ const passwordEncryptedFlag = Boolean(password) && password !== this.environmentId;
899
904
  const locations = [];
900
905
  if (backUpToClientShareService) {
901
906
  const data = await this.apiClient.storeEncryptedBackupByWallet({
902
907
  walletId: this.walletMap[accountAddress].walletId,
903
908
  encryptedKeyShares: encryptedKeyShares,
904
- passwordEncrypted: Boolean(password) && password !== this.environmentId,
909
+ passwordEncrypted: passwordEncryptedFlag,
905
910
  encryptionVersion: ENCRYPTION_VERSION_CURRENT,
906
911
  requiresSignedSessionId: false,
907
912
  dynamicRequestId
908
913
  });
909
914
  locations.push({
910
915
  location: core.BackupLocation.DYNAMIC,
911
- externalKeyShareId: data.keyShareIds[0]
916
+ externalKeyShareId: data.keyShareIds[0],
917
+ passwordEncrypted: passwordEncryptedFlag
912
918
  });
913
919
  } else {
914
920
  locations.push({
@@ -927,7 +933,7 @@ class DynamicWalletClient {
927
933
  id: ks.keyShareId,
928
934
  backupLocation: ks.location,
929
935
  externalKeyShareId: ks.externalKeyShareId,
930
- passwordEncrypted: Boolean(password) && password !== this.environmentId
936
+ passwordEncrypted: passwordEncryptedFlag
931
937
  })),
932
938
  thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme
933
939
  }
@@ -959,12 +965,25 @@ class DynamicWalletClient {
959
965
  });
960
966
  }
961
967
  async getExternalServerKeyShares({ accountAddress, password }) {
968
+ var _wallet_externalServerKeySharesBackupInfo_backups, _wallet_externalServerKeySharesBackupInfo;
962
969
  const wallet = await this.getWallet({
963
970
  accountAddress,
964
971
  password,
965
972
  walletOperation: core.WalletOperation.REACH_THRESHOLD
966
973
  });
967
- return wallet.externalServerKeyShares;
974
+ // Check if the wallet has a dynamic backup and derive password encryption status from the first dynamic share
975
+ const dynamicBackups = (wallet == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups = _wallet_externalServerKeySharesBackupInfo.backups) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo_backups.dynamic) || [];
976
+ const passwordEncrypted = dynamicBackups.length > 0 ? Boolean(dynamicBackups[0].passwordEncrypted) : false;
977
+ if (passwordEncrypted && !password) {
978
+ throw new Error('Password is required for decryption but not provided. This backup was encrypted with a password.');
979
+ }
980
+ // recover the shares
981
+ const recoveredShares = await this.recoverEncryptedBackupByWallet({
982
+ accountAddress,
983
+ password,
984
+ walletOperation: core.WalletOperation.REACH_THRESHOLD
985
+ });
986
+ return recoveredShares;
968
987
  }
969
988
  async updatePassword({ accountAddress, existingPassword, newPassword, backUpToClientShareService }) {
970
989
  await this.getWallet({
@@ -1021,9 +1040,42 @@ class DynamicWalletClient {
1021
1040
  requiredShareCount
1022
1041
  };
1023
1042
  }
1043
+ /**
1044
+ * Attempts to recover key shares from backup if they are not provided.
1045
+ * The recovered shares will be stored in the wallet map for use in signing operations.
1046
+ * @param accountAddress - The account address to recover shares for
1047
+ * @param password - The password to decrypt the shares
1048
+ * @param walletOperation - The wallet operation being performed
1049
+ * @param externalServerKeyShares - The provided key shares (if any)
1050
+ * @param errorMessage - The error message to throw if recovery fails
1051
+ * @throws Error if recovery is needed but fails
1052
+ */ async ensureKeySharesRecovered({ accountAddress, password, walletOperation, externalServerKeyShares, errorMessage }) {
1053
+ if (!externalServerKeyShares || externalServerKeyShares.length === 0) {
1054
+ // attempt to recover dynamic keyshares if no key shares are provided
1055
+ // the shares will be used for signing in the node SDK if successful
1056
+ const recoveredShares = await this.recoverEncryptedBackupByWallet({
1057
+ accountAddress,
1058
+ password,
1059
+ walletOperation,
1060
+ storeRecoveredShares: true
1061
+ });
1062
+ // If recovery returned empty and no shares were provided, throw error
1063
+ if (!recoveredShares || recoveredShares.length === 0) {
1064
+ throw new Error(errorMessage);
1065
+ }
1066
+ }
1067
+ }
1024
1068
  async recoverEncryptedBackupByWallet({ accountAddress, password, walletOperation, shareCount = undefined, storeRecoveredShares = true }) {
1069
+ var _wallet_externalServerKeySharesBackupInfo;
1025
1070
  this.ensureApiClientAuthenticated();
1026
- const wallet = this.walletMap[accountAddress];
1071
+ let wallet = this.walletMap[accountAddress];
1072
+ if (!wallet) {
1073
+ const fetchedWallet = await this.getWalletByAddress(accountAddress);
1074
+ if (!fetchedWallet) {
1075
+ throw new Error(`Wallet not found for address 1: ${accountAddress}`);
1076
+ }
1077
+ wallet = fetchedWallet;
1078
+ }
1027
1079
  this.logger.debug(`recoverEncryptedBackupByWallet wallet: ${walletOperation}`, wallet);
1028
1080
  const { shares } = this.recoverStrategy({
1029
1081
  externalServerKeySharesBackupInfo: wallet.externalServerKeySharesBackupInfo,
@@ -1050,6 +1102,11 @@ class DynamicWalletClient {
1050
1102
  return []; // Return empty array if no shares are available
1051
1103
  }
1052
1104
  const dynamicKeyShares = data.keyShares.filter((keyShare)=>keyShare.encryptedAccountCredential !== null && keyShare.backupLocation === core.BackupLocation.DYNAMIC);
1105
+ var _wallet_externalServerKeySharesBackupInfo_passwordEncrypted;
1106
+ const isPasswordEncrypted = (_wallet_externalServerKeySharesBackupInfo_passwordEncrypted = (_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo.passwordEncrypted) != null ? _wallet_externalServerKeySharesBackupInfo_passwordEncrypted : false;
1107
+ if (isPasswordEncrypted && !password) {
1108
+ throw new Error('Password is required for decryption but not provided. This backup was encrypted with a password.');
1109
+ }
1053
1110
  const decryptedKeyShares = await Promise.all(dynamicKeyShares.map((keyShare)=>this.decryptKeyShare({
1054
1111
  keyShare: keyShare.encryptedAccountCredential,
1055
1112
  password: password != null ? password : this.environmentId
@@ -1226,23 +1283,29 @@ class DynamicWalletClient {
1226
1283
  return true;
1227
1284
  }
1228
1285
  async getWalletExternalServerKeyShareBackupInfo({ accountAddress }) {
1229
- var _this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC, _this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups, _this_walletMap_accountAddress_externalServerKeySharesBackupInfo, _this_walletMap_accountAddress, _user_verifiedCredentials;
1286
+ var _wallet_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC, _wallet_externalServerKeySharesBackupInfo_backups, _wallet_externalServerKeySharesBackupInfo, _user_verifiedCredentials;
1230
1287
  this.ensureApiClientAuthenticated();
1288
+ let wallet = this.walletMap[accountAddress];
1289
+ if (!wallet) {
1290
+ const fetchedWallet = await this.getWalletByAddress(accountAddress);
1291
+ if (!fetchedWallet) {
1292
+ throw new Error(`Wallet not found for address 2: ${accountAddress}`);
1293
+ }
1294
+ wallet = fetchedWallet;
1295
+ }
1231
1296
  // Return existing backup info if it exists
1232
- if (((_this_walletMap_accountAddress = this.walletMap[accountAddress]) == null ? void 0 : (_this_walletMap_accountAddress_externalServerKeySharesBackupInfo = _this_walletMap_accountAddress.externalServerKeySharesBackupInfo) == null ? void 0 : (_this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups = _this_walletMap_accountAddress_externalServerKeySharesBackupInfo.backups) == null ? void 0 : (_this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC = _this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups[core.BackupLocation.DYNAMIC]) == null ? void 0 : _this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC.length) > 0) {
1233
- return this.walletMap[accountAddress].externalServerKeySharesBackupInfo;
1297
+ if (((_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups = _wallet_externalServerKeySharesBackupInfo.backups) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC = _wallet_externalServerKeySharesBackupInfo_backups[core.BackupLocation.DYNAMIC]) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC.length) > 0) {
1298
+ return wallet.externalServerKeySharesBackupInfo;
1234
1299
  }
1235
1300
  // Get backup info from server
1236
1301
  const user = await this.apiClient.getUser(uuid.v4());
1237
- const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
1302
+ const walletData = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
1238
1303
  return getExternalServerKeyShareBackupInfo({
1239
- walletProperties: wallet == null ? void 0 : wallet.walletProperties
1304
+ walletProperties: walletData == null ? void 0 : walletData.walletProperties
1240
1305
  });
1241
1306
  }
1242
1307
  async getWallet({ accountAddress, walletOperation = core.WalletOperation.NO_OPERATION, shareCount = undefined, password = undefined }) {
1243
- const dynamicRequestId = uuid.v4();
1244
1308
  try {
1245
- var _user_verifiedCredentials;
1246
1309
  this.ensureApiClientAuthenticated();
1247
1310
  const existingWalletCheck = await this.checkWalletFields({
1248
1311
  accountAddress,
@@ -1253,22 +1316,13 @@ class DynamicWalletClient {
1253
1316
  this.logger.debug(`Wallet ${accountAddress} already exists`);
1254
1317
  return this.walletMap[accountAddress];
1255
1318
  }
1256
- //todo: Question - why don't we just call getWallets here? so then all are preloaded
1257
- // Fetch and restore wallet from server
1258
- const user = await this.apiClient.getUser(dynamicRequestId);
1259
- const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
1319
+ const wallet = await this.getWalletByAddress(accountAddress);
1320
+ if (!wallet) {
1321
+ throw new Error(`Wallet not found for address 3: ${accountAddress}`);
1322
+ }
1260
1323
  this.logger.debug('Restoring wallet', wallet);
1261
- const walletProperties = wallet.walletProperties;
1262
- this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
1263
- walletId: wallet.id,
1264
- chainName: wallet.chainName,
1265
- accountAddress,
1266
- thresholdSignatureScheme: walletProperties.thresholdSignatureScheme,
1267
- derivationPath: walletProperties.derivationPath,
1268
- externalServerKeySharesBackupInfo: getExternalServerKeyShareBackupInfo({
1269
- walletProperties
1270
- })
1271
- });
1324
+ // The wallet is already processed, so we can use it directly
1325
+ this.walletMap[accountAddress] = wallet;
1272
1326
  if (walletOperation !== core.WalletOperation.NO_OPERATION && await this.requiresRestoreBackupSharesForOperation({
1273
1327
  accountAddress,
1274
1328
  walletOperation
@@ -1296,7 +1350,74 @@ class DynamicWalletClient {
1296
1350
  throw error;
1297
1351
  }
1298
1352
  }
1299
- async getWallets() {
1353
+ /**
1354
+ * Get a single wallet by address
1355
+ * First tries the efficient getWaasWalletByAddress endpoint, falls back to getUser() if not available
1356
+ */ async getWalletByAddress(accountAddress) {
1357
+ // Return cached wallet if available
1358
+ if (this.walletMap[accountAddress]) {
1359
+ return this.walletMap[accountAddress];
1360
+ }
1361
+ this.ensureApiClientAuthenticated();
1362
+ // Try getting single wallet by address first
1363
+ try {
1364
+ var _walletResponse_wallet;
1365
+ const walletResponse = await this.apiClient.getWaasWalletByAddress({
1366
+ walletAddress: accountAddress
1367
+ });
1368
+ const walletProperties = {
1369
+ walletId: walletResponse.wallet.walletId,
1370
+ chainName: walletResponse.wallet.chainName,
1371
+ accountAddress: walletResponse.wallet.accountAddress,
1372
+ externalServerKeyShares: [],
1373
+ derivationPath: walletResponse.wallet.derivationPath,
1374
+ thresholdSignatureScheme: walletResponse.wallet.thresholdSignatureScheme,
1375
+ externalServerKeySharesBackupInfo: getExternalServerKeyShareBackupInfo({
1376
+ walletProperties: {
1377
+ keyShares: ((_walletResponse_wallet = walletResponse.wallet) == null ? void 0 : _walletResponse_wallet.keyShares) || [],
1378
+ thresholdSignatureScheme: walletResponse.wallet.thresholdSignatureScheme,
1379
+ derivationPath: walletResponse.wallet.derivationPath
1380
+ }
1381
+ })
1382
+ };
1383
+ // Cache the wallet
1384
+ this.walletMap[accountAddress] = walletProperties;
1385
+ return walletProperties;
1386
+ } catch (error) {
1387
+ var _error_response;
1388
+ // If the new endpoint doesn't exist (404 or not implemented), fall back to getUser()
1389
+ if ((error == null ? void 0 : (_error_response = error.response) == null ? void 0 : _error_response.status) === 404 || (error == null ? void 0 : error.code) === 'ERR_BAD_REQUEST') {
1390
+ var _user_verifiedCredentials, _wallet_walletProperties, _wallet_walletProperties1;
1391
+ this.logger.debug('getWaasWalletByAddress endpoint not available, falling back to getUser()');
1392
+ // Fallback to getUser() approach
1393
+ const user = await this.apiClient.getUser(uuid.v4());
1394
+ const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.walletName === 'dynamicwaas' && vc.address.toLowerCase() === accountAddress.toLowerCase());
1395
+ if (!wallet) {
1396
+ return null;
1397
+ }
1398
+ var _wallet_walletProperties_derivationPath;
1399
+ const walletProperties = {
1400
+ walletId: wallet.id,
1401
+ chainName: wallet.chain,
1402
+ accountAddress: wallet.address,
1403
+ externalServerKeyShares: [],
1404
+ derivationPath: (_wallet_walletProperties_derivationPath = (_wallet_walletProperties = wallet.walletProperties) == null ? void 0 : _wallet_walletProperties.derivationPath) != null ? _wallet_walletProperties_derivationPath : undefined,
1405
+ thresholdSignatureScheme: (_wallet_walletProperties1 = wallet.walletProperties) == null ? void 0 : _wallet_walletProperties1.thresholdSignatureScheme,
1406
+ externalServerKeySharesBackupInfo: getExternalServerKeyShareBackupInfo({
1407
+ walletProperties: wallet.walletProperties || {}
1408
+ })
1409
+ };
1410
+ // Cache the wallet
1411
+ this.walletMap[accountAddress] = walletProperties;
1412
+ return walletProperties;
1413
+ }
1414
+ throw error;
1415
+ }
1416
+ }
1417
+ /**
1418
+ * Get all wallets (kept for backward compatibility but now uses lazy loading)
1419
+ * @deprecated Consider using getWalletByAddress for better performance with large wallet counts
1420
+ */ async getWallets() {
1300
1421
  var _user_verifiedCredentials;
1301
1422
  this.ensureApiClientAuthenticated();
1302
1423
  const user = await this.apiClient.getUser(uuid.v4());
package/index.esm.js CHANGED
@@ -1,10 +1,11 @@
1
1
  export * from '#internal/core';
2
- import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, BackupLocation, DynamicApiClient, getClientThreshold, MPC_CONFIG, getTSSConfig, serializeMessageForForwardMPC, WalletOperation, getServerWalletReshareConfig } from '@dynamic-labs-wallet/core';
2
+ import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, BackupLocation, DynamicApiClient, getClientThreshold, MPC_CONFIG, getTSSConfig, serializeMessageForForwardMPC, getEnvironmentFromUrl, MPC_RELAY_URL_MAP, WalletOperation, getServerWalletReshareConfig } from '@dynamic-labs-wallet/core';
3
3
  export { SOLANA_RPC_URL, ThresholdSignatureScheme, WalletOperation, getMPCChainConfig } from '@dynamic-labs-wallet/core';
4
4
  import { BIP340, ExportableEd25519, Ecdsa, MessageHash, EcdsaSignature, EcdsaKeygenResult, ExportableEd25519KeygenResult, BIP340KeygenResult } from '#internal/node';
5
5
  import { v4 } from 'uuid';
6
6
  import crypto from 'crypto';
7
7
  import { Logger } from '@dynamic-labs/logger';
8
+ import 'node:crypto';
8
9
 
9
10
  // Removed duplicate exports - these are already exported from #internal/core
10
11
  const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = MPC_RELAY_PROD_API_URL })=>{
@@ -80,7 +81,8 @@ const getExternalServerKeyShareBackupInfo = (params)=>{
80
81
  if (backups[keyShare.backupLocation]) {
81
82
  backups[keyShare.backupLocation].push({
82
83
  location: keyShare.backupLocation,
83
- keyShareId: keyShare.id
84
+ keyShareId: keyShare.id,
85
+ passwordEncrypted: keyShare.passwordEncrypted
84
86
  });
85
87
  }
86
88
  });
@@ -535,10 +537,12 @@ class DynamicWalletClient {
535
537
  chainName
536
538
  });
537
539
  this.logger.info('Forward MPC enabled, signing message with forward MPC');
540
+ const environment = getEnvironmentFromUrl(this.baseApiUrl);
541
+ const defaultRelayUrl = MPC_RELAY_URL_MAP[environment];
538
542
  const signature = await this.apiClient.forwardMPCClient.signMessage({
539
543
  keyshare: keyShare,
540
544
  message: chainName === 'SVM' ? formattedMessage : messageForForwardMPC,
541
- relayDomain: this.baseMPCRelayApiUrl || '',
545
+ relayDomain: this.baseMPCRelayApiUrl || defaultRelayUrl,
542
546
  signingAlgo: chainName === 'EVM' ? 'ECDSA' : 'ED25519',
543
547
  hashAlgo: chainName === 'EVM' && !isFormatted ? 'keccak256' : undefined,
544
548
  derivationPath: derivationPath,
@@ -895,19 +899,21 @@ class DynamicWalletClient {
895
899
  if (!this.walletMap[accountAddress] || !this.walletMap[accountAddress].walletId) {
896
900
  throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
897
901
  }
902
+ const passwordEncryptedFlag = Boolean(password) && password !== this.environmentId;
898
903
  const locations = [];
899
904
  if (backUpToClientShareService) {
900
905
  const data = await this.apiClient.storeEncryptedBackupByWallet({
901
906
  walletId: this.walletMap[accountAddress].walletId,
902
907
  encryptedKeyShares: encryptedKeyShares,
903
- passwordEncrypted: Boolean(password) && password !== this.environmentId,
908
+ passwordEncrypted: passwordEncryptedFlag,
904
909
  encryptionVersion: ENCRYPTION_VERSION_CURRENT,
905
910
  requiresSignedSessionId: false,
906
911
  dynamicRequestId
907
912
  });
908
913
  locations.push({
909
914
  location: BackupLocation.DYNAMIC,
910
- externalKeyShareId: data.keyShareIds[0]
915
+ externalKeyShareId: data.keyShareIds[0],
916
+ passwordEncrypted: passwordEncryptedFlag
911
917
  });
912
918
  } else {
913
919
  locations.push({
@@ -926,7 +932,7 @@ class DynamicWalletClient {
926
932
  id: ks.keyShareId,
927
933
  backupLocation: ks.location,
928
934
  externalKeyShareId: ks.externalKeyShareId,
929
- passwordEncrypted: Boolean(password) && password !== this.environmentId
935
+ passwordEncrypted: passwordEncryptedFlag
930
936
  })),
931
937
  thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme
932
938
  }
@@ -958,12 +964,25 @@ class DynamicWalletClient {
958
964
  });
959
965
  }
960
966
  async getExternalServerKeyShares({ accountAddress, password }) {
967
+ var _wallet_externalServerKeySharesBackupInfo_backups, _wallet_externalServerKeySharesBackupInfo;
961
968
  const wallet = await this.getWallet({
962
969
  accountAddress,
963
970
  password,
964
971
  walletOperation: WalletOperation.REACH_THRESHOLD
965
972
  });
966
- return wallet.externalServerKeyShares;
973
+ // Check if the wallet has a dynamic backup and derive password encryption status from the first dynamic share
974
+ const dynamicBackups = (wallet == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups = _wallet_externalServerKeySharesBackupInfo.backups) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo_backups.dynamic) || [];
975
+ const passwordEncrypted = dynamicBackups.length > 0 ? Boolean(dynamicBackups[0].passwordEncrypted) : false;
976
+ if (passwordEncrypted && !password) {
977
+ throw new Error('Password is required for decryption but not provided. This backup was encrypted with a password.');
978
+ }
979
+ // recover the shares
980
+ const recoveredShares = await this.recoverEncryptedBackupByWallet({
981
+ accountAddress,
982
+ password,
983
+ walletOperation: WalletOperation.REACH_THRESHOLD
984
+ });
985
+ return recoveredShares;
967
986
  }
968
987
  async updatePassword({ accountAddress, existingPassword, newPassword, backUpToClientShareService }) {
969
988
  await this.getWallet({
@@ -1020,9 +1039,42 @@ class DynamicWalletClient {
1020
1039
  requiredShareCount
1021
1040
  };
1022
1041
  }
1042
+ /**
1043
+ * Attempts to recover key shares from backup if they are not provided.
1044
+ * The recovered shares will be stored in the wallet map for use in signing operations.
1045
+ * @param accountAddress - The account address to recover shares for
1046
+ * @param password - The password to decrypt the shares
1047
+ * @param walletOperation - The wallet operation being performed
1048
+ * @param externalServerKeyShares - The provided key shares (if any)
1049
+ * @param errorMessage - The error message to throw if recovery fails
1050
+ * @throws Error if recovery is needed but fails
1051
+ */ async ensureKeySharesRecovered({ accountAddress, password, walletOperation, externalServerKeyShares, errorMessage }) {
1052
+ if (!externalServerKeyShares || externalServerKeyShares.length === 0) {
1053
+ // attempt to recover dynamic keyshares if no key shares are provided
1054
+ // the shares will be used for signing in the node SDK if successful
1055
+ const recoveredShares = await this.recoverEncryptedBackupByWallet({
1056
+ accountAddress,
1057
+ password,
1058
+ walletOperation,
1059
+ storeRecoveredShares: true
1060
+ });
1061
+ // If recovery returned empty and no shares were provided, throw error
1062
+ if (!recoveredShares || recoveredShares.length === 0) {
1063
+ throw new Error(errorMessage);
1064
+ }
1065
+ }
1066
+ }
1023
1067
  async recoverEncryptedBackupByWallet({ accountAddress, password, walletOperation, shareCount = undefined, storeRecoveredShares = true }) {
1068
+ var _wallet_externalServerKeySharesBackupInfo;
1024
1069
  this.ensureApiClientAuthenticated();
1025
- const wallet = this.walletMap[accountAddress];
1070
+ let wallet = this.walletMap[accountAddress];
1071
+ if (!wallet) {
1072
+ const fetchedWallet = await this.getWalletByAddress(accountAddress);
1073
+ if (!fetchedWallet) {
1074
+ throw new Error(`Wallet not found for address 1: ${accountAddress}`);
1075
+ }
1076
+ wallet = fetchedWallet;
1077
+ }
1026
1078
  this.logger.debug(`recoverEncryptedBackupByWallet wallet: ${walletOperation}`, wallet);
1027
1079
  const { shares } = this.recoverStrategy({
1028
1080
  externalServerKeySharesBackupInfo: wallet.externalServerKeySharesBackupInfo,
@@ -1049,6 +1101,11 @@ class DynamicWalletClient {
1049
1101
  return []; // Return empty array if no shares are available
1050
1102
  }
1051
1103
  const dynamicKeyShares = data.keyShares.filter((keyShare)=>keyShare.encryptedAccountCredential !== null && keyShare.backupLocation === BackupLocation.DYNAMIC);
1104
+ var _wallet_externalServerKeySharesBackupInfo_passwordEncrypted;
1105
+ const isPasswordEncrypted = (_wallet_externalServerKeySharesBackupInfo_passwordEncrypted = (_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo.passwordEncrypted) != null ? _wallet_externalServerKeySharesBackupInfo_passwordEncrypted : false;
1106
+ if (isPasswordEncrypted && !password) {
1107
+ throw new Error('Password is required for decryption but not provided. This backup was encrypted with a password.');
1108
+ }
1052
1109
  const decryptedKeyShares = await Promise.all(dynamicKeyShares.map((keyShare)=>this.decryptKeyShare({
1053
1110
  keyShare: keyShare.encryptedAccountCredential,
1054
1111
  password: password != null ? password : this.environmentId
@@ -1225,23 +1282,29 @@ class DynamicWalletClient {
1225
1282
  return true;
1226
1283
  }
1227
1284
  async getWalletExternalServerKeyShareBackupInfo({ accountAddress }) {
1228
- var _this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC, _this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups, _this_walletMap_accountAddress_externalServerKeySharesBackupInfo, _this_walletMap_accountAddress, _user_verifiedCredentials;
1285
+ var _wallet_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC, _wallet_externalServerKeySharesBackupInfo_backups, _wallet_externalServerKeySharesBackupInfo, _user_verifiedCredentials;
1229
1286
  this.ensureApiClientAuthenticated();
1287
+ let wallet = this.walletMap[accountAddress];
1288
+ if (!wallet) {
1289
+ const fetchedWallet = await this.getWalletByAddress(accountAddress);
1290
+ if (!fetchedWallet) {
1291
+ throw new Error(`Wallet not found for address 2: ${accountAddress}`);
1292
+ }
1293
+ wallet = fetchedWallet;
1294
+ }
1230
1295
  // Return existing backup info if it exists
1231
- if (((_this_walletMap_accountAddress = this.walletMap[accountAddress]) == null ? void 0 : (_this_walletMap_accountAddress_externalServerKeySharesBackupInfo = _this_walletMap_accountAddress.externalServerKeySharesBackupInfo) == null ? void 0 : (_this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups = _this_walletMap_accountAddress_externalServerKeySharesBackupInfo.backups) == null ? void 0 : (_this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC = _this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups[BackupLocation.DYNAMIC]) == null ? void 0 : _this_walletMap_accountAddress_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC.length) > 0) {
1232
- return this.walletMap[accountAddress].externalServerKeySharesBackupInfo;
1296
+ if (((_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups = _wallet_externalServerKeySharesBackupInfo.backups) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC = _wallet_externalServerKeySharesBackupInfo_backups[BackupLocation.DYNAMIC]) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC.length) > 0) {
1297
+ return wallet.externalServerKeySharesBackupInfo;
1233
1298
  }
1234
1299
  // Get backup info from server
1235
1300
  const user = await this.apiClient.getUser(v4());
1236
- const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
1301
+ const walletData = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
1237
1302
  return getExternalServerKeyShareBackupInfo({
1238
- walletProperties: wallet == null ? void 0 : wallet.walletProperties
1303
+ walletProperties: walletData == null ? void 0 : walletData.walletProperties
1239
1304
  });
1240
1305
  }
1241
1306
  async getWallet({ accountAddress, walletOperation = WalletOperation.NO_OPERATION, shareCount = undefined, password = undefined }) {
1242
- const dynamicRequestId = v4();
1243
1307
  try {
1244
- var _user_verifiedCredentials;
1245
1308
  this.ensureApiClientAuthenticated();
1246
1309
  const existingWalletCheck = await this.checkWalletFields({
1247
1310
  accountAddress,
@@ -1252,22 +1315,13 @@ class DynamicWalletClient {
1252
1315
  this.logger.debug(`Wallet ${accountAddress} already exists`);
1253
1316
  return this.walletMap[accountAddress];
1254
1317
  }
1255
- //todo: Question - why don't we just call getWallets here? so then all are preloaded
1256
- // Fetch and restore wallet from server
1257
- const user = await this.apiClient.getUser(dynamicRequestId);
1258
- const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
1318
+ const wallet = await this.getWalletByAddress(accountAddress);
1319
+ if (!wallet) {
1320
+ throw new Error(`Wallet not found for address 3: ${accountAddress}`);
1321
+ }
1259
1322
  this.logger.debug('Restoring wallet', wallet);
1260
- const walletProperties = wallet.walletProperties;
1261
- this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
1262
- walletId: wallet.id,
1263
- chainName: wallet.chainName,
1264
- accountAddress,
1265
- thresholdSignatureScheme: walletProperties.thresholdSignatureScheme,
1266
- derivationPath: walletProperties.derivationPath,
1267
- externalServerKeySharesBackupInfo: getExternalServerKeyShareBackupInfo({
1268
- walletProperties
1269
- })
1270
- });
1323
+ // The wallet is already processed, so we can use it directly
1324
+ this.walletMap[accountAddress] = wallet;
1271
1325
  if (walletOperation !== WalletOperation.NO_OPERATION && await this.requiresRestoreBackupSharesForOperation({
1272
1326
  accountAddress,
1273
1327
  walletOperation
@@ -1295,7 +1349,74 @@ class DynamicWalletClient {
1295
1349
  throw error;
1296
1350
  }
1297
1351
  }
1298
- async getWallets() {
1352
+ /**
1353
+ * Get a single wallet by address
1354
+ * First tries the efficient getWaasWalletByAddress endpoint, falls back to getUser() if not available
1355
+ */ async getWalletByAddress(accountAddress) {
1356
+ // Return cached wallet if available
1357
+ if (this.walletMap[accountAddress]) {
1358
+ return this.walletMap[accountAddress];
1359
+ }
1360
+ this.ensureApiClientAuthenticated();
1361
+ // Try getting single wallet by address first
1362
+ try {
1363
+ var _walletResponse_wallet;
1364
+ const walletResponse = await this.apiClient.getWaasWalletByAddress({
1365
+ walletAddress: accountAddress
1366
+ });
1367
+ const walletProperties = {
1368
+ walletId: walletResponse.wallet.walletId,
1369
+ chainName: walletResponse.wallet.chainName,
1370
+ accountAddress: walletResponse.wallet.accountAddress,
1371
+ externalServerKeyShares: [],
1372
+ derivationPath: walletResponse.wallet.derivationPath,
1373
+ thresholdSignatureScheme: walletResponse.wallet.thresholdSignatureScheme,
1374
+ externalServerKeySharesBackupInfo: getExternalServerKeyShareBackupInfo({
1375
+ walletProperties: {
1376
+ keyShares: ((_walletResponse_wallet = walletResponse.wallet) == null ? void 0 : _walletResponse_wallet.keyShares) || [],
1377
+ thresholdSignatureScheme: walletResponse.wallet.thresholdSignatureScheme,
1378
+ derivationPath: walletResponse.wallet.derivationPath
1379
+ }
1380
+ })
1381
+ };
1382
+ // Cache the wallet
1383
+ this.walletMap[accountAddress] = walletProperties;
1384
+ return walletProperties;
1385
+ } catch (error) {
1386
+ var _error_response;
1387
+ // If the new endpoint doesn't exist (404 or not implemented), fall back to getUser()
1388
+ if ((error == null ? void 0 : (_error_response = error.response) == null ? void 0 : _error_response.status) === 404 || (error == null ? void 0 : error.code) === 'ERR_BAD_REQUEST') {
1389
+ var _user_verifiedCredentials, _wallet_walletProperties, _wallet_walletProperties1;
1390
+ this.logger.debug('getWaasWalletByAddress endpoint not available, falling back to getUser()');
1391
+ // Fallback to getUser() approach
1392
+ const user = await this.apiClient.getUser(v4());
1393
+ const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.walletName === 'dynamicwaas' && vc.address.toLowerCase() === accountAddress.toLowerCase());
1394
+ if (!wallet) {
1395
+ return null;
1396
+ }
1397
+ var _wallet_walletProperties_derivationPath;
1398
+ const walletProperties = {
1399
+ walletId: wallet.id,
1400
+ chainName: wallet.chain,
1401
+ accountAddress: wallet.address,
1402
+ externalServerKeyShares: [],
1403
+ derivationPath: (_wallet_walletProperties_derivationPath = (_wallet_walletProperties = wallet.walletProperties) == null ? void 0 : _wallet_walletProperties.derivationPath) != null ? _wallet_walletProperties_derivationPath : undefined,
1404
+ thresholdSignatureScheme: (_wallet_walletProperties1 = wallet.walletProperties) == null ? void 0 : _wallet_walletProperties1.thresholdSignatureScheme,
1405
+ externalServerKeySharesBackupInfo: getExternalServerKeyShareBackupInfo({
1406
+ walletProperties: wallet.walletProperties || {}
1407
+ })
1408
+ };
1409
+ // Cache the wallet
1410
+ this.walletMap[accountAddress] = walletProperties;
1411
+ return walletProperties;
1412
+ }
1413
+ throw error;
1414
+ }
1415
+ }
1416
+ /**
1417
+ * Get all wallets (kept for backward compatibility but now uses lazy loading)
1418
+ * @deprecated Consider using getWalletByAddress for better performance with large wallet counts
1419
+ */ async getWallets() {
1299
1420
  var _user_verifiedCredentials;
1300
1421
  this.ensureApiClientAuthenticated();
1301
1422
  const user = await this.apiClient.getUser(v4());
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/node",
3
- "version": "0.0.0-beta.329",
3
+ "version": "0.0.0-beta.331",
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-beta.329",
8
- "@dynamic-labs-wallet/forward-mpc-client": "0.1.2",
7
+ "@dynamic-labs-wallet/core": "0.0.0-beta.331",
8
+ "@dynamic-labs-wallet/forward-mpc-client": "0.1.3",
9
9
  "@dynamic-labs/logger": "^4.25.3",
10
10
  "@dynamic-labs/sdk-api-core": "^0.0.801",
11
11
  "uuid": "11.1.0",
package/src/client.d.ts CHANGED
@@ -184,7 +184,7 @@ export declare class DynamicWalletClient {
184
184
  getExternalServerKeyShares({ accountAddress, password, }: {
185
185
  accountAddress: string;
186
186
  password?: string;
187
- }): Promise<ServerKeyShare[]>;
187
+ }): Promise<any[]>;
188
188
  updatePassword({ accountAddress, existingPassword, newPassword, backUpToClientShareService, }: {
189
189
  accountAddress: string;
190
190
  existingPassword?: string;
@@ -216,6 +216,23 @@ export declare class DynamicWalletClient {
216
216
  shares: Partial<Record<BackupLocation, string[]>>;
217
217
  requiredShareCount: number;
218
218
  };
219
+ /**
220
+ * Attempts to recover key shares from backup if they are not provided.
221
+ * The recovered shares will be stored in the wallet map for use in signing operations.
222
+ * @param accountAddress - The account address to recover shares for
223
+ * @param password - The password to decrypt the shares
224
+ * @param walletOperation - The wallet operation being performed
225
+ * @param externalServerKeyShares - The provided key shares (if any)
226
+ * @param errorMessage - The error message to throw if recovery fails
227
+ * @throws Error if recovery is needed but fails
228
+ */
229
+ protected ensureKeySharesRecovered({ accountAddress, password, walletOperation, externalServerKeyShares, errorMessage, }: {
230
+ accountAddress: string;
231
+ password?: string;
232
+ walletOperation: WalletOperation;
233
+ externalServerKeyShares?: ServerKeyShare[];
234
+ errorMessage: string;
235
+ }): Promise<void>;
219
236
  recoverEncryptedBackupByWallet({ accountAddress, password, walletOperation, shareCount, storeRecoveredShares, }: {
220
237
  accountAddress: string;
221
238
  password?: string;
@@ -226,7 +243,7 @@ export declare class DynamicWalletClient {
226
243
  exportExternalServerKeyShares({ accountAddress, password, }: {
227
244
  accountAddress: string;
228
245
  password?: string;
229
- }): Promise<ServerKeyShare[]>;
246
+ }): Promise<any[]>;
230
247
  /**
231
248
  * Helper function to check if the required wallet fields are present and valid
232
249
  * @param accountAddress - The account address of the wallet to check
@@ -270,6 +287,15 @@ export declare class DynamicWalletClient {
270
287
  shareCount?: number;
271
288
  password?: string;
272
289
  }): Promise<WalletProperties>;
290
+ /**
291
+ * Get a single wallet by address
292
+ * First tries the efficient getWaasWalletByAddress endpoint, falls back to getUser() if not available
293
+ */
294
+ getWalletByAddress(accountAddress: string): Promise<WalletProperties | null>;
295
+ /**
296
+ * Get all wallets (kept for backward compatibility but now uses lazy loading)
297
+ * @deprecated Consider using getWalletByAddress for better performance with large wallet counts
298
+ */
273
299
  getWallets(): Promise<any>;
274
300
  }
275
301
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAElB,iBAAiB,EACjB,cAAc,EAGd,WAAW,EACX,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AACxB,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ACW,iBAAiB;IAmG/B;;;;OAIG;IACG,cAAc,CAAC,EACnB,cAAc,EACd,QAAoB,EACpB,eAA8C,GAC/C,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,eAAe,CAAC;KACnC;IA+CK,mBAAmB,CAAC,EACxB,cAAc,GACf,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,OAAO,CAAC;IAQpB;;OAEG;IACG,4BAA4B,CAAC,EACjC,cAAc,EACd,eAAiD,GAClD,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;KACnC,GAAG,OAAO,CAAC,OAAO,CAAC;IAYpB;;OAEG;IACG,uCAAuC,CAAC,EAC5C,cAAc,EACd,eAAiD,GAClD,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;KACnC,GAAG,OAAO,CAAC,OAAO,CAAC;IAwCd,yCAAyC,CAAC,EAC9C,cAAc,GACf,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA+BzB,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;IA8DD;;;OAGG;IACG,kBAAkB,CACtB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IA+EnC;;;OAGG;IACG,UAAU;CAqCjB"}
@@ -2,4 +2,6 @@ export { createDelegatedWalletClient } from './createDelegatedClient.js';
2
2
  export type { DelegatedWalletClient, DelegatedClientConfig, } from './createDelegatedClient.js';
3
3
  export { delegatedSignMessage } from './modules/sign.js';
4
4
  export { revokeDelegation } from './modules/revokeDelegation.js';
5
+ export { decryptDelegatedWebhookData } from './modules/decryptWebhookData.js';
6
+ export type { EncryptedDelegatedPayload } from './modules/decryptWebhookData.js';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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,GACtB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC"}
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,GACtB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,YAAY,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { ServerKeyShare } from '../../mpc/types.js';
2
+ export type EncryptedDelegatedPayload = {
3
+ alg: string;
4
+ iv: string;
5
+ ct: string;
6
+ tag: string;
7
+ ek: string;
8
+ kid?: string;
9
+ };
10
+ export declare function decryptDelegatedWebhookData({ privateKeyPem, encryptedDelegatedKeyShare, encryptedWalletApiKey, }: {
11
+ privateKeyPem: string;
12
+ encryptedDelegatedKeyShare: EncryptedDelegatedPayload;
13
+ encryptedWalletApiKey: EncryptedDelegatedPayload;
14
+ }): {
15
+ decryptedDelegatedShare: ServerKeyShare;
16
+ decryptedWalletApiKey: string;
17
+ };
18
+ //# sourceMappingURL=decryptWebhookData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decryptWebhookData.d.ts","sourceRoot":"","sources":["../../../src/delegatedClient/modules/decryptWebhookData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAqCF,wBAAgB,2BAA2B,CAAC,EAC1C,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,GACtB,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,0BAA0B,EAAE,yBAAyB,CAAC;IACtD,qBAAqB,EAAE,yBAAyB,CAAC;CAClD,GAAG;IACF,uBAAuB,EAAE,cAAc,CAAC;IACxC,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CA2CA"}
@@ -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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