@dynamic-labs-wallet/browser 0.0.55 → 0.0.57
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 +65 -59
- package/index.esm.js +66 -61
- package/package.json +2 -2
- package/src/client.d.ts +2 -5
- package/src/client.d.ts.map +1 -1
- package/src/services/messageTransportBridge.d.ts.map +1 -1
- package/src/types.d.ts +0 -2
- package/src/types.d.ts.map +1 -1
- package/src/utils.d.ts +2 -0
- package/src/utils.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -136,6 +136,32 @@ const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
|
|
|
136
136
|
// TypeScript needs this even though it's unreachable
|
|
137
137
|
throw new Error('Unreachable code');
|
|
138
138
|
}
|
|
139
|
+
const formatEvmMessage = (message)=>{
|
|
140
|
+
return web.MessageHash.keccak256(message);
|
|
141
|
+
};
|
|
142
|
+
const formatSolanaMessage = (message)=>{
|
|
143
|
+
if (typeof message === 'string') {
|
|
144
|
+
if (!isHexString(message)) {
|
|
145
|
+
return Buffer.from(message).toString('hex');
|
|
146
|
+
} else {
|
|
147
|
+
return new Uint8Array(Buffer.from(message, 'hex'));
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
return message;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const formatMessage = (chainName, message)=>{
|
|
154
|
+
switch(chainName){
|
|
155
|
+
case 'EVM':
|
|
156
|
+
return formatEvmMessage(message);
|
|
157
|
+
case 'SOL':
|
|
158
|
+
return formatSolanaMessage(message);
|
|
159
|
+
case 'SUI':
|
|
160
|
+
return message;
|
|
161
|
+
default:
|
|
162
|
+
throw new Error('Unsupported chain name');
|
|
163
|
+
}
|
|
164
|
+
};
|
|
139
165
|
|
|
140
166
|
const PBKDF2_ALGORITHM = 'PBKDF2';
|
|
141
167
|
const PBKDF2_ITERATIONS = 100000;
|
|
@@ -416,7 +442,6 @@ const setupMessageTransportBridge = (messageTransport$1, iframe, iframeOrigin)=>
|
|
|
416
442
|
// Forward the message to webview via postMessage
|
|
417
443
|
if (message.origin === 'host') {
|
|
418
444
|
var _iframe_contentWindow;
|
|
419
|
-
logger.debug(`[host bridge] host --> bridge --> iframe`, message);
|
|
420
445
|
iframe == null ? void 0 : (_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage(message, iframeOrigin);
|
|
421
446
|
}
|
|
422
447
|
});
|
|
@@ -424,16 +449,13 @@ const setupMessageTransportBridge = (messageTransport$1, iframe, iframeOrigin)=>
|
|
|
424
449
|
const { data } = message;
|
|
425
450
|
if (!data) return;
|
|
426
451
|
if ((data == null ? void 0 : data.origin) !== 'webview') {
|
|
427
|
-
logger.debug(`skipped message: ${JSON.stringify(data)}: origin is not host`);
|
|
428
452
|
return;
|
|
429
453
|
}
|
|
430
454
|
if (typeof data !== 'object') {
|
|
431
|
-
logger.debug(`skipped message: ${JSON.stringify(data)}: data is not an object`);
|
|
432
455
|
return;
|
|
433
456
|
}
|
|
434
457
|
try {
|
|
435
458
|
const message = messageTransport.parseMessageTransportData(data);
|
|
436
|
-
logger.debug(`[host bridge] iframe --> bridge --> host`, message);
|
|
437
459
|
messageTransport$1.emit(message);
|
|
438
460
|
} catch (error) {
|
|
439
461
|
if (!(error instanceof SyntaxError)) {
|
|
@@ -663,7 +685,7 @@ class DynamicWalletClient {
|
|
|
663
685
|
try {
|
|
664
686
|
const initializePromises = [
|
|
665
687
|
this.restoreWallets(),
|
|
666
|
-
this.
|
|
688
|
+
this.initializeIframeCommunication()
|
|
667
689
|
];
|
|
668
690
|
await Promise.all(initializePromises);
|
|
669
691
|
return {
|
|
@@ -834,25 +856,7 @@ class DynamicWalletClient {
|
|
|
834
856
|
chainName,
|
|
835
857
|
baseRelayUrl: this.baseMPCRelayApiUrl
|
|
836
858
|
});
|
|
837
|
-
|
|
838
|
-
//note: Ecdsa can also be used by bitcoin, but only keccak256 is used by ethereum
|
|
839
|
-
if (mpcSigner instanceof web.Ecdsa) {
|
|
840
|
-
formattedMessage = web.MessageHash.keccak256(message);
|
|
841
|
-
} else if (mpcSigner instanceof web.Ed25519) {
|
|
842
|
-
if (typeof message === 'string') {
|
|
843
|
-
if (!isHexString(message)) {
|
|
844
|
-
formattedMessage = Buffer.from(message).toString('hex');
|
|
845
|
-
} else {
|
|
846
|
-
formattedMessage = Buffer.from(message, 'hex');
|
|
847
|
-
}
|
|
848
|
-
} else {
|
|
849
|
-
formattedMessage = message;
|
|
850
|
-
}
|
|
851
|
-
} else if (mpcSigner instanceof web.BIP340 && typeof message === 'string') {
|
|
852
|
-
formattedMessage = new TextEncoder().encode(message);
|
|
853
|
-
} else {
|
|
854
|
-
throw new Error('Unsupported signer type');
|
|
855
|
-
}
|
|
859
|
+
const formattedMessage = formatMessage(chainName, message);
|
|
856
860
|
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
857
861
|
return signature;
|
|
858
862
|
} catch (error) {
|
|
@@ -1131,13 +1135,9 @@ class DynamicWalletClient {
|
|
|
1131
1135
|
return serializedEncryptedKeyShare;
|
|
1132
1136
|
}
|
|
1133
1137
|
/**
|
|
1134
|
-
*
|
|
1135
|
-
* TODO: revise this to only use iframe storage when iframe is deployed
|
|
1138
|
+
* helper function to store encrypted backup by wallet from iframe local storage
|
|
1136
1139
|
*/ async getClientKeySharesFromLocalStorage({ accountAddress }) {
|
|
1137
1140
|
var _this_iframeStorage;
|
|
1138
|
-
if (!this.useIframeStorage) {
|
|
1139
|
-
return this.walletMap[accountAddress].clientKeyShares;
|
|
1140
|
-
}
|
|
1141
1141
|
await this.initializeIframeCommunication();
|
|
1142
1142
|
const walletObject = await ((_this_iframeStorage = this.iframeStorage) == null ? void 0 : _this_iframeStorage.getItem(accountAddress));
|
|
1143
1143
|
if (!walletObject) {
|
|
@@ -1152,18 +1152,9 @@ class DynamicWalletClient {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
1154
|
/**
|
|
1155
|
-
*
|
|
1156
|
-
* TODO: revise this to only use iframe storage when iframe is deployed
|
|
1155
|
+
* helper function to store encrypted backup by wallet from iframe local storage
|
|
1157
1156
|
*/ async setClientKeySharesToLocalStorage({ accountAddress, clientKeyShares, overwriteOrMerge = 'merge' }) {
|
|
1158
1157
|
var _this_iframeStorage;
|
|
1159
|
-
if (!this.useIframeStorage) {
|
|
1160
|
-
var _this_walletMap_accountAddress;
|
|
1161
|
-
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
1162
|
-
clientKeyShares: overwriteOrMerge === 'overwrite' ? clientKeyShares : mergeUniqueKeyShares(((_this_walletMap_accountAddress = this.walletMap[accountAddress]) == null ? void 0 : _this_walletMap_accountAddress.clientKeyShares) || [], clientKeyShares)
|
|
1163
|
-
});
|
|
1164
|
-
await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
|
|
1165
|
-
return;
|
|
1166
|
-
}
|
|
1167
1158
|
await this.initializeIframeCommunication();
|
|
1168
1159
|
await ((_this_iframeStorage = this.iframeStorage) == null ? void 0 : _this_iframeStorage.setItem(accountAddress, {
|
|
1169
1160
|
clientKeyShares: overwriteOrMerge === 'overwrite' ? clientKeyShares : mergeUniqueKeyShares(await this.getClientKeySharesFromLocalStorage({
|
|
@@ -1427,12 +1418,11 @@ class DynamicWalletClient {
|
|
|
1427
1418
|
clientKeyShares: decryptedKeyShares,
|
|
1428
1419
|
overwriteOrMerge: 'merge'
|
|
1429
1420
|
});
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
}
|
|
1421
|
+
// Display the client shares in the container via iframe
|
|
1422
|
+
const { iframeDisplay } = await this.initializeIframeDisplayForContainer({
|
|
1423
|
+
container: displayContainer
|
|
1424
|
+
});
|
|
1425
|
+
iframeDisplay.displayClientShares(accountAddress);
|
|
1436
1426
|
return decryptedKeyShares;
|
|
1437
1427
|
}
|
|
1438
1428
|
async exportClientKeyshares({ accountAddress, password }) {
|
|
@@ -1647,12 +1637,13 @@ class DynamicWalletClient {
|
|
|
1647
1637
|
walletOperation: walletOperation,
|
|
1648
1638
|
shareCount
|
|
1649
1639
|
});
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1640
|
+
const existingKeyShares = await this.getClientKeySharesFromLocalStorage({
|
|
1641
|
+
accountAddress
|
|
1642
|
+
});
|
|
1643
|
+
await this.setClientKeySharesToLocalStorage({
|
|
1644
|
+
accountAddress,
|
|
1645
|
+
clientKeyShares: mergeUniqueKeyShares(existingKeyShares, decryptedKeyShares)
|
|
1646
|
+
});
|
|
1656
1647
|
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1657
1648
|
}
|
|
1658
1649
|
const walletCount = Object.keys(this.walletMap).length;
|
|
@@ -1670,7 +1661,7 @@ class DynamicWalletClient {
|
|
|
1670
1661
|
const user = await this.apiClient.getUser();
|
|
1671
1662
|
const waasWallets = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.filter((vc)=>vc.walletName === 'dynamicwaas');
|
|
1672
1663
|
const wallets = waasWallets.map((vc)=>{
|
|
1673
|
-
var _this_walletMap_vc_address,
|
|
1664
|
+
var _this_walletMap_vc_address, _vc_walletProperties;
|
|
1674
1665
|
var _this_walletMap_vc_address_derivationPath;
|
|
1675
1666
|
return {
|
|
1676
1667
|
walletId: vc.id,
|
|
@@ -1679,19 +1670,17 @@ class DynamicWalletClient {
|
|
|
1679
1670
|
clientKeySharesBackupInfo: getClientKeyShareBackupInfo({
|
|
1680
1671
|
walletProperties: vc.walletProperties || {}
|
|
1681
1672
|
}),
|
|
1682
|
-
|
|
1683
|
-
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,
|
|
1673
|
+
derivationPath: (_this_walletMap_vc_address_derivationPath = (_this_walletMap_vc_address = this.walletMap[vc.address]) == null ? void 0 : _this_walletMap_vc_address.derivationPath) != null ? _this_walletMap_vc_address_derivationPath : undefined,
|
|
1684
1674
|
thresholdSignatureScheme: (_vc_walletProperties = vc.walletProperties) == null ? void 0 : _vc_walletProperties.thresholdSignatureScheme
|
|
1685
1675
|
};
|
|
1686
1676
|
});
|
|
1687
1677
|
this.walletMap = wallets.reduce((acc, wallet)=>{
|
|
1688
|
-
var
|
|
1678
|
+
var _acc_accountAddress;
|
|
1689
1679
|
const accountAddress = wallet.accountAddress;
|
|
1690
1680
|
acc[wallet.accountAddress] = {
|
|
1691
1681
|
walletId: wallet.walletId,
|
|
1692
1682
|
chainName: wallet.chainName,
|
|
1693
1683
|
accountAddress: wallet.accountAddress,
|
|
1694
|
-
clientKeyShares: ((_acc_wallet_accountAddress = acc[wallet.accountAddress]) == null ? void 0 : _acc_wallet_accountAddress.clientKeyShares) || [],
|
|
1695
1684
|
clientKeySharesBackupInfo: wallet.clientKeySharesBackupInfo,
|
|
1696
1685
|
derivationPath: ((_acc_accountAddress = acc[accountAddress]) == null ? void 0 : _acc_accountAddress.derivationPath) || undefined,
|
|
1697
1686
|
thresholdSignatureScheme: wallet.thresholdSignatureScheme
|
|
@@ -1710,8 +1699,6 @@ class DynamicWalletClient {
|
|
|
1710
1699
|
this.memoryStorage = null;
|
|
1711
1700
|
this.messageTransport = null;
|
|
1712
1701
|
this.iframe = null;
|
|
1713
|
-
this.useIframeStorage = false // TODO: remove this when iframe is deployed
|
|
1714
|
-
;
|
|
1715
1702
|
this.iframeLoadPromise = null;
|
|
1716
1703
|
this.environmentId = environmentId;
|
|
1717
1704
|
this.storageKey = `${STORAGE_KEY}-${storageKey != null ? storageKey : environmentId}`;
|
|
@@ -1730,7 +1717,25 @@ class DynamicWalletClient {
|
|
|
1730
1717
|
this.memoryStorage = {};
|
|
1731
1718
|
this.storage = memoryLocalStorageAdapter(this.memoryStorage);
|
|
1732
1719
|
}
|
|
1733
|
-
|
|
1720
|
+
let environment;
|
|
1721
|
+
switch(baseApiUrl){
|
|
1722
|
+
case undefined:
|
|
1723
|
+
environment = core.ENVIRONMENT_ENUM.production;
|
|
1724
|
+
break;
|
|
1725
|
+
case core.DYNAMIC_AUTH_PROD_BASE_API_URL:
|
|
1726
|
+
environment = core.ENVIRONMENT_ENUM.production;
|
|
1727
|
+
break;
|
|
1728
|
+
case core.DYNAMIC_AUTH_PREPROD_BASE_API_URL:
|
|
1729
|
+
environment = core.ENVIRONMENT_ENUM.preprod;
|
|
1730
|
+
break;
|
|
1731
|
+
case core.DYNAMIC_AUTH_DEV_BASE_API_URL:
|
|
1732
|
+
environment = core.ENVIRONMENT_ENUM.development;
|
|
1733
|
+
break;
|
|
1734
|
+
default:
|
|
1735
|
+
environment = core.ENVIRONMENT_ENUM.development;
|
|
1736
|
+
break;
|
|
1737
|
+
}
|
|
1738
|
+
this.iframeDomain = core.IFRAME_DOMAIN_MAP[environment];
|
|
1734
1739
|
// Generate unique instanceId when client is created
|
|
1735
1740
|
this.instanceId = crypto.randomUUID();
|
|
1736
1741
|
// initialize the client
|
|
@@ -1790,6 +1795,7 @@ exports.DynamicWalletClient = DynamicWalletClient;
|
|
|
1790
1795
|
exports.base64ToBytes = base64ToBytes;
|
|
1791
1796
|
exports.bytesToBase64 = bytesToBase64;
|
|
1792
1797
|
exports.ensureBase64Padding = ensureBase64Padding;
|
|
1798
|
+
exports.formatMessage = formatMessage;
|
|
1793
1799
|
exports.getClientKeyShareBackupInfo = getClientKeyShareBackupInfo;
|
|
1794
1800
|
exports.getClientKeyShareExportFileName = getClientKeyShareExportFileName;
|
|
1795
1801
|
exports.getMPCSignatureScheme = getMPCSignatureScheme;
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, BackupLocation, getClientThreshold, MPC_CONFIG, getTSSConfig, WalletOperation, getReshareConfig, DynamicApiClient,
|
|
1
|
+
import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, BackupLocation, getClientThreshold, MPC_CONFIG, getTSSConfig, WalletOperation, getReshareConfig, DynamicApiClient, ENVIRONMENT_ENUM, DYNAMIC_AUTH_DEV_BASE_API_URL, DYNAMIC_AUTH_PREPROD_BASE_API_URL, DYNAMIC_AUTH_PROD_BASE_API_URL, IFRAME_DOMAIN_MAP } from '@dynamic-labs-wallet/core';
|
|
2
2
|
export * from '@dynamic-labs-wallet/core';
|
|
3
3
|
import { BIP340, Ed25519, Ecdsa, MessageHash, EcdsaKeygenResult, Ed25519KeygenResult, BIP340KeygenResult } from './internal/web';
|
|
4
4
|
export { BIP340, BIP340InitKeygenResult, BIP340KeygenResult, Ecdsa, EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519, Ed25519InitKeygenResult, Ed25519KeygenResult, MessageHash } from './internal/web';
|
|
@@ -136,6 +136,32 @@ const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
|
|
|
136
136
|
// TypeScript needs this even though it's unreachable
|
|
137
137
|
throw new Error('Unreachable code');
|
|
138
138
|
}
|
|
139
|
+
const formatEvmMessage = (message)=>{
|
|
140
|
+
return MessageHash.keccak256(message);
|
|
141
|
+
};
|
|
142
|
+
const formatSolanaMessage = (message)=>{
|
|
143
|
+
if (typeof message === 'string') {
|
|
144
|
+
if (!isHexString(message)) {
|
|
145
|
+
return Buffer.from(message).toString('hex');
|
|
146
|
+
} else {
|
|
147
|
+
return new Uint8Array(Buffer.from(message, 'hex'));
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
return message;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const formatMessage = (chainName, message)=>{
|
|
154
|
+
switch(chainName){
|
|
155
|
+
case 'EVM':
|
|
156
|
+
return formatEvmMessage(message);
|
|
157
|
+
case 'SOL':
|
|
158
|
+
return formatSolanaMessage(message);
|
|
159
|
+
case 'SUI':
|
|
160
|
+
return message;
|
|
161
|
+
default:
|
|
162
|
+
throw new Error('Unsupported chain name');
|
|
163
|
+
}
|
|
164
|
+
};
|
|
139
165
|
|
|
140
166
|
const PBKDF2_ALGORITHM = 'PBKDF2';
|
|
141
167
|
const PBKDF2_ITERATIONS = 100000;
|
|
@@ -416,7 +442,6 @@ const setupMessageTransportBridge = (messageTransport, iframe, iframeOrigin)=>{
|
|
|
416
442
|
// Forward the message to webview via postMessage
|
|
417
443
|
if (message.origin === 'host') {
|
|
418
444
|
var _iframe_contentWindow;
|
|
419
|
-
logger.debug(`[host bridge] host --> bridge --> iframe`, message);
|
|
420
445
|
iframe == null ? void 0 : (_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage(message, iframeOrigin);
|
|
421
446
|
}
|
|
422
447
|
});
|
|
@@ -424,16 +449,13 @@ const setupMessageTransportBridge = (messageTransport, iframe, iframeOrigin)=>{
|
|
|
424
449
|
const { data } = message;
|
|
425
450
|
if (!data) return;
|
|
426
451
|
if ((data == null ? void 0 : data.origin) !== 'webview') {
|
|
427
|
-
logger.debug(`skipped message: ${JSON.stringify(data)}: origin is not host`);
|
|
428
452
|
return;
|
|
429
453
|
}
|
|
430
454
|
if (typeof data !== 'object') {
|
|
431
|
-
logger.debug(`skipped message: ${JSON.stringify(data)}: data is not an object`);
|
|
432
455
|
return;
|
|
433
456
|
}
|
|
434
457
|
try {
|
|
435
458
|
const message = parseMessageTransportData(data);
|
|
436
|
-
logger.debug(`[host bridge] iframe --> bridge --> host`, message);
|
|
437
459
|
messageTransport.emit(message);
|
|
438
460
|
} catch (error) {
|
|
439
461
|
if (!(error instanceof SyntaxError)) {
|
|
@@ -663,7 +685,7 @@ class DynamicWalletClient {
|
|
|
663
685
|
try {
|
|
664
686
|
const initializePromises = [
|
|
665
687
|
this.restoreWallets(),
|
|
666
|
-
this.
|
|
688
|
+
this.initializeIframeCommunication()
|
|
667
689
|
];
|
|
668
690
|
await Promise.all(initializePromises);
|
|
669
691
|
return {
|
|
@@ -834,25 +856,7 @@ class DynamicWalletClient {
|
|
|
834
856
|
chainName,
|
|
835
857
|
baseRelayUrl: this.baseMPCRelayApiUrl
|
|
836
858
|
});
|
|
837
|
-
|
|
838
|
-
//note: Ecdsa can also be used by bitcoin, but only keccak256 is used by ethereum
|
|
839
|
-
if (mpcSigner instanceof Ecdsa) {
|
|
840
|
-
formattedMessage = MessageHash.keccak256(message);
|
|
841
|
-
} else if (mpcSigner instanceof Ed25519) {
|
|
842
|
-
if (typeof message === 'string') {
|
|
843
|
-
if (!isHexString(message)) {
|
|
844
|
-
formattedMessage = Buffer.from(message).toString('hex');
|
|
845
|
-
} else {
|
|
846
|
-
formattedMessage = Buffer.from(message, 'hex');
|
|
847
|
-
}
|
|
848
|
-
} else {
|
|
849
|
-
formattedMessage = message;
|
|
850
|
-
}
|
|
851
|
-
} else if (mpcSigner instanceof BIP340 && typeof message === 'string') {
|
|
852
|
-
formattedMessage = new TextEncoder().encode(message);
|
|
853
|
-
} else {
|
|
854
|
-
throw new Error('Unsupported signer type');
|
|
855
|
-
}
|
|
859
|
+
const formattedMessage = formatMessage(chainName, message);
|
|
856
860
|
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
857
861
|
return signature;
|
|
858
862
|
} catch (error) {
|
|
@@ -1131,13 +1135,9 @@ class DynamicWalletClient {
|
|
|
1131
1135
|
return serializedEncryptedKeyShare;
|
|
1132
1136
|
}
|
|
1133
1137
|
/**
|
|
1134
|
-
*
|
|
1135
|
-
* TODO: revise this to only use iframe storage when iframe is deployed
|
|
1138
|
+
* helper function to store encrypted backup by wallet from iframe local storage
|
|
1136
1139
|
*/ async getClientKeySharesFromLocalStorage({ accountAddress }) {
|
|
1137
1140
|
var _this_iframeStorage;
|
|
1138
|
-
if (!this.useIframeStorage) {
|
|
1139
|
-
return this.walletMap[accountAddress].clientKeyShares;
|
|
1140
|
-
}
|
|
1141
1141
|
await this.initializeIframeCommunication();
|
|
1142
1142
|
const walletObject = await ((_this_iframeStorage = this.iframeStorage) == null ? void 0 : _this_iframeStorage.getItem(accountAddress));
|
|
1143
1143
|
if (!walletObject) {
|
|
@@ -1152,18 +1152,9 @@ class DynamicWalletClient {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
1154
|
/**
|
|
1155
|
-
*
|
|
1156
|
-
* TODO: revise this to only use iframe storage when iframe is deployed
|
|
1155
|
+
* helper function to store encrypted backup by wallet from iframe local storage
|
|
1157
1156
|
*/ async setClientKeySharesToLocalStorage({ accountAddress, clientKeyShares, overwriteOrMerge = 'merge' }) {
|
|
1158
1157
|
var _this_iframeStorage;
|
|
1159
|
-
if (!this.useIframeStorage) {
|
|
1160
|
-
var _this_walletMap_accountAddress;
|
|
1161
|
-
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress] || {}, {
|
|
1162
|
-
clientKeyShares: overwriteOrMerge === 'overwrite' ? clientKeyShares : mergeUniqueKeyShares(((_this_walletMap_accountAddress = this.walletMap[accountAddress]) == null ? void 0 : _this_walletMap_accountAddress.clientKeyShares) || [], clientKeyShares)
|
|
1163
|
-
});
|
|
1164
|
-
await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
|
|
1165
|
-
return;
|
|
1166
|
-
}
|
|
1167
1158
|
await this.initializeIframeCommunication();
|
|
1168
1159
|
await ((_this_iframeStorage = this.iframeStorage) == null ? void 0 : _this_iframeStorage.setItem(accountAddress, {
|
|
1169
1160
|
clientKeyShares: overwriteOrMerge === 'overwrite' ? clientKeyShares : mergeUniqueKeyShares(await this.getClientKeySharesFromLocalStorage({
|
|
@@ -1427,12 +1418,11 @@ class DynamicWalletClient {
|
|
|
1427
1418
|
clientKeyShares: decryptedKeyShares,
|
|
1428
1419
|
overwriteOrMerge: 'merge'
|
|
1429
1420
|
});
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
}
|
|
1421
|
+
// Display the client shares in the container via iframe
|
|
1422
|
+
const { iframeDisplay } = await this.initializeIframeDisplayForContainer({
|
|
1423
|
+
container: displayContainer
|
|
1424
|
+
});
|
|
1425
|
+
iframeDisplay.displayClientShares(accountAddress);
|
|
1436
1426
|
return decryptedKeyShares;
|
|
1437
1427
|
}
|
|
1438
1428
|
async exportClientKeyshares({ accountAddress, password }) {
|
|
@@ -1647,12 +1637,13 @@ class DynamicWalletClient {
|
|
|
1647
1637
|
walletOperation: walletOperation,
|
|
1648
1638
|
shareCount
|
|
1649
1639
|
});
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1640
|
+
const existingKeyShares = await this.getClientKeySharesFromLocalStorage({
|
|
1641
|
+
accountAddress
|
|
1642
|
+
});
|
|
1643
|
+
await this.setClientKeySharesToLocalStorage({
|
|
1644
|
+
accountAddress,
|
|
1645
|
+
clientKeyShares: mergeUniqueKeyShares(existingKeyShares, decryptedKeyShares)
|
|
1646
|
+
});
|
|
1656
1647
|
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1657
1648
|
}
|
|
1658
1649
|
const walletCount = Object.keys(this.walletMap).length;
|
|
@@ -1670,7 +1661,7 @@ class DynamicWalletClient {
|
|
|
1670
1661
|
const user = await this.apiClient.getUser();
|
|
1671
1662
|
const waasWallets = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.filter((vc)=>vc.walletName === 'dynamicwaas');
|
|
1672
1663
|
const wallets = waasWallets.map((vc)=>{
|
|
1673
|
-
var _this_walletMap_vc_address,
|
|
1664
|
+
var _this_walletMap_vc_address, _vc_walletProperties;
|
|
1674
1665
|
var _this_walletMap_vc_address_derivationPath;
|
|
1675
1666
|
return {
|
|
1676
1667
|
walletId: vc.id,
|
|
@@ -1679,19 +1670,17 @@ class DynamicWalletClient {
|
|
|
1679
1670
|
clientKeySharesBackupInfo: getClientKeyShareBackupInfo({
|
|
1680
1671
|
walletProperties: vc.walletProperties || {}
|
|
1681
1672
|
}),
|
|
1682
|
-
|
|
1683
|
-
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,
|
|
1673
|
+
derivationPath: (_this_walletMap_vc_address_derivationPath = (_this_walletMap_vc_address = this.walletMap[vc.address]) == null ? void 0 : _this_walletMap_vc_address.derivationPath) != null ? _this_walletMap_vc_address_derivationPath : undefined,
|
|
1684
1674
|
thresholdSignatureScheme: (_vc_walletProperties = vc.walletProperties) == null ? void 0 : _vc_walletProperties.thresholdSignatureScheme
|
|
1685
1675
|
};
|
|
1686
1676
|
});
|
|
1687
1677
|
this.walletMap = wallets.reduce((acc, wallet)=>{
|
|
1688
|
-
var
|
|
1678
|
+
var _acc_accountAddress;
|
|
1689
1679
|
const accountAddress = wallet.accountAddress;
|
|
1690
1680
|
acc[wallet.accountAddress] = {
|
|
1691
1681
|
walletId: wallet.walletId,
|
|
1692
1682
|
chainName: wallet.chainName,
|
|
1693
1683
|
accountAddress: wallet.accountAddress,
|
|
1694
|
-
clientKeyShares: ((_acc_wallet_accountAddress = acc[wallet.accountAddress]) == null ? void 0 : _acc_wallet_accountAddress.clientKeyShares) || [],
|
|
1695
1684
|
clientKeySharesBackupInfo: wallet.clientKeySharesBackupInfo,
|
|
1696
1685
|
derivationPath: ((_acc_accountAddress = acc[accountAddress]) == null ? void 0 : _acc_accountAddress.derivationPath) || undefined,
|
|
1697
1686
|
thresholdSignatureScheme: wallet.thresholdSignatureScheme
|
|
@@ -1710,8 +1699,6 @@ class DynamicWalletClient {
|
|
|
1710
1699
|
this.memoryStorage = null;
|
|
1711
1700
|
this.messageTransport = null;
|
|
1712
1701
|
this.iframe = null;
|
|
1713
|
-
this.useIframeStorage = false // TODO: remove this when iframe is deployed
|
|
1714
|
-
;
|
|
1715
1702
|
this.iframeLoadPromise = null;
|
|
1716
1703
|
this.environmentId = environmentId;
|
|
1717
1704
|
this.storageKey = `${STORAGE_KEY}-${storageKey != null ? storageKey : environmentId}`;
|
|
@@ -1730,7 +1717,25 @@ class DynamicWalletClient {
|
|
|
1730
1717
|
this.memoryStorage = {};
|
|
1731
1718
|
this.storage = memoryLocalStorageAdapter(this.memoryStorage);
|
|
1732
1719
|
}
|
|
1733
|
-
|
|
1720
|
+
let environment;
|
|
1721
|
+
switch(baseApiUrl){
|
|
1722
|
+
case undefined:
|
|
1723
|
+
environment = ENVIRONMENT_ENUM.production;
|
|
1724
|
+
break;
|
|
1725
|
+
case DYNAMIC_AUTH_PROD_BASE_API_URL:
|
|
1726
|
+
environment = ENVIRONMENT_ENUM.production;
|
|
1727
|
+
break;
|
|
1728
|
+
case DYNAMIC_AUTH_PREPROD_BASE_API_URL:
|
|
1729
|
+
environment = ENVIRONMENT_ENUM.preprod;
|
|
1730
|
+
break;
|
|
1731
|
+
case DYNAMIC_AUTH_DEV_BASE_API_URL:
|
|
1732
|
+
environment = ENVIRONMENT_ENUM.development;
|
|
1733
|
+
break;
|
|
1734
|
+
default:
|
|
1735
|
+
environment = ENVIRONMENT_ENUM.development;
|
|
1736
|
+
break;
|
|
1737
|
+
}
|
|
1738
|
+
this.iframeDomain = IFRAME_DOMAIN_MAP[environment];
|
|
1734
1739
|
// Generate unique instanceId when client is created
|
|
1735
1740
|
this.instanceId = crypto.randomUUID();
|
|
1736
1741
|
// initialize the client
|
|
@@ -1738,4 +1743,4 @@ class DynamicWalletClient {
|
|
|
1738
1743
|
}
|
|
1739
1744
|
}
|
|
1740
1745
|
|
|
1741
|
-
export { DynamicWalletClient, base64ToBytes, bytesToBase64, ensureBase64Padding, getClientKeyShareBackupInfo, getClientKeyShareExportFileName, getMPCSignatureScheme, getMPCSigner, isBrowser, isHexString, mergeUniqueKeyShares, retryPromise, stringToBytes, timeoutPromise };
|
|
1746
|
+
export { DynamicWalletClient, base64ToBytes, bytesToBase64, ensureBase64Padding, formatMessage, getClientKeyShareBackupInfo, getClientKeyShareExportFileName, getMPCSignatureScheme, getMPCSigner, isBrowser, isHexString, mergeUniqueKeyShares, retryPromise, stringToBytes, timeoutPromise };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.57",
|
|
4
4
|
"license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/core": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/core": "0.0.57",
|
|
7
7
|
"@dynamic-labs/logger": "^4.9.9",
|
|
8
8
|
"@dynamic-labs/message-transport": "^4.9.9"
|
|
9
9
|
},
|
package/src/client.d.ts
CHANGED
|
@@ -24,7 +24,6 @@ export declare class DynamicWalletClient {
|
|
|
24
24
|
protected messageTransport: MessageTransportWithDefaultOrigin | null;
|
|
25
25
|
protected iframe: HTMLIFrameElement | null;
|
|
26
26
|
readonly instanceId: string;
|
|
27
|
-
protected useIframeStorage: boolean;
|
|
28
27
|
readonly iframeDomain: string;
|
|
29
28
|
private iframeLoadPromise;
|
|
30
29
|
constructor({ environmentId, authToken, baseApiUrl, baseMPCRelayApiUrl, storageKey, debug, }: DynamicWalletClientProps);
|
|
@@ -223,15 +222,13 @@ export declare class DynamicWalletClient {
|
|
|
223
222
|
password?: string;
|
|
224
223
|
}): Promise<string>;
|
|
225
224
|
/**
|
|
226
|
-
*
|
|
227
|
-
* TODO: revise this to only use iframe storage when iframe is deployed
|
|
225
|
+
* helper function to store encrypted backup by wallet from iframe local storage
|
|
228
226
|
*/
|
|
229
227
|
getClientKeySharesFromLocalStorage({ accountAddress, }: {
|
|
230
228
|
accountAddress: string;
|
|
231
229
|
}): Promise<ClientKeyShare[]>;
|
|
232
230
|
/**
|
|
233
|
-
*
|
|
234
|
-
* TODO: revise this to only use iframe storage when iframe is deployed
|
|
231
|
+
* helper function to store encrypted backup by wallet from iframe local storage
|
|
235
232
|
*/
|
|
236
233
|
setClientKeySharesToLocalStorage({ accountAddress, clientKeyShares, overwriteOrMerge, }: {
|
|
237
234
|
accountAddress: string;
|
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,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,EACxB,gBAAgB,EAIhB,cAAc,EAEd,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAMhB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAoBrE,OAAO,EAGL,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAS3C,OAAO,EAGL,KAAK,iCAAiC,EACvC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAEvE,qBAAa,mBAAmB;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IAEtB,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAQ;IACrE,S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AAe,CAAC,EAAE,eAAe,CAAC;KACnC;IA6CK,mBAAmB,CAAC,EACxB,cAAc,GACf,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,OAAO,CAAC;IAMpB;;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;IAgCd,iCAAiC,CAAC,EACtC,cAAc,GACf,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoBzB,SAAS,CAAC,EACd,cAAc,EACd,eAA8C,EAC9C,UAAsB,EACtB,QAAoB,GACrB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IA2EK,UAAU;CAkCjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageTransportBridge.d.ts","sourceRoot":"","sources":["../../src/services/messageTransportBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iCAAiC,EAGvC,MAAM,iCAAiC,CAAC;AAGzC,eAAO,MAAM,2BAA2B,qBACpB,iCAAiC,UAC3C,iBAAiB,gBACX,MAAM,
|
|
1
|
+
{"version":3,"file":"messageTransportBridge.d.ts","sourceRoot":"","sources":["../../src/services/messageTransportBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iCAAiC,EAGvC,MAAM,iCAAiC,CAAC;AAGzC,eAAO,MAAM,2BAA2B,qBACpB,iCAAiC,UAC3C,iBAAiB,gBACX,MAAM,SAgDrB,CAAC"}
|
package/src/types.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { KeyShareBackupInfo, ThresholdSignatureScheme } from '@dynamic-labs-wallet/core';
|
|
2
|
-
import { ClientKeyShare } from './mpc/types';
|
|
3
2
|
export interface WalletProperties {
|
|
4
3
|
chainName: string;
|
|
5
4
|
walletId: string;
|
|
6
5
|
accountAddress: string;
|
|
7
|
-
clientKeyShares: ClientKeyShare[];
|
|
8
6
|
clientKeySharesBackupInfo: KeyShareBackupInfo;
|
|
9
7
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
10
8
|
derivationPath?: string;
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../packages/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../packages/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,yBAAyB,EAAE,kBAAkB,CAAC;IAC9C,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,mBAAmB,EAAE,CACnB,cAAc,EAAE,MAAM,EACtB,eAAe,CAAC,EAAE,MAAM,EAAE,KACvB,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,iBAAiB,EAAE,CACjB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,CAAC"}
|
package/src/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ThresholdSignatureScheme, KeyShareBackupInfo, WaasWalletProperties } from '@dynamic-labs-wallet/core';
|
|
2
2
|
import { ClientKeyShare } from './mpc/types';
|
|
3
|
+
import { MessageHash } from '../../internal/web';
|
|
3
4
|
export declare const bytesToBase64: (arr: Uint8Array) => string;
|
|
4
5
|
export declare const stringToBytes: (str: string) => Uint8Array;
|
|
5
6
|
export declare const base64ToBytes: (base64: string) => Uint8Array;
|
|
@@ -39,5 +40,6 @@ interface RetryConfig {
|
|
|
39
40
|
* @throws Last error encountered after all retries are exhausted
|
|
40
41
|
*/
|
|
41
42
|
export declare function retryPromise<T>(operation: () => Promise<T>, { maxAttempts, retryInterval, operationName, logContext, }?: RetryConfig): Promise<T>;
|
|
43
|
+
export declare const formatMessage: (chainName: string, message: string | Uint8Array) => string | Uint8Array | MessageHash;
|
|
42
44
|
export {};
|
|
43
45
|
//# sourceMappingURL=utils.d.ts.map
|
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,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;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