@dynamic-labs-wallet/browser 0.0.70 → 0.0.71
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 +15 -290
- package/index.esm.js +15 -290
- package/package.json +2 -3
- package/src/client.d.ts +4 -78
- package/src/client.d.ts.map +1 -1
- package/src/types.d.ts +0 -4
- package/src/types.d.ts.map +1 -1
- package/src/services/iframeDisplay.d.ts +0 -9
- package/src/services/iframeDisplay.d.ts.map +0 -1
- package/src/services/iframeLocalStorage.d.ts +0 -13
- package/src/services/iframeLocalStorage.d.ts.map +0 -1
- package/src/services/messageTransportBridge.d.ts +0 -3
- package/src/services/messageTransportBridge.d.ts.map +0 -1
package/index.cjs.js
CHANGED
|
@@ -4,7 +4,6 @@ var core = require('@dynamic-labs-wallet/core');
|
|
|
4
4
|
var web = require('./internal/web');
|
|
5
5
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
6
6
|
var logger$1 = require('@dynamic-labs/logger');
|
|
7
|
-
var messageTransport = require('@dynamic-labs/message-transport');
|
|
8
7
|
|
|
9
8
|
function _extends() {
|
|
10
9
|
_extends = Object.assign || function assign(target) {
|
|
@@ -434,88 +433,6 @@ const localStorageWriteTest = {
|
|
|
434
433
|
}
|
|
435
434
|
});
|
|
436
435
|
|
|
437
|
-
/**
|
|
438
|
-
* StorageRequestChannelAdapter.getItem() sends a message within host domain
|
|
439
|
-
* the bridge on host will capture this request and forwards it to the iframe via contentWindow.postMessage()
|
|
440
|
-
*/ class StorageRequestChannelAdapter {
|
|
441
|
-
async getItem(key) {
|
|
442
|
-
const item = await this.requestChannel.request('getItem', {
|
|
443
|
-
source: 'localStorage',
|
|
444
|
-
key
|
|
445
|
-
});
|
|
446
|
-
return item ? JSON.parse(item) : null;
|
|
447
|
-
}
|
|
448
|
-
async setItem(key, value) {
|
|
449
|
-
const stringifiedValue = typeof value === 'object' ? JSON.stringify(value) : value;
|
|
450
|
-
return this.requestChannel.request('setItem', {
|
|
451
|
-
source: 'localStorage',
|
|
452
|
-
key,
|
|
453
|
-
data: stringifiedValue
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
async removeItem(key) {
|
|
457
|
-
return this.requestChannel.request('deleteItem', {
|
|
458
|
-
source: 'localStorage',
|
|
459
|
-
key
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
constructor(messageTransport$1){
|
|
463
|
-
this.requestChannel = messageTransport.createRequestChannel(messageTransport$1);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
const setupMessageTransportBridge = (messageTransport$1, iframe, iframeOrigin)=>{
|
|
468
|
-
if (!(iframe == null ? void 0 : iframe.contentWindow)) {
|
|
469
|
-
throw new Error('Iframe or contentWindow not available');
|
|
470
|
-
}
|
|
471
|
-
const logger = new logger$1.Logger('debug');
|
|
472
|
-
messageTransport$1.on((message)=>{
|
|
473
|
-
// Forward the message to webview via postMessage
|
|
474
|
-
if (message.origin === 'host') {
|
|
475
|
-
var _iframe_contentWindow;
|
|
476
|
-
iframe == null ? void 0 : (_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage(message, iframeOrigin);
|
|
477
|
-
}
|
|
478
|
-
});
|
|
479
|
-
const handleIncomingMessage = (message)=>{
|
|
480
|
-
const { data } = message;
|
|
481
|
-
if (!data) return;
|
|
482
|
-
if ((data == null ? void 0 : data.origin) !== 'webview') {
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
if (typeof data !== 'object') {
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
try {
|
|
489
|
-
const message = messageTransport.parseMessageTransportData(data);
|
|
490
|
-
messageTransport$1.emit(message);
|
|
491
|
-
} catch (error) {
|
|
492
|
-
if (!(error instanceof SyntaxError)) {
|
|
493
|
-
logger.error('Error handling incoming message:', error);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
/**
|
|
498
|
-
* Handle incoming message from android client
|
|
499
|
-
*/ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
500
|
-
// @ts-ignore
|
|
501
|
-
document.addEventListener('message', handleIncomingMessage);
|
|
502
|
-
/**
|
|
503
|
-
* Handle incoming message from iOS client
|
|
504
|
-
*/ window.addEventListener('message', handleIncomingMessage);
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
class IframeDisplayChannelAdapter {
|
|
508
|
-
async displayClientShares(clientKeyShares) {
|
|
509
|
-
await this.requestChannel.request('displayClientShares', clientKeyShares);
|
|
510
|
-
}
|
|
511
|
-
async displayPrivateKey(privateKey) {
|
|
512
|
-
await this.requestChannel.request('displayPrivateKey', privateKey);
|
|
513
|
-
}
|
|
514
|
-
constructor(messageTransport$1){
|
|
515
|
-
this.requestChannel = messageTransport.createRequestChannel(messageTransport$1);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
|
|
519
436
|
/**
|
|
520
437
|
* Updates the wallet map with backup information after successful backup to Google Drive
|
|
521
438
|
* @param data - Response data containing key shares information
|
|
@@ -578,197 +495,11 @@ class DynamicWalletClient {
|
|
|
578
495
|
return result;
|
|
579
496
|
}
|
|
580
497
|
/**
|
|
581
|
-
* Initializes the iframe display for a specific container.
|
|
582
|
-
*
|
|
583
|
-
* @param {HTMLElement} container - The container to which the iframe will be attached.
|
|
584
|
-
* @returns {Promise<{
|
|
585
|
-
* iframe: HTMLIFrameElement;
|
|
586
|
-
* iframeDisplay: IframeDisplayChannelAdapter;
|
|
587
|
-
* cleanup: () => void;
|
|
588
|
-
* }>} A promise that resolves when the iframe is loaded.
|
|
589
|
-
*/ async initializeIframeDisplayForContainer({ container }) {
|
|
590
|
-
try {
|
|
591
|
-
const iframe = await this.loadIframeForContainer(container);
|
|
592
|
-
const transport = messageTransport.applyDefaultMessageOrigin({
|
|
593
|
-
defaultOrigin: 'host',
|
|
594
|
-
messageTransport: messageTransport.createMessageTransport()
|
|
595
|
-
});
|
|
596
|
-
setupMessageTransportBridge(transport, iframe, this.iframeDomain);
|
|
597
|
-
const iframeDisplay = new IframeDisplayChannelAdapter(transport);
|
|
598
|
-
return {
|
|
599
|
-
iframe,
|
|
600
|
-
iframeDisplay,
|
|
601
|
-
cleanup: ()=>{
|
|
602
|
-
container.removeChild(iframe);
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
|
-
} catch (error) {
|
|
606
|
-
this.logger.error('Error initializing iframe:', error);
|
|
607
|
-
throw error;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* this is called on class construction time
|
|
612
|
-
* @returns {Promise<void>} that resolves when the iframe is loaded and the message transport and iframe storage are initialized
|
|
613
|
-
*/ initializeIframeCommunication() {
|
|
614
|
-
if (!this.iframeLoadPromise) {
|
|
615
|
-
this.iframeLoadPromise = this.doInitializeIframeCommunication();
|
|
616
|
-
}
|
|
617
|
-
return this.iframeLoadPromise;
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* initialize the iframe communication by awaiting the iframe load promise
|
|
621
|
-
* and initializing the message transport and iframe storage after iframe is successfully loaded
|
|
622
|
-
*/ async doInitializeIframeCommunication() {
|
|
623
|
-
try {
|
|
624
|
-
await this.loadIframe();
|
|
625
|
-
this.initializeMessageTransport();
|
|
626
|
-
this.initializeIframeStorage();
|
|
627
|
-
} catch (error) {
|
|
628
|
-
this.logger.error('Error initializing iframe:', error);
|
|
629
|
-
throw error;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* create a promise to load an iframe
|
|
634
|
-
* @returns {Promise<void>} that resolves when the iframe is loaded
|
|
635
|
-
*/ loadIframe() {
|
|
636
|
-
return new Promise((resolve, reject)=>{
|
|
637
|
-
const iframe = document.createElement('iframe');
|
|
638
|
-
const iframeTimeoutId = setTimeout(()=>{
|
|
639
|
-
reject(new Error('Iframe load timeout'));
|
|
640
|
-
}, 10000);
|
|
641
|
-
iframe.style.display = 'none';
|
|
642
|
-
iframe.setAttribute('title', 'Dynamic Wallet Iframe');
|
|
643
|
-
iframe.setAttribute('referrerpolicy', 'origin');
|
|
644
|
-
iframe.style.position = 'fixed';
|
|
645
|
-
iframe.style.top = '0';
|
|
646
|
-
iframe.style.left = '0';
|
|
647
|
-
iframe.style.width = '0';
|
|
648
|
-
iframe.style.height = '0';
|
|
649
|
-
iframe.style.border = 'none';
|
|
650
|
-
iframe.style.pointerEvents = 'none';
|
|
651
|
-
const params = new URLSearchParams({
|
|
652
|
-
instanceId: this.instanceId,
|
|
653
|
-
hostOrigin: window.location.origin
|
|
654
|
-
});
|
|
655
|
-
iframe.src = `${this.iframeDomain}/waas/${this.environmentId}?${params.toString()}`;
|
|
656
|
-
this.logger.debug('Creating iframe with src:', iframe.src);
|
|
657
|
-
document.body.appendChild(iframe);
|
|
658
|
-
iframe.onload = ()=>{
|
|
659
|
-
clearTimeout(iframeTimeoutId);
|
|
660
|
-
this.logger.debug('Iframe loaded successfully');
|
|
661
|
-
this.iframe = iframe;
|
|
662
|
-
resolve();
|
|
663
|
-
};
|
|
664
|
-
iframe.onerror = (error)=>{
|
|
665
|
-
clearTimeout(iframeTimeoutId);
|
|
666
|
-
this.logger.error('Iframe failed to load:', error);
|
|
667
|
-
reject(new Error('Failed to load iframe'));
|
|
668
|
-
};
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* Load an iframe for a specific container
|
|
673
|
-
* @param {HTMLElement} container - The container to which the iframe will be attached
|
|
674
|
-
* @returns {Promise<HTMLIFrameElement>} that resolves when the iframe is loaded
|
|
675
|
-
*/ loadIframeForContainer(container) {
|
|
676
|
-
return new Promise((resolve, reject)=>{
|
|
677
|
-
const iframe = document.createElement('iframe');
|
|
678
|
-
const iframeTimeoutId = setTimeout(()=>{
|
|
679
|
-
reject(new Error('Iframe load timeout'));
|
|
680
|
-
}, 10000);
|
|
681
|
-
iframe.style.display = 'block';
|
|
682
|
-
iframe.style.width = '100%';
|
|
683
|
-
iframe.style.height = '100%';
|
|
684
|
-
iframe.setAttribute('title', 'Dynamic Wallet Storage');
|
|
685
|
-
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
|
|
686
|
-
iframe.setAttribute('referrerpolicy', 'origin');
|
|
687
|
-
const params = new URLSearchParams({
|
|
688
|
-
instanceId: this.instanceId,
|
|
689
|
-
hostOrigin: window.location.origin
|
|
690
|
-
});
|
|
691
|
-
iframe.src = `${this.iframeDomain}/waas/${this.environmentId}?${params.toString()}`;
|
|
692
|
-
this.logger.debug('Creating iframe with src:', iframe.src);
|
|
693
|
-
// Add iframe to the provided container
|
|
694
|
-
container.appendChild(iframe);
|
|
695
|
-
iframe.onload = ()=>{
|
|
696
|
-
clearTimeout(iframeTimeoutId);
|
|
697
|
-
this.logger.debug('Iframe loaded successfully');
|
|
698
|
-
this.iframe = iframe;
|
|
699
|
-
resolve(iframe);
|
|
700
|
-
};
|
|
701
|
-
iframe.onerror = (error)=>{
|
|
702
|
-
clearTimeout(iframeTimeoutId);
|
|
703
|
-
this.logger.error('Iframe failed to load:', error);
|
|
704
|
-
reject(new Error('Failed to load iframe'));
|
|
705
|
-
};
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* initialize the message transport after iframe is successfully loaded
|
|
710
|
-
*/ initializeMessageTransport() {
|
|
711
|
-
const transport = messageTransport.applyDefaultMessageOrigin({
|
|
712
|
-
defaultOrigin: 'host',
|
|
713
|
-
messageTransport: messageTransport.createMessageTransport()
|
|
714
|
-
});
|
|
715
|
-
this.messageTransport = transport;
|
|
716
|
-
if (!this.iframe) {
|
|
717
|
-
throw new Error('Iframe not available');
|
|
718
|
-
}
|
|
719
|
-
setupMessageTransportBridge(this.messageTransport, this.iframe, this.iframeDomain);
|
|
720
|
-
}
|
|
721
|
-
/**
|
|
722
|
-
* initialize the iframe storage after iframe is successfully loaded
|
|
723
|
-
*/ initializeIframeStorage() {
|
|
724
|
-
if (!this.messageTransport) {
|
|
725
|
-
throw new Error('Message transport not initialized');
|
|
726
|
-
}
|
|
727
|
-
this.iframeStorage = new StorageRequestChannelAdapter(this.messageTransport);
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* Gets the initialized iframe instance. This method ensures the iframe is properly loaded and configured.
|
|
731
|
-
* The first call will initialize and await the iframe loading process.
|
|
732
|
-
* Subsequent calls will return the same iframe instance immediately.
|
|
733
|
-
*
|
|
734
|
-
* @throws {Error} If iframe initialization fails
|
|
735
|
-
* @throws {Error} If message transport initialization fails
|
|
736
|
-
* @throws {Error} If iframe storage initialization fails
|
|
737
|
-
* @returns {Promise<HTMLIFrameElement>} The initialized iframe element
|
|
738
|
-
*/ async getIframe() {
|
|
739
|
-
await this.initializeIframeCommunication();
|
|
740
|
-
if (!this.iframe) {
|
|
741
|
-
throw new Error('Failed to initialize iframe');
|
|
742
|
-
}
|
|
743
|
-
if (!this.messageTransport) {
|
|
744
|
-
throw new Error('Failed to initialize message transport');
|
|
745
|
-
}
|
|
746
|
-
if (!this.iframeStorage) {
|
|
747
|
-
throw new Error('Failed to initialize iframe storage');
|
|
748
|
-
}
|
|
749
|
-
return this.iframe;
|
|
750
|
-
}
|
|
751
|
-
/**
|
|
752
|
-
* Gets the initialized iframe storage instance. This method ensures the iframe storage is properly configured.
|
|
753
|
-
* The first call will initialize and await the iframe communication process.
|
|
754
|
-
* Subsequent calls will return the same storage instance immediately.
|
|
755
|
-
*
|
|
756
|
-
* @throws {Error} If iframe storage initialization fails
|
|
757
|
-
* @returns {Promise<SupportedStorage>} The initialized iframe storage instance
|
|
758
|
-
*/ async getIframeStorage() {
|
|
759
|
-
await this.initializeIframeCommunication();
|
|
760
|
-
if (!this.iframeStorage) {
|
|
761
|
-
throw new Error('Failed to initialize iframe storage');
|
|
762
|
-
}
|
|
763
|
-
return this.iframeStorage;
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
498
|
* Client initialization logic
|
|
767
499
|
*/ async _initialize() {
|
|
768
500
|
try {
|
|
769
501
|
const initializePromises = [
|
|
770
|
-
this.restoreWallets()
|
|
771
|
-
this.initializeIframeCommunication()
|
|
502
|
+
this.restoreWallets()
|
|
772
503
|
];
|
|
773
504
|
await Promise.all(initializePromises);
|
|
774
505
|
return {
|
|
@@ -1023,7 +754,6 @@ class DynamicWalletClient {
|
|
|
1023
754
|
accountAddress,
|
|
1024
755
|
password: password != null ? password : this.environmentId
|
|
1025
756
|
});
|
|
1026
|
-
return refreshResults;
|
|
1027
757
|
}
|
|
1028
758
|
async getExportId({ chainName, clientKeyShare }) {
|
|
1029
759
|
const mpcSigner = getMPCSigner({
|
|
@@ -1136,7 +866,6 @@ class DynamicWalletClient {
|
|
|
1136
866
|
accountAddress,
|
|
1137
867
|
password
|
|
1138
868
|
});
|
|
1139
|
-
return reshareResults;
|
|
1140
869
|
}
|
|
1141
870
|
async exportKey({ accountAddress, chainName, password = undefined }) {
|
|
1142
871
|
const wallet = await this.getWallet({
|
|
@@ -1229,15 +958,20 @@ class DynamicWalletClient {
|
|
|
1229
958
|
/**
|
|
1230
959
|
* helper function to store encrypted backup by wallet from iframe local storage
|
|
1231
960
|
*/ async getClientKeySharesFromLocalStorage({ accountAddress }) {
|
|
1232
|
-
var
|
|
1233
|
-
await this.
|
|
1234
|
-
const walletObject = await ((_this_iframeStorage = this.iframeStorage) == null ? void 0 : _this_iframeStorage.getItem(accountAddress));
|
|
961
|
+
var _this_storage;
|
|
962
|
+
const walletObject = await ((_this_storage = this.storage) == null ? void 0 : _this_storage.getItem(accountAddress));
|
|
1235
963
|
if (!walletObject) {
|
|
1236
964
|
this.logger.debug(`No item found in iframe local storage for accountAddress: ${accountAddress}`);
|
|
1237
965
|
return [];
|
|
1238
966
|
}
|
|
1239
967
|
try {
|
|
1240
|
-
|
|
968
|
+
let parsedWalletObject;
|
|
969
|
+
if (typeof walletObject === 'string') {
|
|
970
|
+
parsedWalletObject = JSON.parse(walletObject);
|
|
971
|
+
} else {
|
|
972
|
+
parsedWalletObject = walletObject;
|
|
973
|
+
}
|
|
974
|
+
return (parsedWalletObject == null ? void 0 : parsedWalletObject.clientKeyShares) || [];
|
|
1241
975
|
} catch (error) {
|
|
1242
976
|
this.logger.error(`Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1243
977
|
return [];
|
|
@@ -1246,13 +980,13 @@ class DynamicWalletClient {
|
|
|
1246
980
|
/**
|
|
1247
981
|
* helper function to store encrypted backup by wallet from iframe local storage
|
|
1248
982
|
*/ async setClientKeySharesToLocalStorage({ accountAddress, clientKeyShares, overwriteOrMerge = 'merge' }) {
|
|
1249
|
-
var
|
|
1250
|
-
|
|
1251
|
-
await ((_this_iframeStorage = this.iframeStorage) == null ? void 0 : _this_iframeStorage.setItem(accountAddress, {
|
|
983
|
+
var _this_storage;
|
|
984
|
+
const stringifiedClientKeyShares = JSON.stringify({
|
|
1252
985
|
clientKeyShares: overwriteOrMerge === 'overwrite' ? clientKeyShares : mergeUniqueKeyShares(await this.getClientKeySharesFromLocalStorage({
|
|
1253
986
|
accountAddress
|
|
1254
987
|
}), clientKeyShares)
|
|
1255
|
-
})
|
|
988
|
+
});
|
|
989
|
+
await ((_this_storage = this.storage) == null ? void 0 : _this_storage.setItem(accountAddress, stringifiedClientKeyShares));
|
|
1256
990
|
}
|
|
1257
991
|
/**
|
|
1258
992
|
* Encrypts and stores wallet key shares as backups.
|
|
@@ -1474,7 +1208,7 @@ class DynamicWalletClient {
|
|
|
1474
1208
|
storageKey: this.storageKey
|
|
1475
1209
|
});
|
|
1476
1210
|
}
|
|
1477
|
-
async restoreBackupFromGoogleDrive({ accountAddress,
|
|
1211
|
+
async restoreBackupFromGoogleDrive({ accountAddress, password }) {
|
|
1478
1212
|
await this.getWallet({
|
|
1479
1213
|
accountAddress
|
|
1480
1214
|
});
|
|
@@ -1526,11 +1260,6 @@ class DynamicWalletClient {
|
|
|
1526
1260
|
clientKeyShares: decryptedKeyShares,
|
|
1527
1261
|
overwriteOrMerge: 'merge'
|
|
1528
1262
|
});
|
|
1529
|
-
// Display the client shares in the container via iframe
|
|
1530
|
-
const { iframeDisplay } = await this.initializeIframeDisplayForContainer({
|
|
1531
|
-
container: displayContainer
|
|
1532
|
-
});
|
|
1533
|
-
iframeDisplay.displayClientShares(keyShares);
|
|
1534
1263
|
return decryptedKeyShares;
|
|
1535
1264
|
}
|
|
1536
1265
|
async exportClientKeyshares({ accountAddress, password }) {
|
|
@@ -1802,12 +1531,8 @@ class DynamicWalletClient {
|
|
|
1802
1531
|
this.logger = logger;
|
|
1803
1532
|
this.walletMap = {} // todo: store in session storage
|
|
1804
1533
|
;
|
|
1805
|
-
this.iframeStorage = null;
|
|
1806
|
-
this.iframeDisplay = null;
|
|
1807
1534
|
this.memoryStorage = null;
|
|
1808
|
-
this.messageTransport = null;
|
|
1809
1535
|
this.iframe = null;
|
|
1810
|
-
this.iframeLoadPromise = null;
|
|
1811
1536
|
this.environmentId = environmentId;
|
|
1812
1537
|
this.storageKey = `${STORAGE_KEY}-${storageKey != null ? storageKey : environmentId}`;
|
|
1813
1538
|
this.baseMPCRelayApiUrl = baseMPCRelayApiUrl;
|
package/index.esm.js
CHANGED
|
@@ -4,7 +4,6 @@ import { BIP340, ExportableEd25519, Ecdsa, MessageHash, EcdsaKeygenResult, Expor
|
|
|
4
4
|
export { BIP340, BIP340InitKeygenResult, BIP340KeygenResult, Ecdsa, EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519, Ed25519InitKeygenResult, Ed25519KeygenResult, MessageHash } from './internal/web';
|
|
5
5
|
import { ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import { Logger } from '@dynamic-labs/logger';
|
|
7
|
-
import { createRequestChannel, parseMessageTransportData, applyDefaultMessageOrigin, createMessageTransport } from '@dynamic-labs/message-transport';
|
|
8
7
|
|
|
9
8
|
function _extends() {
|
|
10
9
|
_extends = Object.assign || function assign(target) {
|
|
@@ -434,88 +433,6 @@ const localStorageWriteTest = {
|
|
|
434
433
|
}
|
|
435
434
|
});
|
|
436
435
|
|
|
437
|
-
/**
|
|
438
|
-
* StorageRequestChannelAdapter.getItem() sends a message within host domain
|
|
439
|
-
* the bridge on host will capture this request and forwards it to the iframe via contentWindow.postMessage()
|
|
440
|
-
*/ class StorageRequestChannelAdapter {
|
|
441
|
-
async getItem(key) {
|
|
442
|
-
const item = await this.requestChannel.request('getItem', {
|
|
443
|
-
source: 'localStorage',
|
|
444
|
-
key
|
|
445
|
-
});
|
|
446
|
-
return item ? JSON.parse(item) : null;
|
|
447
|
-
}
|
|
448
|
-
async setItem(key, value) {
|
|
449
|
-
const stringifiedValue = typeof value === 'object' ? JSON.stringify(value) : value;
|
|
450
|
-
return this.requestChannel.request('setItem', {
|
|
451
|
-
source: 'localStorage',
|
|
452
|
-
key,
|
|
453
|
-
data: stringifiedValue
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
async removeItem(key) {
|
|
457
|
-
return this.requestChannel.request('deleteItem', {
|
|
458
|
-
source: 'localStorage',
|
|
459
|
-
key
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
constructor(messageTransport){
|
|
463
|
-
this.requestChannel = createRequestChannel(messageTransport);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
const setupMessageTransportBridge = (messageTransport, iframe, iframeOrigin)=>{
|
|
468
|
-
if (!(iframe == null ? void 0 : iframe.contentWindow)) {
|
|
469
|
-
throw new Error('Iframe or contentWindow not available');
|
|
470
|
-
}
|
|
471
|
-
const logger = new Logger('debug');
|
|
472
|
-
messageTransport.on((message)=>{
|
|
473
|
-
// Forward the message to webview via postMessage
|
|
474
|
-
if (message.origin === 'host') {
|
|
475
|
-
var _iframe_contentWindow;
|
|
476
|
-
iframe == null ? void 0 : (_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage(message, iframeOrigin);
|
|
477
|
-
}
|
|
478
|
-
});
|
|
479
|
-
const handleIncomingMessage = (message)=>{
|
|
480
|
-
const { data } = message;
|
|
481
|
-
if (!data) return;
|
|
482
|
-
if ((data == null ? void 0 : data.origin) !== 'webview') {
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
if (typeof data !== 'object') {
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
try {
|
|
489
|
-
const message = parseMessageTransportData(data);
|
|
490
|
-
messageTransport.emit(message);
|
|
491
|
-
} catch (error) {
|
|
492
|
-
if (!(error instanceof SyntaxError)) {
|
|
493
|
-
logger.error('Error handling incoming message:', error);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
/**
|
|
498
|
-
* Handle incoming message from android client
|
|
499
|
-
*/ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
500
|
-
// @ts-ignore
|
|
501
|
-
document.addEventListener('message', handleIncomingMessage);
|
|
502
|
-
/**
|
|
503
|
-
* Handle incoming message from iOS client
|
|
504
|
-
*/ window.addEventListener('message', handleIncomingMessage);
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
class IframeDisplayChannelAdapter {
|
|
508
|
-
async displayClientShares(clientKeyShares) {
|
|
509
|
-
await this.requestChannel.request('displayClientShares', clientKeyShares);
|
|
510
|
-
}
|
|
511
|
-
async displayPrivateKey(privateKey) {
|
|
512
|
-
await this.requestChannel.request('displayPrivateKey', privateKey);
|
|
513
|
-
}
|
|
514
|
-
constructor(messageTransport){
|
|
515
|
-
this.requestChannel = createRequestChannel(messageTransport);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
|
|
519
436
|
/**
|
|
520
437
|
* Updates the wallet map with backup information after successful backup to Google Drive
|
|
521
438
|
* @param data - Response data containing key shares information
|
|
@@ -578,197 +495,11 @@ class DynamicWalletClient {
|
|
|
578
495
|
return result;
|
|
579
496
|
}
|
|
580
497
|
/**
|
|
581
|
-
* Initializes the iframe display for a specific container.
|
|
582
|
-
*
|
|
583
|
-
* @param {HTMLElement} container - The container to which the iframe will be attached.
|
|
584
|
-
* @returns {Promise<{
|
|
585
|
-
* iframe: HTMLIFrameElement;
|
|
586
|
-
* iframeDisplay: IframeDisplayChannelAdapter;
|
|
587
|
-
* cleanup: () => void;
|
|
588
|
-
* }>} A promise that resolves when the iframe is loaded.
|
|
589
|
-
*/ async initializeIframeDisplayForContainer({ container }) {
|
|
590
|
-
try {
|
|
591
|
-
const iframe = await this.loadIframeForContainer(container);
|
|
592
|
-
const transport = applyDefaultMessageOrigin({
|
|
593
|
-
defaultOrigin: 'host',
|
|
594
|
-
messageTransport: createMessageTransport()
|
|
595
|
-
});
|
|
596
|
-
setupMessageTransportBridge(transport, iframe, this.iframeDomain);
|
|
597
|
-
const iframeDisplay = new IframeDisplayChannelAdapter(transport);
|
|
598
|
-
return {
|
|
599
|
-
iframe,
|
|
600
|
-
iframeDisplay,
|
|
601
|
-
cleanup: ()=>{
|
|
602
|
-
container.removeChild(iframe);
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
|
-
} catch (error) {
|
|
606
|
-
this.logger.error('Error initializing iframe:', error);
|
|
607
|
-
throw error;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* this is called on class construction time
|
|
612
|
-
* @returns {Promise<void>} that resolves when the iframe is loaded and the message transport and iframe storage are initialized
|
|
613
|
-
*/ initializeIframeCommunication() {
|
|
614
|
-
if (!this.iframeLoadPromise) {
|
|
615
|
-
this.iframeLoadPromise = this.doInitializeIframeCommunication();
|
|
616
|
-
}
|
|
617
|
-
return this.iframeLoadPromise;
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* initialize the iframe communication by awaiting the iframe load promise
|
|
621
|
-
* and initializing the message transport and iframe storage after iframe is successfully loaded
|
|
622
|
-
*/ async doInitializeIframeCommunication() {
|
|
623
|
-
try {
|
|
624
|
-
await this.loadIframe();
|
|
625
|
-
this.initializeMessageTransport();
|
|
626
|
-
this.initializeIframeStorage();
|
|
627
|
-
} catch (error) {
|
|
628
|
-
this.logger.error('Error initializing iframe:', error);
|
|
629
|
-
throw error;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* create a promise to load an iframe
|
|
634
|
-
* @returns {Promise<void>} that resolves when the iframe is loaded
|
|
635
|
-
*/ loadIframe() {
|
|
636
|
-
return new Promise((resolve, reject)=>{
|
|
637
|
-
const iframe = document.createElement('iframe');
|
|
638
|
-
const iframeTimeoutId = setTimeout(()=>{
|
|
639
|
-
reject(new Error('Iframe load timeout'));
|
|
640
|
-
}, 10000);
|
|
641
|
-
iframe.style.display = 'none';
|
|
642
|
-
iframe.setAttribute('title', 'Dynamic Wallet Iframe');
|
|
643
|
-
iframe.setAttribute('referrerpolicy', 'origin');
|
|
644
|
-
iframe.style.position = 'fixed';
|
|
645
|
-
iframe.style.top = '0';
|
|
646
|
-
iframe.style.left = '0';
|
|
647
|
-
iframe.style.width = '0';
|
|
648
|
-
iframe.style.height = '0';
|
|
649
|
-
iframe.style.border = 'none';
|
|
650
|
-
iframe.style.pointerEvents = 'none';
|
|
651
|
-
const params = new URLSearchParams({
|
|
652
|
-
instanceId: this.instanceId,
|
|
653
|
-
hostOrigin: window.location.origin
|
|
654
|
-
});
|
|
655
|
-
iframe.src = `${this.iframeDomain}/waas/${this.environmentId}?${params.toString()}`;
|
|
656
|
-
this.logger.debug('Creating iframe with src:', iframe.src);
|
|
657
|
-
document.body.appendChild(iframe);
|
|
658
|
-
iframe.onload = ()=>{
|
|
659
|
-
clearTimeout(iframeTimeoutId);
|
|
660
|
-
this.logger.debug('Iframe loaded successfully');
|
|
661
|
-
this.iframe = iframe;
|
|
662
|
-
resolve();
|
|
663
|
-
};
|
|
664
|
-
iframe.onerror = (error)=>{
|
|
665
|
-
clearTimeout(iframeTimeoutId);
|
|
666
|
-
this.logger.error('Iframe failed to load:', error);
|
|
667
|
-
reject(new Error('Failed to load iframe'));
|
|
668
|
-
};
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* Load an iframe for a specific container
|
|
673
|
-
* @param {HTMLElement} container - The container to which the iframe will be attached
|
|
674
|
-
* @returns {Promise<HTMLIFrameElement>} that resolves when the iframe is loaded
|
|
675
|
-
*/ loadIframeForContainer(container) {
|
|
676
|
-
return new Promise((resolve, reject)=>{
|
|
677
|
-
const iframe = document.createElement('iframe');
|
|
678
|
-
const iframeTimeoutId = setTimeout(()=>{
|
|
679
|
-
reject(new Error('Iframe load timeout'));
|
|
680
|
-
}, 10000);
|
|
681
|
-
iframe.style.display = 'block';
|
|
682
|
-
iframe.style.width = '100%';
|
|
683
|
-
iframe.style.height = '100%';
|
|
684
|
-
iframe.setAttribute('title', 'Dynamic Wallet Storage');
|
|
685
|
-
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
|
|
686
|
-
iframe.setAttribute('referrerpolicy', 'origin');
|
|
687
|
-
const params = new URLSearchParams({
|
|
688
|
-
instanceId: this.instanceId,
|
|
689
|
-
hostOrigin: window.location.origin
|
|
690
|
-
});
|
|
691
|
-
iframe.src = `${this.iframeDomain}/waas/${this.environmentId}?${params.toString()}`;
|
|
692
|
-
this.logger.debug('Creating iframe with src:', iframe.src);
|
|
693
|
-
// Add iframe to the provided container
|
|
694
|
-
container.appendChild(iframe);
|
|
695
|
-
iframe.onload = ()=>{
|
|
696
|
-
clearTimeout(iframeTimeoutId);
|
|
697
|
-
this.logger.debug('Iframe loaded successfully');
|
|
698
|
-
this.iframe = iframe;
|
|
699
|
-
resolve(iframe);
|
|
700
|
-
};
|
|
701
|
-
iframe.onerror = (error)=>{
|
|
702
|
-
clearTimeout(iframeTimeoutId);
|
|
703
|
-
this.logger.error('Iframe failed to load:', error);
|
|
704
|
-
reject(new Error('Failed to load iframe'));
|
|
705
|
-
};
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* initialize the message transport after iframe is successfully loaded
|
|
710
|
-
*/ initializeMessageTransport() {
|
|
711
|
-
const transport = applyDefaultMessageOrigin({
|
|
712
|
-
defaultOrigin: 'host',
|
|
713
|
-
messageTransport: createMessageTransport()
|
|
714
|
-
});
|
|
715
|
-
this.messageTransport = transport;
|
|
716
|
-
if (!this.iframe) {
|
|
717
|
-
throw new Error('Iframe not available');
|
|
718
|
-
}
|
|
719
|
-
setupMessageTransportBridge(this.messageTransport, this.iframe, this.iframeDomain);
|
|
720
|
-
}
|
|
721
|
-
/**
|
|
722
|
-
* initialize the iframe storage after iframe is successfully loaded
|
|
723
|
-
*/ initializeIframeStorage() {
|
|
724
|
-
if (!this.messageTransport) {
|
|
725
|
-
throw new Error('Message transport not initialized');
|
|
726
|
-
}
|
|
727
|
-
this.iframeStorage = new StorageRequestChannelAdapter(this.messageTransport);
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* Gets the initialized iframe instance. This method ensures the iframe is properly loaded and configured.
|
|
731
|
-
* The first call will initialize and await the iframe loading process.
|
|
732
|
-
* Subsequent calls will return the same iframe instance immediately.
|
|
733
|
-
*
|
|
734
|
-
* @throws {Error} If iframe initialization fails
|
|
735
|
-
* @throws {Error} If message transport initialization fails
|
|
736
|
-
* @throws {Error} If iframe storage initialization fails
|
|
737
|
-
* @returns {Promise<HTMLIFrameElement>} The initialized iframe element
|
|
738
|
-
*/ async getIframe() {
|
|
739
|
-
await this.initializeIframeCommunication();
|
|
740
|
-
if (!this.iframe) {
|
|
741
|
-
throw new Error('Failed to initialize iframe');
|
|
742
|
-
}
|
|
743
|
-
if (!this.messageTransport) {
|
|
744
|
-
throw new Error('Failed to initialize message transport');
|
|
745
|
-
}
|
|
746
|
-
if (!this.iframeStorage) {
|
|
747
|
-
throw new Error('Failed to initialize iframe storage');
|
|
748
|
-
}
|
|
749
|
-
return this.iframe;
|
|
750
|
-
}
|
|
751
|
-
/**
|
|
752
|
-
* Gets the initialized iframe storage instance. This method ensures the iframe storage is properly configured.
|
|
753
|
-
* The first call will initialize and await the iframe communication process.
|
|
754
|
-
* Subsequent calls will return the same storage instance immediately.
|
|
755
|
-
*
|
|
756
|
-
* @throws {Error} If iframe storage initialization fails
|
|
757
|
-
* @returns {Promise<SupportedStorage>} The initialized iframe storage instance
|
|
758
|
-
*/ async getIframeStorage() {
|
|
759
|
-
await this.initializeIframeCommunication();
|
|
760
|
-
if (!this.iframeStorage) {
|
|
761
|
-
throw new Error('Failed to initialize iframe storage');
|
|
762
|
-
}
|
|
763
|
-
return this.iframeStorage;
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
498
|
* Client initialization logic
|
|
767
499
|
*/ async _initialize() {
|
|
768
500
|
try {
|
|
769
501
|
const initializePromises = [
|
|
770
|
-
this.restoreWallets()
|
|
771
|
-
this.initializeIframeCommunication()
|
|
502
|
+
this.restoreWallets()
|
|
772
503
|
];
|
|
773
504
|
await Promise.all(initializePromises);
|
|
774
505
|
return {
|
|
@@ -1023,7 +754,6 @@ class DynamicWalletClient {
|
|
|
1023
754
|
accountAddress,
|
|
1024
755
|
password: password != null ? password : this.environmentId
|
|
1025
756
|
});
|
|
1026
|
-
return refreshResults;
|
|
1027
757
|
}
|
|
1028
758
|
async getExportId({ chainName, clientKeyShare }) {
|
|
1029
759
|
const mpcSigner = getMPCSigner({
|
|
@@ -1136,7 +866,6 @@ class DynamicWalletClient {
|
|
|
1136
866
|
accountAddress,
|
|
1137
867
|
password
|
|
1138
868
|
});
|
|
1139
|
-
return reshareResults;
|
|
1140
869
|
}
|
|
1141
870
|
async exportKey({ accountAddress, chainName, password = undefined }) {
|
|
1142
871
|
const wallet = await this.getWallet({
|
|
@@ -1229,15 +958,20 @@ class DynamicWalletClient {
|
|
|
1229
958
|
/**
|
|
1230
959
|
* helper function to store encrypted backup by wallet from iframe local storage
|
|
1231
960
|
*/ async getClientKeySharesFromLocalStorage({ accountAddress }) {
|
|
1232
|
-
var
|
|
1233
|
-
await this.
|
|
1234
|
-
const walletObject = await ((_this_iframeStorage = this.iframeStorage) == null ? void 0 : _this_iframeStorage.getItem(accountAddress));
|
|
961
|
+
var _this_storage;
|
|
962
|
+
const walletObject = await ((_this_storage = this.storage) == null ? void 0 : _this_storage.getItem(accountAddress));
|
|
1235
963
|
if (!walletObject) {
|
|
1236
964
|
this.logger.debug(`No item found in iframe local storage for accountAddress: ${accountAddress}`);
|
|
1237
965
|
return [];
|
|
1238
966
|
}
|
|
1239
967
|
try {
|
|
1240
|
-
|
|
968
|
+
let parsedWalletObject;
|
|
969
|
+
if (typeof walletObject === 'string') {
|
|
970
|
+
parsedWalletObject = JSON.parse(walletObject);
|
|
971
|
+
} else {
|
|
972
|
+
parsedWalletObject = walletObject;
|
|
973
|
+
}
|
|
974
|
+
return (parsedWalletObject == null ? void 0 : parsedWalletObject.clientKeyShares) || [];
|
|
1241
975
|
} catch (error) {
|
|
1242
976
|
this.logger.error(`Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1243
977
|
return [];
|
|
@@ -1246,13 +980,13 @@ class DynamicWalletClient {
|
|
|
1246
980
|
/**
|
|
1247
981
|
* helper function to store encrypted backup by wallet from iframe local storage
|
|
1248
982
|
*/ async setClientKeySharesToLocalStorage({ accountAddress, clientKeyShares, overwriteOrMerge = 'merge' }) {
|
|
1249
|
-
var
|
|
1250
|
-
|
|
1251
|
-
await ((_this_iframeStorage = this.iframeStorage) == null ? void 0 : _this_iframeStorage.setItem(accountAddress, {
|
|
983
|
+
var _this_storage;
|
|
984
|
+
const stringifiedClientKeyShares = JSON.stringify({
|
|
1252
985
|
clientKeyShares: overwriteOrMerge === 'overwrite' ? clientKeyShares : mergeUniqueKeyShares(await this.getClientKeySharesFromLocalStorage({
|
|
1253
986
|
accountAddress
|
|
1254
987
|
}), clientKeyShares)
|
|
1255
|
-
})
|
|
988
|
+
});
|
|
989
|
+
await ((_this_storage = this.storage) == null ? void 0 : _this_storage.setItem(accountAddress, stringifiedClientKeyShares));
|
|
1256
990
|
}
|
|
1257
991
|
/**
|
|
1258
992
|
* Encrypts and stores wallet key shares as backups.
|
|
@@ -1474,7 +1208,7 @@ class DynamicWalletClient {
|
|
|
1474
1208
|
storageKey: this.storageKey
|
|
1475
1209
|
});
|
|
1476
1210
|
}
|
|
1477
|
-
async restoreBackupFromGoogleDrive({ accountAddress,
|
|
1211
|
+
async restoreBackupFromGoogleDrive({ accountAddress, password }) {
|
|
1478
1212
|
await this.getWallet({
|
|
1479
1213
|
accountAddress
|
|
1480
1214
|
});
|
|
@@ -1526,11 +1260,6 @@ class DynamicWalletClient {
|
|
|
1526
1260
|
clientKeyShares: decryptedKeyShares,
|
|
1527
1261
|
overwriteOrMerge: 'merge'
|
|
1528
1262
|
});
|
|
1529
|
-
// Display the client shares in the container via iframe
|
|
1530
|
-
const { iframeDisplay } = await this.initializeIframeDisplayForContainer({
|
|
1531
|
-
container: displayContainer
|
|
1532
|
-
});
|
|
1533
|
-
iframeDisplay.displayClientShares(keyShares);
|
|
1534
1263
|
return decryptedKeyShares;
|
|
1535
1264
|
}
|
|
1536
1265
|
async exportClientKeyshares({ accountAddress, password }) {
|
|
@@ -1802,12 +1531,8 @@ class DynamicWalletClient {
|
|
|
1802
1531
|
this.logger = logger;
|
|
1803
1532
|
this.walletMap = {} // todo: store in session storage
|
|
1804
1533
|
;
|
|
1805
|
-
this.iframeStorage = null;
|
|
1806
|
-
this.iframeDisplay = null;
|
|
1807
1534
|
this.memoryStorage = null;
|
|
1808
|
-
this.messageTransport = null;
|
|
1809
1535
|
this.iframe = null;
|
|
1810
|
-
this.iframeLoadPromise = null;
|
|
1811
1536
|
this.environmentId = environmentId;
|
|
1812
1537
|
this.storageKey = `${STORAGE_KEY}-${storageKey != null ? storageKey : environmentId}`;
|
|
1813
1538
|
this.baseMPCRelayApiUrl = baseMPCRelayApiUrl;
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
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.71",
|
|
7
7
|
"@dynamic-labs/logger": "^4.9.9",
|
|
8
|
-
"@dynamic-labs/message-transport": "^4.9.9",
|
|
9
8
|
"@noble/hashes": "1.7.1"
|
|
10
9
|
},
|
|
11
10
|
"peerDependencies": {
|
package/src/client.d.ts
CHANGED
|
@@ -3,9 +3,6 @@ import { ExportableEd25519, type EcdsaPublicKey, EcdsaKeygenResult, BIP340Keygen
|
|
|
3
3
|
import type { ClientInitKeygenResult, ClientKeyShare } from './mpc/types';
|
|
4
4
|
import { type SupportedStorage } from './services/localStorage';
|
|
5
5
|
import type { WalletProperties } from './types';
|
|
6
|
-
import { type MessageTransportWithDefaultOrigin } from '@dynamic-labs/message-transport';
|
|
7
|
-
import { StorageRequestChannelAdapter } from './services/iframeLocalStorage';
|
|
8
|
-
import { IframeDisplayChannelAdapter } from './services/iframeDisplay';
|
|
9
6
|
export declare class DynamicWalletClient {
|
|
10
7
|
environmentId: string;
|
|
11
8
|
storageKey: string;
|
|
@@ -15,85 +12,15 @@ export declare class DynamicWalletClient {
|
|
|
15
12
|
protected apiClient: DynamicApiClient;
|
|
16
13
|
protected walletMap: Record<string, WalletProperties>;
|
|
17
14
|
protected storage: SupportedStorage;
|
|
18
|
-
protected iframeStorage: StorageRequestChannelAdapter | null;
|
|
19
|
-
protected iframeDisplay: IframeDisplayChannelAdapter | null;
|
|
20
15
|
protected memoryStorage: {
|
|
21
16
|
[key: string]: string;
|
|
22
17
|
} | null;
|
|
23
18
|
protected baseMPCRelayApiUrl?: string;
|
|
24
|
-
protected messageTransport: MessageTransportWithDefaultOrigin | null;
|
|
25
19
|
protected iframe: HTMLIFrameElement | null;
|
|
26
20
|
readonly instanceId: string;
|
|
27
21
|
readonly iframeDomain: string;
|
|
28
|
-
private iframeLoadPromise;
|
|
29
22
|
constructor({ environmentId, authToken, baseApiUrl, baseMPCRelayApiUrl, storageKey, debug, }: DynamicWalletClientProps);
|
|
30
23
|
initialize(): Promise<InitializeResult>;
|
|
31
|
-
/**
|
|
32
|
-
* Initializes the iframe display for a specific container.
|
|
33
|
-
*
|
|
34
|
-
* @param {HTMLElement} container - The container to which the iframe will be attached.
|
|
35
|
-
* @returns {Promise<{
|
|
36
|
-
* iframe: HTMLIFrameElement;
|
|
37
|
-
* iframeDisplay: IframeDisplayChannelAdapter;
|
|
38
|
-
* cleanup: () => void;
|
|
39
|
-
* }>} A promise that resolves when the iframe is loaded.
|
|
40
|
-
*/
|
|
41
|
-
initializeIframeDisplayForContainer({ container, }: {
|
|
42
|
-
container: HTMLElement;
|
|
43
|
-
}): Promise<{
|
|
44
|
-
iframe: HTMLIFrameElement;
|
|
45
|
-
iframeDisplay: IframeDisplayChannelAdapter;
|
|
46
|
-
cleanup: () => void;
|
|
47
|
-
}>;
|
|
48
|
-
/**
|
|
49
|
-
* this is called on class construction time
|
|
50
|
-
* @returns {Promise<void>} that resolves when the iframe is loaded and the message transport and iframe storage are initialized
|
|
51
|
-
*/
|
|
52
|
-
initializeIframeCommunication(): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* initialize the iframe communication by awaiting the iframe load promise
|
|
55
|
-
* and initializing the message transport and iframe storage after iframe is successfully loaded
|
|
56
|
-
*/
|
|
57
|
-
private doInitializeIframeCommunication;
|
|
58
|
-
/**
|
|
59
|
-
* create a promise to load an iframe
|
|
60
|
-
* @returns {Promise<void>} that resolves when the iframe is loaded
|
|
61
|
-
*/
|
|
62
|
-
private loadIframe;
|
|
63
|
-
/**
|
|
64
|
-
* Load an iframe for a specific container
|
|
65
|
-
* @param {HTMLElement} container - The container to which the iframe will be attached
|
|
66
|
-
* @returns {Promise<HTMLIFrameElement>} that resolves when the iframe is loaded
|
|
67
|
-
*/
|
|
68
|
-
private loadIframeForContainer;
|
|
69
|
-
/**
|
|
70
|
-
* initialize the message transport after iframe is successfully loaded
|
|
71
|
-
*/
|
|
72
|
-
private initializeMessageTransport;
|
|
73
|
-
/**
|
|
74
|
-
* initialize the iframe storage after iframe is successfully loaded
|
|
75
|
-
*/
|
|
76
|
-
private initializeIframeStorage;
|
|
77
|
-
/**
|
|
78
|
-
* Gets the initialized iframe instance. This method ensures the iframe is properly loaded and configured.
|
|
79
|
-
* The first call will initialize and await the iframe loading process.
|
|
80
|
-
* Subsequent calls will return the same iframe instance immediately.
|
|
81
|
-
*
|
|
82
|
-
* @throws {Error} If iframe initialization fails
|
|
83
|
-
* @throws {Error} If message transport initialization fails
|
|
84
|
-
* @throws {Error} If iframe storage initialization fails
|
|
85
|
-
* @returns {Promise<HTMLIFrameElement>} The initialized iframe element
|
|
86
|
-
*/
|
|
87
|
-
getIframe(): Promise<HTMLIFrameElement>;
|
|
88
|
-
/**
|
|
89
|
-
* Gets the initialized iframe storage instance. This method ensures the iframe storage is properly configured.
|
|
90
|
-
* The first call will initialize and await the iframe communication process.
|
|
91
|
-
* Subsequent calls will return the same storage instance immediately.
|
|
92
|
-
*
|
|
93
|
-
* @throws {Error} If iframe storage initialization fails
|
|
94
|
-
* @returns {Promise<SupportedStorage>} The initialized iframe storage instance
|
|
95
|
-
*/
|
|
96
|
-
getIframeStorage(): Promise<StorageRequestChannelAdapter>;
|
|
97
24
|
/**
|
|
98
25
|
* Client initialization logic
|
|
99
26
|
*/
|
|
@@ -167,7 +94,7 @@ export declare class DynamicWalletClient {
|
|
|
167
94
|
accountAddress: string;
|
|
168
95
|
chainName: string;
|
|
169
96
|
password?: string;
|
|
170
|
-
}): Promise<
|
|
97
|
+
}): Promise<void>;
|
|
171
98
|
getExportId({ chainName, clientKeyShare, }: {
|
|
172
99
|
chainName: string;
|
|
173
100
|
clientKeyShare: EcdsaKeygenResult | ExportableEd25519 | BIP340KeygenResult;
|
|
@@ -204,7 +131,7 @@ export declare class DynamicWalletClient {
|
|
|
204
131
|
oldThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
205
132
|
newThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
206
133
|
password?: string;
|
|
207
|
-
}): Promise<
|
|
134
|
+
}): Promise<void>;
|
|
208
135
|
exportKey({ accountAddress, chainName, password, }: {
|
|
209
136
|
accountAddress: string;
|
|
210
137
|
chainName: string;
|
|
@@ -315,11 +242,10 @@ export declare class DynamicWalletClient {
|
|
|
315
242
|
accountAddress: string;
|
|
316
243
|
password?: string;
|
|
317
244
|
}): Promise<void>;
|
|
318
|
-
restoreBackupFromGoogleDrive({ accountAddress,
|
|
245
|
+
restoreBackupFromGoogleDrive({ accountAddress, password, }: {
|
|
319
246
|
accountAddress: string;
|
|
320
247
|
password?: string;
|
|
321
|
-
|
|
322
|
-
}): Promise<ClientKeyShare[] | null>;
|
|
248
|
+
}): Promise<ClientKeyShare[]>;
|
|
323
249
|
exportClientKeyshares({ accountAddress, password, }: {
|
|
324
250
|
accountAddress: string;
|
|
325
251
|
password?: 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,EAGL,KAAK,wBAAwB,EAC7B,gBAAgB,EAIhB,cAAc,EAEd,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,eAAe,EAGhB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAEL,iBAAiB,EAEjB,KAAK,cAAc,EACnB,iBAAiB,EAEjB,kBAAkB,EAClB,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQ1E,OAAO,EAGL,KAAK,gBAAgB,EAEtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+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AAC;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"}
|
package/src/types.d.ts
CHANGED
|
@@ -7,8 +7,4 @@ export interface WalletProperties {
|
|
|
7
7
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
8
8
|
derivationPath?: string;
|
|
9
9
|
}
|
|
10
|
-
export type DisplayMessages = {
|
|
11
|
-
displayClientShares: (clientKeyShares?: string[]) => Promise<void>;
|
|
12
|
-
displayPrivateKey: (privateKey: string) => Promise<void>;
|
|
13
|
-
};
|
|
14
10
|
//# sourceMappingURL=types.d.ts.map
|
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;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
|
|
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"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type MessageTransportWithDefaultOrigin, type RequestChannel } from '@dynamic-labs/message-transport';
|
|
2
|
-
import { DisplayMessages } from '../types';
|
|
3
|
-
export declare class IframeDisplayChannelAdapter {
|
|
4
|
-
requestChannel: RequestChannel<DisplayMessages>;
|
|
5
|
-
constructor(messageTransport: MessageTransportWithDefaultOrigin);
|
|
6
|
-
displayClientShares(clientKeyShares?: string[]): Promise<void>;
|
|
7
|
-
displayPrivateKey(privateKey: string): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=iframeDisplay.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iframeDisplay.d.ts","sourceRoot":"","sources":["../../src/services/iframeDisplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,cAAc,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,qBAAa,2BAA2B;IACtC,cAAc,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;gBAEpC,gBAAgB,EAAE,iCAAiC;IAKzD,mBAAmB,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type MessageTransportWithDefaultOrigin, type RequestChannel, type StorageMessages } from '@dynamic-labs/message-transport';
|
|
2
|
-
/**
|
|
3
|
-
* StorageRequestChannelAdapter.getItem() sends a message within host domain
|
|
4
|
-
* the bridge on host will capture this request and forwards it to the iframe via contentWindow.postMessage()
|
|
5
|
-
*/
|
|
6
|
-
export declare class StorageRequestChannelAdapter {
|
|
7
|
-
requestChannel: RequestChannel<StorageMessages>;
|
|
8
|
-
constructor(messageTransport: MessageTransportWithDefaultOrigin);
|
|
9
|
-
getItem(key: string): Promise<string | object>;
|
|
10
|
-
setItem(key: string, value: string | object): Promise<void>;
|
|
11
|
-
removeItem(key: string): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=iframeLocalStorage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iframeLocalStorage.d.ts","sourceRoot":"","sources":["../../src/services/iframeLocalStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,iCAAiC,CAAC;AACzC;;;GAGG;AACH,qBAAa,4BAA4B;IACvC,cAAc,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;gBAEpC,gBAAgB,EAAE,iCAAiC;IAKzD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IAQ9C,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU3D,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAM7C"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type MessageTransportWithDefaultOrigin } from '@dynamic-labs/message-transport';
|
|
2
|
-
export declare const setupMessageTransportBridge: (messageTransport: MessageTransportWithDefaultOrigin, iframe: HTMLIFrameElement, iframeOrigin: string) => void;
|
|
3
|
-
//# sourceMappingURL=messageTransportBridge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|