@dynamic-labs-wallet/core 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.
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@dynamic-labs-wallet/core",
3
+ "version": "0.0.0-preview.112",
4
+ "license": "MIT",
5
+ "dependencies": {
6
+ "axios": "1.7.9"
7
+ },
8
+ "files": [
9
+ "*",
10
+ "node_modules/**/*"
11
+ ],
12
+ "nx": {
13
+ "sourceRoot": "packages/core/src",
14
+ "projectType": "library",
15
+ "name": "core",
16
+ "targets": {
17
+ "build": {}
18
+ }
19
+ },
20
+ "type": "module",
21
+ "main": "./index.cjs.js",
22
+ "module": "./index.esm.js",
23
+ "types": "./index.esm.d.ts",
24
+ "exports": {
25
+ "./package.json": "./package.json",
26
+ ".": {
27
+ "types": "./index.esm.d.ts",
28
+ "import": "./index.esm.js",
29
+ "require": "./index.cjs.js",
30
+ "default": "./index.cjs.js"
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,69 @@
1
+ import type { ThresholdSignatureScheme } from '../mpc/constants';
2
+ import { BaseClient } from './client';
3
+ import { type KeygenCompleteResponse, type OpenRoomResponse, type ReshareResponse } from '../types';
4
+ export declare class DynamicApiClient extends BaseClient {
5
+ constructor({ environmentId, authToken, baseApiUrl, }: {
6
+ environmentId: string;
7
+ authToken: string;
8
+ baseApiUrl?: string;
9
+ });
10
+ authenticateApiToken({ environmentId }: {
11
+ environmentId: string;
12
+ }): Promise<import("axios").AxiosResponse<any, any>>;
13
+ createWalletAccount({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
14
+ chainName: string;
15
+ clientKeygenIds: string[];
16
+ thresholdSignatureScheme: ThresholdSignatureScheme;
17
+ onError?: (error: Error) => void;
18
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
19
+ }): Promise<KeygenCompleteResponse>;
20
+ signMessage({ walletId, message, onError, }: {
21
+ walletId: string;
22
+ message: string;
23
+ onError?: (error: Error) => void;
24
+ }): Promise<OpenRoomResponse>;
25
+ refreshWalletAccountShares({ walletId, onError, }: {
26
+ walletId: string;
27
+ onError?: (error: Error) => void;
28
+ }): Promise<{
29
+ roomId: string;
30
+ serverKeygenIds: string[];
31
+ }>;
32
+ reshare({ walletId, clientKeygenIds, oldThresholdSignatureScheme, newThresholdSignatureScheme, onError, }: {
33
+ walletId: string;
34
+ clientKeygenIds: string[];
35
+ oldThresholdSignatureScheme: ThresholdSignatureScheme;
36
+ newThresholdSignatureScheme: ThresholdSignatureScheme;
37
+ onError?: (error: Error) => void;
38
+ }): Promise<ReshareResponse>;
39
+ exportKey({ walletId, exportId, onError, }: {
40
+ walletId: string;
41
+ exportId: string;
42
+ onError?: (error: Error) => void;
43
+ }): Promise<OpenRoomResponse>;
44
+ storeEncryptedBackupByWallet({ walletId, encryptedKeyShares, passwordEncrypted, }: {
45
+ walletId: string;
46
+ encryptedKeyShares: string[];
47
+ passwordEncrypted: boolean;
48
+ }): Promise<any>;
49
+ markKeySharesAsBackedUpGoogleDrive({ walletId }: {
50
+ walletId: string;
51
+ }): Promise<any>;
52
+ recoverEncryptedBackupByWallet({ walletId, keyShareIds, }: {
53
+ walletId: string;
54
+ keyShareIds?: string[];
55
+ }): Promise<any>;
56
+ getAccessToken({ oauthAccountId }: {
57
+ oauthAccountId: string;
58
+ }): Promise<any>;
59
+ importPrivateKey({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
60
+ chainName: string;
61
+ clientKeygenIds: string[];
62
+ thresholdSignatureScheme: ThresholdSignatureScheme;
63
+ onError?: (error: Error) => void;
64
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
65
+ }): Promise<KeygenCompleteResponse>;
66
+ getUser(): Promise<any>;
67
+ refreshUser(): Promise<any>;
68
+ }
69
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceR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CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;QACjC,kBAAkB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;KACzE;IAiBK,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;IAsBvB,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;CAqBlC"}
@@ -0,0 +1,15 @@
1
+ import { type AxiosInstance } from 'axios';
2
+ export declare class BaseClient {
3
+ apiClient: AxiosInstance;
4
+ baseApiUrl: string;
5
+ environmentId: string;
6
+ clientRelayBaseApiUrl: string;
7
+ clientRelayApiClient: AxiosInstance;
8
+ constructor({ environmentId, baseApiUrl, authToken, baseClientRelayApiUrl, }: {
9
+ environmentId: string;
10
+ baseApiUrl?: string;
11
+ authToken: string;
12
+ baseClientRelayApiUrl?: string;
13
+ });
14
+ }
15
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAQlD,qBAAa,UAAU;IACd,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,aAAa,CAAC;gBAE/B,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,qBAAqB,GACtB,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAChC;CA0BF"}
@@ -0,0 +1,2 @@
1
+ export * from './api';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
@@ -0,0 +1,42 @@
1
+ export declare const DYNAMIC_AUTH_PROD_BASE_API_URL = "https://app.dynamicauth.com";
2
+ export declare const DYNAMIC_AUTH_PREPROD_BASE_API_URL = "https://app.dynamic-preprod.xyz";
3
+ export declare const DYNAMIC_CLIENT_RELAY_PROD_BASE_API_URL = "https://app-dynamicauth-com-app-6e12fc400995.relay.evervault.app";
4
+ export declare const DYNAMIC_CLIENT_RELAY_PREPROD_BASE_API_URL = "https://app-dynamic-preprod-xyz-app-32d15525a875.relay.evervault.app";
5
+ export declare const MPC_RELAY_PROD_API_URL = "relay.dynamicauth.com";
6
+ export declare const MPC_RELAY_PREPROD_API_URL = "relay.dynamic-preprod.xyz";
7
+ export declare const SOLANA_RPC_URL = "https://api.devnet.solana.com";
8
+ export declare const chain: {
9
+ readonly EVM: "EVM";
10
+ readonly SOL: "SOL";
11
+ readonly COSMOS: "COSMOS";
12
+ readonly BTC: "BTC";
13
+ readonly FLOW: "FLOW";
14
+ readonly SUI: "SUI";
15
+ };
16
+ export type ChainType = (typeof chain)[keyof typeof chain];
17
+ export declare enum WalletOperation {
18
+ REACH_THRESHOLD = "REACH_THRESHOLD",
19
+ REACH_ALL_PARTIES = "REACH_ALL_PARTIES",
20
+ SIGN_MESSAGE = "SIGN_MESSAGE",
21
+ SIGN_TRANSACTION = "SIGN_TRANSACTION",
22
+ REFRESH = "REFRESH",
23
+ RESHARE = "RESHARE",
24
+ EXPORT_PRIVATE_KEY = "EXPORT_PRIVATE_KEY",
25
+ NO_OPERATION = "NO_OPERATION"
26
+ }
27
+ export declare enum BackupLocation {
28
+ DYNAMIC = "dynamic",
29
+ GOOGLE_DRIVE = "googleDrive",
30
+ ICLOUD = "iCloud",
31
+ USER = "user",
32
+ EXTERNAL = "external"
33
+ }
34
+ export declare const IFRAME_DOMAIN_PREPROD = "https://waas.dynamic-preprod.xyz";
35
+ export declare const IFRAME_DOMAIN_PROD = "https://waas.dynamicauth.com";
36
+ export declare const ChainEnumToVerifiedCredentialName: {
37
+ [key: string]: string;
38
+ };
39
+ export declare const VerifiedCredentialNameToChainEnum: {
40
+ [key: string]: string;
41
+ };
42
+ //# 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,8BAA8B,gCAAgC,CAAC;AAC5E,eAAO,MAAM,iCAAiC,oCACX,CAAC;AAEpC,eAAO,MAAM,sCAAsC,qEACiB,CAAC;AACrE,eAAO,MAAM,yCAAyC,yEACkB,CAAC;AAEzE,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAC9D,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AAErE,eAAO,MAAM,cAAc,kCAAkC,CAAC;AAE9D,eAAO,MAAM,KAAK;;;;;;;CAOR,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAC;AAE3D,oBAAY,eAAe;IACzB,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;IACvC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,kBAAkB,uBAAuB;IACzC,YAAY,iBAAiB;CAC9B;AAED,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,YAAY,gBAAgB;IAC5B,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAGD,eAAO,MAAM,qBAAqB,qCAAqC,CAAC;AACxE,eAAO,MAAM,kBAAkB,iCAAiC,CAAC;AAEjE,eAAO,MAAM,iCAAiC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAKtE,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAItE,CAAC"}
@@ -0,0 +1,50 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ import { SuccessEventType } from '../types';
3
+ /**
4
+ * Creates a promise that resolves when a specific event is received from an event stream.
5
+ * Adds a timeout to prevent hanging and races the two promises.
6
+ *
7
+ * @template T The expected type of the response data
8
+ * @param apiClient The axios instance to use for API calls
9
+ * @param options The configuration options
10
+ * @returns A promise that resolves with the event data or rejects on timeout
11
+ */
12
+ export declare const createEventStreamPromise: <T>({ apiClient, endpoint, body, successEventType, timeoutMs, timeoutMessage, onError, onCeremonyComplete, }: {
13
+ apiClient: AxiosInstance;
14
+ endpoint: string;
15
+ body: Record<string, unknown> | undefined;
16
+ successEventType: SuccessEventType;
17
+ timeoutMs?: number;
18
+ timeoutMessage: string;
19
+ onError?: (error: Error) => void;
20
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
21
+ }) => Promise<T>;
22
+ /**
23
+ * Creates a handler function for processing server-sent events (SSE) streams.
24
+ * This utility manages asynchronous event-based communication with the server,
25
+ * particularly for long-running operations like wallet creation or key generation.
26
+ *
27
+ * @template T - The expected type of the successful response data
28
+ * @param {function} resolve - Promise resolution function to call when the success event is received
29
+ * @param {function} reject - Promise rejection function to call when an error occurs
30
+ * @param {string} successEventType - The event type string that indicates a successful operation
31
+ * @param {function} [onError] - Optional callback for error handling, allowing custom error processing
32
+ * @returns {function} A response handler function that processes the event stream
33
+ */
34
+ export declare const createSuccessErrorEventStreamHandler: <T>({ resolve, reject, successEventType, onError, onCeremonyComplete, }: {
35
+ resolve: (data: T) => void;
36
+ reject: (error: Error) => void;
37
+ successEventType: string;
38
+ onError?: (error: Error) => void;
39
+ onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
40
+ }) => (response: {
41
+ data: {
42
+ getReader: () => {
43
+ read: () => Promise<{
44
+ value: Uint8Array;
45
+ done: boolean;
46
+ }>;
47
+ };
48
+ };
49
+ }) => void;
50
+ //# sourceMappingURL=utils.d.ts.map
@@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AAA;aAAE,CAAC,CAAC;SAC3D,CAAC;KACH,CAAC;CACH,SAwCF,CAAC"}
package/src/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './constants';
2
+ export * from './mpc/index';
3
+ export * from './api/index';
4
+ export * from './types';
5
+ //# 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,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,44 @@
1
+ export declare enum SigningAlgorithm {
2
+ ECDSA = "ECDSA",
3
+ ED25519 = "ED25519",
4
+ BIP340 = "BIP340"
5
+ }
6
+ export declare const BITCOIN_DERIVATION_PATHS: {
7
+ LEGACY: number[];
8
+ NATIVE_SEGWIT: number[];
9
+ SEGWIT: number[];
10
+ };
11
+ export declare const MPC_CHAIN_CONFIG: Record<string, {
12
+ derivationPath: number[];
13
+ signingAlgorithm: SigningAlgorithm;
14
+ }>;
15
+ export declare enum ThresholdSignatureScheme {
16
+ TWO_OF_TWO = "TWO_OF_TWO",
17
+ TWO_OF_THREE = "TWO_OF_THREE",
18
+ THREE_OF_FIVE = "THREE_OF_FIVE"
19
+ }
20
+ export declare const MPC_CONFIG: {
21
+ TWO_OF_TWO: {
22
+ numberOfParties: number;
23
+ threshold: number;
24
+ clientThreshold: number;
25
+ dynamicServerThreshold: number;
26
+ };
27
+ TWO_OF_THREE: {
28
+ numberOfParties: number;
29
+ threshold: number;
30
+ clientThreshold: number;
31
+ dynamicServerThreshold: number;
32
+ };
33
+ THREE_OF_FIVE: {
34
+ numberOfParties: number;
35
+ threshold: number;
36
+ clientThreshold: number;
37
+ dynamicServerThreshold: number;
38
+ };
39
+ };
40
+ export declare enum CreateRoomPartiesOptions {
41
+ THRESHOLD = "threshold",
42
+ FULL = "full"
43
+ }
44
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/mpc/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,wBAAwB;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,MAAM,EACN;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAAE,CA2BjE,CAAC;AAEF,oBAAY,wBAAwB;IAClC,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;CAmBtB,CAAC;AAEF,oBAAY,wBAAwB;IAClC,SAAS,cAAc;IACvB,IAAI,SAAS;CACd"}
@@ -0,0 +1,3 @@
1
+ export * from './constants';
2
+ export * from './utils';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mpc/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { ThresholdSignatureScheme } from './constants';
2
+ export declare const getMPCChainConfig: (chainName: string) => {
3
+ derivationPath: number[];
4
+ signingAlgorithm: import("./constants").SigningAlgorithm;
5
+ };
6
+ export declare const getTSSConfig: (thresholdSignatureScheme: ThresholdSignatureScheme) => {
7
+ threshold: number;
8
+ numberOfParties: number;
9
+ };
10
+ export declare const getClientThreshold: (thresholdSignatureScheme: ThresholdSignatureScheme) => number;
11
+ export declare const getDynamicServerThreshold: (thresholdSignatureScheme: ThresholdSignatureScheme) => number;
12
+ /**
13
+ * Helper function to get the reshare config for client and server shares
14
+ * @param {ThresholdSignatureScheme} oldThresholdSignatureScheme - The current threshold signature scheme
15
+ * @param {ThresholdSignatureScheme} newThresholdSignatureScheme - The target threshold signature scheme
16
+ * @returns {{
17
+ * existingClientShareCount: number,
18
+ * newClientShareCount: number,
19
+ * existingServerShareCount: number,
20
+ * newServerShareCount: number
21
+ * }} The number of existing and new client and server shares needed
22
+ */
23
+ export declare const getReshareConfig: ({ oldThresholdSignatureScheme, newThresholdSignatureScheme, }: {
24
+ oldThresholdSignatureScheme: ThresholdSignatureScheme;
25
+ newThresholdSignatureScheme: ThresholdSignatureScheme;
26
+ }) => {
27
+ existingClientShareCount: number;
28
+ newClientShareCount: number;
29
+ existingServerShareCount: number;
30
+ newServerShareCount: number;
31
+ };
32
+ /**
33
+ * Helper function to get the reshare config for client and server shares
34
+ * @param {ThresholdSignatureScheme} oldThresholdSignatureScheme - The current threshold signature scheme
35
+ * @param {ThresholdSignatureScheme} newThresholdSignatureScheme - The target threshold signature scheme
36
+ * @returns {{
37
+ * existingServerShareCount: number,
38
+ * newServerhareCount: number,
39
+ * existingDynamicServerShareCount: number,
40
+ * newDynamicServerShareCount: number
41
+ * }} The number of existing and new client and server shares needed
42
+ */
43
+ export declare const getServerWalletReshareConfig: ({ oldThresholdSignatureScheme, newThresholdSignatureScheme, }: {
44
+ oldThresholdSignatureScheme: ThresholdSignatureScheme;
45
+ newThresholdSignatureScheme: ThresholdSignatureScheme;
46
+ }) => {
47
+ existingExternalServerShareCount: number;
48
+ newExternalServerShareCount: number;
49
+ existingDynamicServerShareCount: number;
50
+ newDynamicServerShareCount: number;
51
+ };
52
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/mpc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,iBAAiB,cAAe,MAAM;;;CAMlD,CAAC;AAEF,eAAO,MAAM,YAAY,6BACG,wBAAwB;;;CAInD,CAAC;AAEF,eAAO,MAAM,kBAAkB,6BACH,wBAAwB,WAGnD,CAAC;AAEF,eAAO,MAAM,yBAAyB,6BACV,wBAAwB,WAGnD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,kEAG1B;IACD,2BAA2B,EAAE,wBAAwB,CAAC;IACtD,2BAA2B,EAAE,wBAAwB,CAAC;CACvD,KAAG;IACF,wBAAwB,EAAE,MAAM,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wBAAwB,EAAE,MAAM,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;CA6G7B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,kEAGtC;IACD,2BAA2B,EAAE,wBAAwB,CAAC;IACtD,2BAA2B,EAAE,wBAAwB,CAAC;CACvD,KAAG;IACF,gCAAgC,EAAE,MAAM,CAAC;IACzC,2BAA2B,EAAE,MAAM,CAAC;IACpC,+BAA+B,EAAE,MAAM,CAAC;IACxC,0BAA0B,EAAE,MAAM,CAAC;CA6GpC,CAAC"}
package/src/types.d.ts ADDED
@@ -0,0 +1,72 @@
1
+ import { BackupLocation } from './constants';
2
+ import { ThresholdSignatureScheme } from './mpc';
3
+ export type InitKeygenResult = {
4
+ keygenId: string;
5
+ keygenSecret: string;
6
+ };
7
+ export type KeygenResult = {
8
+ pubkey: string;
9
+ secretShare: string;
10
+ };
11
+ export type KeygenCompleteResponse = {
12
+ walletId: string;
13
+ roomId: string;
14
+ serverKeygenIds: string[];
15
+ };
16
+ export type OpenRoomResponse = {
17
+ roomId: string;
18
+ serverKeygenIds: string[];
19
+ };
20
+ export type ReshareResponse = {
21
+ roomId: string;
22
+ serverKeygenIds: string[];
23
+ newServerKeygenIds: string[];
24
+ };
25
+ export declare enum SuccessEventType {
26
+ KeygenComplete = "keygen_complete",
27
+ RoomCreated = "room_created",
28
+ CeremonyComplete = "ceremony_complete"
29
+ }
30
+ export type InitializeResult = {
31
+ error: unknown | null;
32
+ };
33
+ export interface KeyShareBackupInfo {
34
+ passwordEncrypted: boolean;
35
+ backups: Record<BackupLocation, string[]>;
36
+ }
37
+ export interface WaasWalletProperties {
38
+ derivationPath?: string;
39
+ keyShares: KeyShareInfo[];
40
+ thresholdSignatureScheme: ThresholdSignatureScheme;
41
+ }
42
+ export interface KeyShareInfo {
43
+ id: string;
44
+ backupLocation: BackupLocation;
45
+ passwordEncrypted: boolean;
46
+ }
47
+ export interface DynamicWalletClientProps {
48
+ environmentId: string;
49
+ authToken: string;
50
+ baseApiUrl?: string;
51
+ storageKey?: string;
52
+ debug?: boolean;
53
+ baseMPCRelayApiUrl?: string;
54
+ }
55
+ export type BackupData = {
56
+ keyShares: string[];
57
+ metadata: {
58
+ version: string;
59
+ createdAt: string;
60
+ accountAddress: string;
61
+ thresholdSignatureScheme: ThresholdSignatureScheme;
62
+ hasPassword: boolean;
63
+ encryption?: {
64
+ algorithm: string;
65
+ keyDerivation: string;
66
+ iterations: number;
67
+ hashAlgorithm: string;
68
+ };
69
+ shareCount: number;
70
+ };
71
+ };
72
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../packages/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B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