@dynamic-labs-wallet/browser 0.0.0-preview.112

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.
Files changed (55) hide show
  1. package/index.cjs.d.ts +1 -0
  2. package/index.cjs.js +1792 -0
  3. package/index.esm.d.ts +1 -0
  4. package/index.esm.js +1725 -0
  5. package/internal/core/bip340.d.ts +22 -0
  6. package/internal/core/bip340.js +1 -0
  7. package/internal/core/common.d.ts +1 -0
  8. package/internal/core/common.js +1 -0
  9. package/internal/core/ecdsa.d.ts +23 -0
  10. package/internal/core/ecdsa.js +1 -0
  11. package/internal/core/ed25519.d.ts +22 -0
  12. package/internal/core/ed25519.js +1 -0
  13. package/internal/core/index.d.ts +6 -0
  14. package/internal/core/index.js +1 -0
  15. package/internal/core/native.d.ts +103 -0
  16. package/internal/core/native.js +1 -0
  17. package/internal/core/types.d.ts +58 -0
  18. package/internal/core/types.js +1 -0
  19. package/internal/web/generated/libmpc_executor.d.ts +130 -0
  20. package/internal/web/generated/libmpc_executor.js +2 -0
  21. package/internal/web/generated/libmpc_executor_bg.wasm +0 -0
  22. package/internal/web/generated/libmpc_executor_bg.wasm.d.ts +64 -0
  23. package/internal/web/index.d.ts +11 -0
  24. package/internal/web/index.js +1 -0
  25. package/package.json +34 -0
  26. package/src/backup/encryption.d.ts +22 -0
  27. package/src/backup/encryption.d.ts.map +1 -0
  28. package/src/backup/providers/googleDrive.d.ts +19 -0
  29. package/src/backup/providers/googleDrive.d.ts.map +1 -0
  30. package/src/client.d.ts +371 -0
  31. package/src/client.d.ts.map +1 -0
  32. package/src/constants.d.ts +5 -0
  33. package/src/constants.d.ts.map +1 -0
  34. package/src/index.d.ts +6 -0
  35. package/src/index.d.ts.map +1 -0
  36. package/src/mpc/index.d.ts +5 -0
  37. package/src/mpc/index.d.ts.map +1 -0
  38. package/src/mpc/mpc.d.ts +11 -0
  39. package/src/mpc/mpc.d.ts.map +1 -0
  40. package/src/mpc/types.d.ts +5 -0
  41. package/src/mpc/types.d.ts.map +1 -0
  42. package/src/services/iframeDisplay.d.ts +9 -0
  43. package/src/services/iframeDisplay.d.ts.map +1 -0
  44. package/src/services/iframeLocalStorage.d.ts +13 -0
  45. package/src/services/iframeLocalStorage.d.ts.map +1 -0
  46. package/src/services/localStorage.d.ts +32 -0
  47. package/src/services/localStorage.d.ts.map +1 -0
  48. package/src/services/logger.d.ts +3 -0
  49. package/src/services/logger.d.ts.map +1 -0
  50. package/src/services/messageTransportBridge.d.ts +3 -0
  51. package/src/services/messageTransportBridge.d.ts.map +1 -0
  52. package/src/types.d.ts +14 -0
  53. package/src/types.d.ts.map +1 -0
  54. package/src/utils.d.ts +43 -0
  55. package/src/utils.d.ts.map +1 -0
@@ -0,0 +1 @@
1
+ var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t);var n=Object.getOwnPropertyDescriptor(r,t);n&&("get"in n?r.__esModule:!n.writable&&!n.configurable)||(n={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,i,n)}:function(e,r,t,i){e[i=void 0===i?t:i]=r[t]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&__createBinding(r,e,t);return __setModuleDefault(r,e),r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BIP340=exports.Ed25519=exports.Ecdsa=exports.BIP340KeygenResult=exports.BIP340InitKeygenResult=exports.Ed25519InitKeygenResult=exports.EcdsaInitKeygenResult=exports.MessageHash=exports.Ed25519KeygenResult=exports.EcdsaSignature=exports.EcdsaPublicKey=exports.EcdsaKeygenResult=void 0;let lib_mpc_internal_1=require("../core"),libmpc_executor_1=(Object.defineProperty(exports,"EcdsaInitKeygenResult",{enumerable:!0,get:function(){return lib_mpc_internal_1.EcdsaInitKeygenResult}}),Object.defineProperty(exports,"EcdsaKeygenResult",{enumerable:!0,get:function(){return lib_mpc_internal_1.EcdsaKeygenResult}}),Object.defineProperty(exports,"EcdsaPublicKey",{enumerable:!0,get:function(){return lib_mpc_internal_1.EcdsaPublicKey}}),Object.defineProperty(exports,"EcdsaSignature",{enumerable:!0,get:function(){return lib_mpc_internal_1.EcdsaSignature}}),Object.defineProperty(exports,"Ed25519InitKeygenResult",{enumerable:!0,get:function(){return lib_mpc_internal_1.Ed25519InitKeygenResult}}),Object.defineProperty(exports,"Ed25519KeygenResult",{enumerable:!0,get:function(){return lib_mpc_internal_1.Ed25519KeygenResult}}),Object.defineProperty(exports,"BIP340InitKeygenResult",{enumerable:!0,get:function(){return lib_mpc_internal_1.BIP340InitKeygenResult}}),Object.defineProperty(exports,"BIP340KeygenResult",{enumerable:!0,get:function(){return lib_mpc_internal_1.BIP340KeygenResult}}),Object.defineProperty(exports,"MessageHash",{enumerable:!0,get:function(){return lib_mpc_internal_1.MessageHash}}),__importStar(require("./generated/libmpc_executor"))),sdkAPI=libmpc_executor_1,DEFAULT_RELAY_URL="relay.dynamicauth.com",sdkPromise=(0,libmpc_executor_1.default)().then(()=>({initKeygen:sdkAPI.initKeygen,createRoom:sdkAPI.createRoom,ecdsaGetExportID:sdkAPI.ecdsaGetExportID,ecdsaKeygen:sdkAPI.ecdsaKeygen,ecdsaSign:(e,r,t,i,n)=>sdkAPI.ecdsaSign(e,r,t,i,new Uint32Array(n)),ecdsaRefresh:sdkAPI.ecdsaRefresh,ecdsaReshareNewParty:sdkAPI.ecdsaReshareNewParty,ecdsaReshareRemainingParty:sdkAPI.ecdsaReshareRemainingParty,ecdsaDerivePubkey:(e,r)=>sdkAPI.ecdsaDerivePubkey(e,new Uint32Array(r)),ecdsaGetXpub:sdkAPI.ecdsaGetXpub,ecdsaDerivePubkeyFromXpub:async(e,r)=>sdkAPI.ecdsaDerivePubkeyFromXpub(e,new Uint32Array(r)),ecdsaExportFullPrivateKey:sdkAPI.ecdsaExportFullPrivateKey,ecdsaOfflineExportFullPrivateKey:sdkAPI.ecdsaOfflineExportFullPrivateKey,ecdsaDerivePrivateKeyFromXpriv:async(e,r)=>sdkAPI.ecdsaDerivePrivateKeyFromXpriv(e,new Uint32Array(r)),ecdsaImportPrivateKeyRecipient:sdkAPI.ecdsaImportPrivateKeyRecipient,ecdsaImportPrivateKeyImporter:sdkAPI.ecdsaImportPrivateKeyImporter,ed25519GetExportID:sdkAPI.ed25519GetExportID,ed25519Keygen:sdkAPI.ed25519Keygen,ed25519Sign:(e,r,t,i,n)=>sdkAPI.ed25519Sign(e,r,t,i,new Uint32Array(n)),ed25519Refresh:sdkAPI.ed25519Refresh,ed25519ReshareNewParty:sdkAPI.ed25519ReshareNewParty,ed25519ReshareRemainingParty:sdkAPI.ed25519ReshareRemainingParty,ed25519DerivePubkey:(e,r)=>sdkAPI.ed25519DerivePubkey(e,new Uint32Array(r)),ed25519GetSpub:sdkAPI.ed25519GetSpub,ed25519DerivePubkeyFromSpub:async(e,r)=>sdkAPI.ed25519DerivePubkeyFromSpub(e,new Uint32Array(r)),ed25519ExportFullPrivateKey:sdkAPI.ed25519ExportFullPrivateKey,ed25519OfflineExportFullPrivateKey:sdkAPI.ed25519OfflineExportFullPrivateKey,ed25519DerivePrivateKeyFromSpriv:async(e,r)=>sdkAPI.ed25519DerivePrivateKeyFromSpriv(e,new Uint32Array(r)),ed25519ImportPrivateKeyRecipient:sdkAPI.ed25519ImportPrivateKeyRecipient,ed25519ImportPrivateKeyImporter:sdkAPI.ed25519ImportPrivateKeyImporter,bip340GetExportID:sdkAPI.bip340GetExportID,bip340Keygen:sdkAPI.bip340Keygen,bip340Sign:async(e,r,t,i,n,s)=>sdkAPI.bip340Sign(e,r,t,i,new Uint32Array(n),s),bip340Refresh:sdkAPI.bip340Refresh,bip340ReshareNewParty:sdkAPI.bip340ReshareNewParty,bip340ReshareRemainingParty:sdkAPI.bip340ReshareRemainingParty,bip340DeriveTweakPubkey:async(e,r,t)=>sdkAPI.bip340DeriveTweakPubkey(e,new Uint32Array(r),t),bip340GetXpub:sdkAPI.bip340GetXpub,bip340DeriveTweakPubkeyFromXpub:async(e,r,t)=>sdkAPI.bip340DeriveTweakPubkeyFromXpub(e,new Uint32Array(r),t),bip340ExportFullPrivateKey:sdkAPI.bip340ExportFullPrivateKey,bip340DerivePrivateKeyFromXpriv:async(e,r)=>sdkAPI.bip340DerivePrivateKeyFromXpriv(e,new Uint32Array(r)),bip340OfflineExportFullPrivateKey:sdkAPI.bip340OfflineExportFullPrivateKey,bip340ImportPrivateKeyRecipient:sdkAPI.bip340ImportPrivateKeyRecipient,bip340ImportPrivateKeyImporter:sdkAPI.bip340ImportPrivateKeyImporter}));class Ecdsa extends lib_mpc_internal_1.Ecdsa{constructor(e){super(sdkPromise,e||DEFAULT_RELAY_URL)}}exports.Ecdsa=Ecdsa;class Ed25519 extends lib_mpc_internal_1.Ed25519{constructor(e){super(sdkPromise,e||DEFAULT_RELAY_URL)}}exports.Ed25519=Ed25519;class BIP340 extends lib_mpc_internal_1.BIP340{constructor(e){super(sdkPromise,e||DEFAULT_RELAY_URL)}}exports.BIP340=BIP340;
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@dynamic-labs-wallet/browser",
3
+ "version": "0.0.0-preview.112",
4
+ "license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
5
+ "dependencies": {
6
+ "@dynamic-labs-wallet/core": "0.0.0-preview.112",
7
+ "@dynamic-labs/logger": "^4.9.9",
8
+ "@dynamic-labs/message-transport": "^4.9.9"
9
+ },
10
+ "files": [
11
+ "*",
12
+ "node_modules/**/*"
13
+ ],
14
+ "nx": {
15
+ "sourceRoot": "packages/browser/src",
16
+ "projectType": "library",
17
+ "name": "browser",
18
+ "targets": {
19
+ "build": {}
20
+ }
21
+ },
22
+ "main": "./index.cjs.js",
23
+ "module": "./index.esm.js",
24
+ "types": "./index.esm.d.ts",
25
+ "exports": {
26
+ "./package.json": "./package.json",
27
+ ".": {
28
+ "types": "./index.esm.d.ts",
29
+ "import": "./index.esm.js",
30
+ "require": "./index.cjs.js",
31
+ "default": "./index.cjs.js"
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,22 @@
1
+ export declare const PBKDF2_ALGORITHM = "PBKDF2";
2
+ export declare const PBKDF2_ITERATIONS = 100000;
3
+ export declare const PBKDF2_HASH_ALGORITHM = "SHA-256";
4
+ export declare const AES_GCM_ALGORITHM = "AES-GCM";
5
+ export declare const AES_GCM_LENGTH = 256;
6
+ export declare const encryptData: ({ data, password, }: {
7
+ data: string;
8
+ password: string;
9
+ }) => Promise<{
10
+ salt: string;
11
+ iv: string;
12
+ cipher: string;
13
+ }>;
14
+ export declare const decryptData: ({ data, password, }: {
15
+ data: {
16
+ salt: string;
17
+ iv: string;
18
+ cipher: string;
19
+ };
20
+ password: string;
21
+ }) => Promise<string>;
22
+ //# sourceMappingURL=encryption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/backup/encryption.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,cAAc,MAAM,CAAC;AAiClC,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;;;;EA2BA,CAAC;AAEF,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAC;CAClB,oBAyBA,CAAC"}
@@ -0,0 +1,19 @@
1
+ export declare const uploadFileToGoogleDriveAppStorage: ({ accessToken, fileName, jsonData, }: {
2
+ accessToken: string;
3
+ fileName: string;
4
+ jsonData: unknown;
5
+ }) => Promise<any>;
6
+ export declare const uploadFileToGoogleDrivePersonal: ({ accessToken, fileName, jsonData, }: {
7
+ accessToken: string;
8
+ fileName: string;
9
+ jsonData: unknown;
10
+ }) => Promise<any>;
11
+ export declare const listFilesFromGoogleDrive: ({ accessToken, name, }: {
12
+ accessToken: string;
13
+ name: string;
14
+ }) => Promise<any>;
15
+ export declare const downloadFileFromGoogleDrive: ({ accessToken, name, }: {
16
+ accessToken: string;
17
+ name: string;
18
+ }) => Promise<unknown | null>;
19
+ //# sourceMappingURL=googleDrive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"googleDrive.d.ts","sourceRoot":"","sources":["../../../src/backup/providers/googleDrive.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iCAAiC,yCAI3C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAEF,eAAO,MAAM,+BAA+B,yCAIzC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAgDF,eAAO,MAAM,wBAAwB,2BAGlC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,iBAsBA,CAAC;AAEF,eAAO,MAAM,2BAA2B,2BAGrC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAgCzB,CAAC"}
@@ -0,0 +1,371 @@
1
+ import { ThresholdSignatureScheme, DynamicApiClient, BackupLocation, DynamicWalletClientProps, InitializeResult, KeyShareBackupInfo, WalletOperation } from '@dynamic-labs-wallet/core';
2
+ import { EcdsaPublicKey, EcdsaKeygenResult, Ed25519KeygenResult, BIP340KeygenResult, EcdsaSignature } from '../../internal/web';
3
+ import { ClientInitKeygenResult, ClientKeyShare } from './mpc/types';
4
+ import { SupportedStorage } from './services/localStorage';
5
+ import { 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
+ export declare class DynamicWalletClient {
10
+ environmentId: string;
11
+ storageKey: string;
12
+ debug: boolean;
13
+ protected initializePromise: Promise<InitializeResult> | null;
14
+ protected logger: import("@dynamic-labs/logger").Logger;
15
+ protected apiClient: DynamicApiClient;
16
+ protected walletMap: Record<string, WalletProperties>;
17
+ protected storage: SupportedStorage;
18
+ protected iframeStorage: StorageRequestChannelAdapter | null;
19
+ protected iframeDisplay: IframeDisplayChannelAdapter | null;
20
+ protected memoryStorage: {
21
+ [key: string]: string;
22
+ } | null;
23
+ protected baseMPCRelayApiUrl?: string;
24
+ protected messageTransport: MessageTransportWithDefaultOrigin | null;
25
+ protected iframe: HTMLIFrameElement | null;
26
+ readonly instanceId: string;
27
+ readonly iframeDomain: string;
28
+ private iframeLoadPromise;
29
+ constructor({ environmentId, authToken, baseApiUrl, baseMPCRelayApiUrl, storageKey, debug, }: DynamicWalletClientProps);
30
+ 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
+ /**
98
+ * Client initialization logic
99
+ */
100
+ protected _initialize(): Promise<InitializeResult>;
101
+ serverInitializeKeyGen({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
102
+ chainName: string;
103
+ clientKeygenIds: string[];
104
+ thresholdSignatureScheme: ThresholdSignatureScheme;
105
+ onError?: (error: Error) => void;
106
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
107
+ }): Promise<import("@dynamic-labs-wallet/core").KeygenCompleteResponse>;
108
+ clientInitializeKeyGen({ chainName, thresholdSignatureScheme, }: {
109
+ chainName: string;
110
+ thresholdSignatureScheme: ThresholdSignatureScheme;
111
+ }): Promise<ClientInitKeygenResult[]>;
112
+ derivePublicKey({ chainName, keyShare, derivationPath, }: {
113
+ chainName: string;
114
+ keyShare: ClientKeyShare;
115
+ derivationPath: Uint32Array | undefined;
116
+ }): Promise<EcdsaPublicKey | Uint8Array | undefined>;
117
+ clientKeyGen({ chainName, roomId, serverKeygenIds, clientKeygenInitResults, thresholdSignatureScheme, }: {
118
+ chainName: string;
119
+ roomId: string;
120
+ serverKeygenIds: string[];
121
+ clientKeygenInitResults: ClientInitKeygenResult[];
122
+ thresholdSignatureScheme: ThresholdSignatureScheme;
123
+ }): Promise<{
124
+ rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
125
+ clientKeygenResults: ClientKeyShare[];
126
+ }>;
127
+ keyGen({ chainName, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
128
+ chainName: string;
129
+ thresholdSignatureScheme: ThresholdSignatureScheme;
130
+ onError?: (error: Error) => void;
131
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
132
+ }): Promise<{
133
+ rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
134
+ clientKeyShares: ClientKeyShare[];
135
+ }>;
136
+ importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
137
+ chainName: string;
138
+ privateKey: string;
139
+ thresholdSignatureScheme: ThresholdSignatureScheme;
140
+ onError?: (error: Error) => void;
141
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
142
+ }): Promise<{
143
+ rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
144
+ clientKeyShares: ClientKeyShare[];
145
+ }>;
146
+ serverSign({ walletId, message, }: {
147
+ walletId: string;
148
+ message: string | Uint8Array;
149
+ }): Promise<import("@dynamic-labs-wallet/core").OpenRoomResponse>;
150
+ clientSign({ chainName, message, roomId, keyShare, derivationPath, }: {
151
+ chainName: string;
152
+ message: string | Uint8Array;
153
+ roomId: string;
154
+ keyShare: ClientKeyShare;
155
+ derivationPath: Uint32Array | undefined;
156
+ }): Promise<Uint8Array | EcdsaSignature>;
157
+ sign({ accountAddress, message, chainName, password, }: {
158
+ accountAddress: string;
159
+ message: string | Uint8Array;
160
+ chainName: string;
161
+ password?: string;
162
+ }): Promise<Uint8Array | EcdsaSignature>;
163
+ refreshWalletAccountShares({ accountAddress, chainName, password, }: {
164
+ accountAddress: string;
165
+ chainName: string;
166
+ password?: string;
167
+ }): Promise<(EcdsaKeygenResult | BIP340KeygenResult)[]>;
168
+ getExportId({ chainName, clientKeyShare, }: {
169
+ chainName: string;
170
+ clientKeyShare: EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
171
+ }): Promise<string>;
172
+ /**
173
+ * Helper function to create client shares required to complete a reshare ceremony.
174
+ * @param {string} chainName - The chain to create shares for
175
+ * @param {WalletProperties} wallet - The wallet to reshare
176
+ * @param {ThresholdSignatureScheme} oldThresholdSignatureScheme - The current threshold signature scheme
177
+ * @param {ThresholdSignatureScheme} newThresholdSignatureScheme - The target threshold signature scheme
178
+ * @returns {Promise<{
179
+ * newClientInitKeygenResults: ClientInitKeygenResult[],
180
+ * newClientKeygenIds: string[],
181
+ * existingClientKeygenIds: string[],
182
+ * existingClientKeyShares: ClientKeyShare[]
183
+ * }>} Object containing new and existing client keygen results, IDs and shares
184
+ * @todo Support higher to lower reshare strategies
185
+ */
186
+ reshareStrategy({ chainName, wallet, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, }: {
187
+ chainName: string;
188
+ wallet: WalletProperties;
189
+ accountAddress: string;
190
+ oldThresholdSignatureScheme: ThresholdSignatureScheme;
191
+ newThresholdSignatureScheme: ThresholdSignatureScheme;
192
+ }): Promise<{
193
+ newClientInitKeygenResults: ClientInitKeygenResult[];
194
+ newClientKeygenIds: string[];
195
+ existingClientKeygenIds: string[];
196
+ existingClientKeyShares: ClientKeyShare[];
197
+ }>;
198
+ reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password, }: {
199
+ chainName: string;
200
+ accountAddress: string;
201
+ oldThresholdSignatureScheme: ThresholdSignatureScheme;
202
+ newThresholdSignatureScheme: ThresholdSignatureScheme;
203
+ password?: string;
204
+ }): Promise<(EcdsaKeygenResult | BIP340KeygenResult)[]>;
205
+ exportKey({ accountAddress, displayContainer, chainName, password, }: {
206
+ accountAddress: string;
207
+ displayContainer: HTMLElement;
208
+ chainName: string;
209
+ password?: string;
210
+ }): Promise<{
211
+ derivedPrivateKey: string | undefined;
212
+ }>;
213
+ offlineExportKey({ chainName, keyShares, derivationPath, }: {
214
+ chainName: string;
215
+ keyShares: ClientKeyShare[];
216
+ derivationPath?: string;
217
+ }): Promise<{
218
+ derivedPrivateKey: string | undefined;
219
+ rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
220
+ }>;
221
+ encryptKeyShare({ keyShare, password, }: {
222
+ keyShare: ClientKeyShare;
223
+ password?: string;
224
+ }): Promise<string>;
225
+ /**
226
+ * helper function to store encrypted backup by wallet from iframe local storage
227
+ */
228
+ getClientKeySharesFromLocalStorage({ accountAddress, }: {
229
+ accountAddress: string;
230
+ }): Promise<ClientKeyShare[]>;
231
+ /**
232
+ * helper function to store encrypted backup by wallet from iframe local storage
233
+ */
234
+ setClientKeySharesToLocalStorage({ accountAddress, clientKeyShares, overwriteOrMerge, }: {
235
+ accountAddress: string;
236
+ clientKeyShares: ClientKeyShare[];
237
+ overwriteOrMerge?: 'overwrite' | 'merge';
238
+ }): Promise<void>;
239
+ /**
240
+ * Encrypts and stores wallet key shares as backups.
241
+ *
242
+ * This method encrypts all client key shares for a specific wallet and stores them
243
+ * in Dynamic's backend. If Google Drive backup is already configured for this wallet,
244
+ * it will also update the backup in Google Drive.
245
+ *
246
+ * The method performs the following steps:
247
+ * 1. Encrypts all client key shares with the provided password (or environment ID if no password)
248
+ * 2. Stores the encrypted key shares in Dynamic's backend
249
+ * 3. If Google Drive backup exists, updates the backup there as well
250
+ * 4. Updates the local wallet map with the new backup information
251
+ * 5. Persists the updated wallet map to storage
252
+ *
253
+ * @param {Object} params - The parameters for the backup operation
254
+ * @param {string} params.accountAddress - The account address of the wallet to backup
255
+ * @param {string} [params.password] - Optional password for encrypting the key shares
256
+ */
257
+ storeEncryptedBackupByWallet({ accountAddress, clientKeyShares, password, }: {
258
+ accountAddress: string;
259
+ clientKeyShares?: ClientKeyShare[];
260
+ password?: string;
261
+ }): Promise<any>;
262
+ storeEncryptedBackupByWalletWithRetry({ accountAddress, clientKeyShares, password, }: {
263
+ accountAddress: string;
264
+ clientKeyShares?: ClientKeyShare[];
265
+ password?: string;
266
+ }): Promise<void>;
267
+ updatePassword({ accountAddress, existingPassword, newPassword, }: {
268
+ accountAddress: string;
269
+ existingPassword?: string;
270
+ newPassword?: string;
271
+ }): Promise<void>;
272
+ decryptKeyShare({ keyShare, password, }: {
273
+ keyShare: string;
274
+ password?: string;
275
+ }): Promise<ClientKeyShare>;
276
+ /**
277
+ * Helper function to determine keyshare recovery strategy for dynamic shares.
278
+ * For REFRESH operations, retrieves enough shares to meet the client threshold.
279
+ * For all other operations, retrieves just 1 share.
280
+ *
281
+ * @param clientKeyShareBackupInfo - Information about backed up key shares
282
+ * @param thresholdSignatureScheme - The signature scheme being used (2-of-2, 2-of-3, etc)
283
+ * @param walletOperation - The operation being performed (REFRESH, SIGN_MESSAGE, etc)
284
+ * @param shareCount - The number of shares to recover if specified for reshare operations
285
+ * @returns @shares: Object mapping backup locations to arrays of share IDs to recover
286
+ * @returns @requiredShareCount: The number of shares required to recover
287
+ */
288
+ recoverStrategy({ clientKeyShareBackupInfo, thresholdSignatureScheme, walletOperation, shareCount, }: {
289
+ clientKeyShareBackupInfo: KeyShareBackupInfo;
290
+ thresholdSignatureScheme: ThresholdSignatureScheme;
291
+ walletOperation: WalletOperation;
292
+ shareCount?: number;
293
+ }): {
294
+ shares: Partial<Record<BackupLocation, string[]>>;
295
+ requiredShareCount: number;
296
+ };
297
+ recoverEncryptedBackupByWallet({ accountAddress, password, walletOperation, shareCount, storeRecoveredShares, }: {
298
+ accountAddress: string;
299
+ password?: string;
300
+ walletOperation: WalletOperation;
301
+ shareCount?: number;
302
+ storeRecoveredShares?: boolean;
303
+ }): Promise<any[]>;
304
+ restoreWallets(): Promise<void>;
305
+ backupKeySharesToGoogleDrive({ accountAddress, fileName, oauthAccountId, password, }: {
306
+ accountAddress: string;
307
+ fileName?: string;
308
+ oauthAccountId: string;
309
+ password?: string;
310
+ }): Promise<any>;
311
+ restoreBackupFromGoogleDrive({ accountAddress, oauthAccountId, name, displayContainer, password, }: {
312
+ accountAddress: string;
313
+ oauthAccountId: string;
314
+ name?: string;
315
+ password?: string;
316
+ displayContainer: HTMLElement;
317
+ }): Promise<ClientKeyShare[] | null>;
318
+ exportClientKeyshares({ accountAddress, password, }: {
319
+ accountAddress: string;
320
+ password?: string;
321
+ }): Promise<void>;
322
+ getClientKeyShares({ accountAddress, password, }: {
323
+ accountAddress: string;
324
+ password?: string;
325
+ }): Promise<ClientKeyShare[]>;
326
+ /**
327
+ * Helper function to check if the required wallet fields are present and valid
328
+ * @param accountAddress - The account address of the wallet to check
329
+ * @param walletOperation - The wallet operation that determines required fields
330
+ * @returns boolean indicating if wallet needs to be re-fetched and restored from server
331
+ */
332
+ private checkWalletFields;
333
+ /**
334
+ * verifyPassword attempts to recover and decrypt a single client key share using the provided password.
335
+ * If successful, the key share is encrypted with the new password. This method solely performs the recovery
336
+ * and decryption without storing the restored key shares. If unsuccessful, it throws an error.
337
+ */
338
+ verifyPassword({ accountAddress, password, walletOperation, }: {
339
+ accountAddress: string;
340
+ password?: string;
341
+ walletOperation?: WalletOperation;
342
+ }): Promise<void>;
343
+ isPasswordEncrypted({ accountAddress, }: {
344
+ accountAddress: string;
345
+ }): Promise<boolean>;
346
+ /**
347
+ * check if the operation requires a password
348
+ */
349
+ requiresPasswordForOperation({ accountAddress, walletOperation, }: {
350
+ accountAddress: string;
351
+ walletOperation?: WalletOperation;
352
+ }): Promise<boolean>;
353
+ /**
354
+ * check if the operation requires restoring backup shares
355
+ */
356
+ requiresRestoreBackupSharesForOperation({ accountAddress, walletOperation, }: {
357
+ accountAddress: string;
358
+ walletOperation?: WalletOperation;
359
+ }): Promise<boolean>;
360
+ getWalletClientKeyShareBackupInfo({ accountAddress, }: {
361
+ accountAddress: string;
362
+ }): Promise<KeyShareBackupInfo>;
363
+ getWallet({ accountAddress, walletOperation, shareCount, password, }: {
364
+ accountAddress: string;
365
+ walletOperation?: WalletOperation;
366
+ shareCount?: number;
367
+ password?: string;
368
+ }): Promise<WalletProperties>;
369
+ getWallets(): Promise<any>;
370
+ }
371
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,wBAAwB,EACxB,gBAAgB,EAIhB,cAAc,EAEd,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAoBrE,OAAO,EAGL,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAS3C,OAAO,EAGL,KAAK,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CjB"}
@@ -0,0 +1,5 @@
1
+ export declare const DEFAULT_LOG_LEVEL = "INFO";
2
+ export declare const STORAGE_KEY = "dynamic-waas-wallet-client";
3
+ export declare const BACKUP_FILENAME = "dynamicWalletKeyShareBackup.json";
4
+ export declare const CLIENT_KEYSHARE_EXPORT_FILENAME_PREFIX = "dynamicWalletKeyShareBackup";
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../packages/src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAExC,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAExD,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAElE,eAAO,MAAM,sCAAsC,gCACpB,CAAC"}
package/src/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from '@dynamic-labs-wallet/core';
2
+ export * from './client';
3
+ export * from './types';
4
+ export * from './mpc/index';
5
+ export * from './utils';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAE1C,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AAExB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Ecdsa, Ed25519, BIP340, BIP340KeygenResult, EcdsaPublicKey, Ed25519KeygenResult, EcdsaKeygenResult, MessageHash, EcdsaInitKeygenResult, Ed25519InitKeygenResult, BIP340InitKeygenResult, EcdsaSignature } from '../../../internal/web';
2
+ export { Ecdsa, Ed25519, BIP340, EcdsaPublicKey, EcdsaKeygenResult, Ed25519KeygenResult, BIP340KeygenResult, MessageHash, EcdsaInitKeygenResult, Ed25519InitKeygenResult, BIP340InitKeygenResult, EcdsaSignature, };
3
+ export * from './mpc';
4
+ export * from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACf,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,GACf,CAAC;AAEF,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { SigningAlgorithm } from '@dynamic-labs-wallet/core';
2
+ import { Ecdsa, Ed25519, BIP340 } from '../../../internal/web';
3
+ export declare const getMPCSignatureScheme: ({ signingAlgorithm, baseRelayUrl, }: {
4
+ signingAlgorithm: SigningAlgorithm;
5
+ baseRelayUrl?: string;
6
+ }) => Ecdsa | Ed25519 | BIP340;
7
+ export declare const getMPCSigner: ({ chainName, baseRelayUrl, }: {
8
+ chainName: string;
9
+ baseRelayUrl?: string;
10
+ }) => Ecdsa | Ed25519 | BIP340;
11
+ //# sourceMappingURL=mpc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mpc.d.ts","sourceRoot":"","sources":["../../src/mpc/mpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvD,eAAO,MAAM,qBAAqB,wCAG/B;IACD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,6BAWA,CAAC;AAEF,eAAO,MAAM,YAAY,iCAGtB;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,6BAOA,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { BIP340InitKeygenResult, BIP340KeygenResult, Ed25519InitKeygenResult, EcdsaInitKeygenResult, EcdsaKeygenResult, Ed25519KeygenResult } from '../../../internal/web';
2
+ export type ClientInitKeygenResult = EcdsaInitKeygenResult | Ed25519InitKeygenResult | BIP340InitKeygenResult;
3
+ export type ClientKeyShare = EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
4
+ export type { Ecdsa, Ed25519, BIP340, EcdsaPublicKey, EcdsaKeygenResult, Ed25519KeygenResult, BIP340KeygenResult, MessageHash, EcdsaSignature, } from '../../../internal/web';
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mpc/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,CAAC;AAEvB,YAAY,EACV,KAAK,EACL,OAAO,EACP,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,eAAe,CAAC"}
@@ -0,0 +1,9 @@
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(accountAddress: string): Promise<void>;
7
+ displayPrivateKey(accountAddress: string, privateKey: string): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=iframeDisplay.d.ts.map
@@ -0,0 +1 @@
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,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1D,iBAAiB,CACrB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;CAOjB"}
@@ -0,0 +1,13 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,32 @@
1
+ type AnyFunction = (...args: any[]) => any;
2
+ type MaybePromisify<T> = T | Promise<T>;
3
+ type PromisifyMethods<T> = {
4
+ [K in keyof T]: T[K] extends AnyFunction ? (...args: Parameters<T[K]>) => MaybePromisify<ReturnType<T[K]>> : T[K];
5
+ };
6
+ export type SupportedStorage = PromisifyMethods<Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>> & {
7
+ /**
8
+ * If set to `true` signals to the library that the storage medium is used
9
+ * on a server and the values may not be authentic, such as reading from
10
+ * request cookies. Implementations should not set this to true if the client
11
+ * is used on a server that reads storage information from authenticated
12
+ * sources, such as a secure database or file.
13
+ */
14
+ isServer?: boolean;
15
+ };
16
+ /**
17
+ * Checks whether localStorage is supported on this browser.
18
+ */
19
+ export declare const supportsLocalStorage: () => boolean;
20
+ /**
21
+ * Provides safe access to the globalThis.localStorage property.
22
+ */
23
+ export declare const localStorageAdapter: SupportedStorage;
24
+ /**
25
+ * Returns a localStorage-like object that stores the key-value pairs in
26
+ * memory.
27
+ */
28
+ export declare const memoryLocalStorageAdapter: (store?: {
29
+ [key: string]: string;
30
+ }) => SupportedStorage;
31
+ export {};
32
+ //# sourceMappingURL=localStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../src/services/localStorage.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAC3C,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAExC,KAAK,gBAAgB,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,WAAW,GACpC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC/D,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAC7C,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,YAAY,CAAC,CACpD,GAAG;IACF;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAOF;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAiChC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBAsBjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,WAC7B;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,KAC/B,gBAUD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Logger } from '@dynamic-labs/logger';
2
+ export declare const logger: Logger;
3
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/services/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,eAAO,MAAM,MAAM,QAAwC,CAAC"}
@@ -0,0 +1,3 @@
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
@@ -0,0 +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,SAwDrB,CAAC"}