@dynamic-labs-wallet/node 0.0.323 → 0.0.324
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 +16 -7
- package/index.esm.js +16 -7
- package/package.json +2 -2
- package/src/backup/encryption.d.ts +62 -0
- package/src/backup/encryption.d.ts.map +1 -0
- package/src/backup/utils.d.ts +4 -0
- package/src/backup/utils.d.ts.map +1 -0
- package/src/client.d.ts +353 -0
- package/src/client.d.ts.map +1 -0
- package/src/constants.d.ts +2 -0
- package/src/constants.d.ts.map +1 -0
- package/src/core/createCore.d.ts +43 -0
- package/src/core/createCore.d.ts.map +1 -0
- package/src/core/types.d.ts +7 -0
- package/src/core/types.d.ts.map +1 -0
- package/src/delegatedClient/createDelegatedClient.d.ts +23 -0
- package/src/delegatedClient/createDelegatedClient.d.ts.map +1 -0
- package/src/delegatedClient/index.d.ts +7 -0
- package/src/delegatedClient/index.d.ts.map +1 -0
- package/src/delegatedClient/modules/decryptWebhookData.d.ts +18 -0
- package/src/delegatedClient/modules/decryptWebhookData.d.ts.map +1 -0
- package/src/delegatedClient/modules/revokeDelegation.d.ts +3 -0
- package/src/delegatedClient/modules/revokeDelegation.d.ts.map +1 -0
- package/src/delegatedClient/modules/sign.d.ts +31 -0
- package/src/delegatedClient/modules/sign.d.ts.map +1 -0
- package/src/index.d.ts +13 -0
- package/src/index.d.ts.map +1 -0
- package/src/mpc/index.d.ts +3 -0
- package/src/mpc/index.d.ts.map +1 -0
- package/src/mpc/mpc.d.ts +12 -0
- package/src/mpc/mpc.d.ts.map +1 -0
- package/src/mpc/types.d.ts +5 -0
- package/src/mpc/types.d.ts.map +1 -0
- package/src/types.d.ts +41 -0
- package/src/types.d.ts.map +1 -0
- package/src/utils.d.ts +49 -0
- package/src/utils.d.ts.map +1 -0
package/index.cjs.js
CHANGED
|
@@ -588,8 +588,8 @@ class DynamicWalletClient {
|
|
|
588
588
|
externalServerKeyShares: externalServerKeygenResults
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
async dynamicServerSign({ walletId, message, isFormatted, context, bitcoinConfig, onError }) {
|
|
592
|
-
const dynamicRequestId = uuid.v4();
|
|
591
|
+
async dynamicServerSign({ walletId, message, isFormatted, context, bitcoinConfig, onError, dynamicRequestId: providedRequestId }) {
|
|
592
|
+
const dynamicRequestId = providedRequestId || uuid.v4();
|
|
593
593
|
this.ensureApiClientAuthenticated();
|
|
594
594
|
// Create the room and sign the message
|
|
595
595
|
if (typeof message !== 'string') {
|
|
@@ -605,7 +605,9 @@ class DynamicWalletClient {
|
|
|
605
605
|
forwardMPCClientEnabled: this.forwardMPCEnabled,
|
|
606
606
|
bitcoinConfig
|
|
607
607
|
});
|
|
608
|
-
return data
|
|
608
|
+
return _extends({}, data, {
|
|
609
|
+
dynamicRequestId
|
|
610
|
+
});
|
|
609
611
|
}
|
|
610
612
|
async externalServerSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted, bitcoinConfig }) {
|
|
611
613
|
try {
|
|
@@ -623,7 +625,7 @@ class DynamicWalletClient {
|
|
|
623
625
|
throw error;
|
|
624
626
|
}
|
|
625
627
|
}
|
|
626
|
-
async forwardMPCClientSign({ chainName, message, roomId, keyShare, derivationPath, formattedMessage, dynamicRequestId, isFormatted }) {
|
|
628
|
+
async forwardMPCClientSign({ chainName, message, roomId, keyShare, derivationPath, formattedMessage, dynamicRequestId, isFormatted, walletId }) {
|
|
627
629
|
try {
|
|
628
630
|
const messageForForwardMPC = core$1.serializeMessageForForwardMPC({
|
|
629
631
|
message,
|
|
@@ -640,7 +642,12 @@ class DynamicWalletClient {
|
|
|
640
642
|
signingAlgo: chainName === 'EVM' ? 'ECDSA' : 'ED25519',
|
|
641
643
|
hashAlgo: chainName === 'EVM' && !isFormatted ? 'keccak256' : undefined,
|
|
642
644
|
derivationPath: derivationPath,
|
|
643
|
-
roomUuid: roomId
|
|
645
|
+
roomUuid: roomId,
|
|
646
|
+
walletId,
|
|
647
|
+
environmentId: this.environmentId,
|
|
648
|
+
traceContext: {
|
|
649
|
+
traceId: dynamicRequestId
|
|
650
|
+
}
|
|
644
651
|
});
|
|
645
652
|
if (!(signatureBytes instanceof Uint8Array)) {
|
|
646
653
|
throw new TypeError(`Invalid signature format: expected Uint8Array, got ${typeof signatureBytes}`);
|
|
@@ -655,6 +662,7 @@ class DynamicWalletClient {
|
|
|
655
662
|
} catch (error) {
|
|
656
663
|
this.logger.error('Error signing message with forward MPC client', {
|
|
657
664
|
error,
|
|
665
|
+
walletId,
|
|
658
666
|
environmentId: this.environmentId,
|
|
659
667
|
dynamicRequestId
|
|
660
668
|
});
|
|
@@ -706,8 +714,9 @@ class DynamicWalletClient {
|
|
|
706
714
|
keyShare: externalServerKeyShares[0],
|
|
707
715
|
derivationPath,
|
|
708
716
|
formattedMessage,
|
|
709
|
-
dynamicRequestId:
|
|
710
|
-
isFormatted
|
|
717
|
+
dynamicRequestId: data.dynamicRequestId,
|
|
718
|
+
isFormatted,
|
|
719
|
+
walletId: wallet.walletId
|
|
711
720
|
});
|
|
712
721
|
return signature;
|
|
713
722
|
} else {
|
package/index.esm.js
CHANGED
|
@@ -587,8 +587,8 @@ class DynamicWalletClient {
|
|
|
587
587
|
externalServerKeyShares: externalServerKeygenResults
|
|
588
588
|
};
|
|
589
589
|
}
|
|
590
|
-
async dynamicServerSign({ walletId, message, isFormatted, context, bitcoinConfig, onError }) {
|
|
591
|
-
const dynamicRequestId = v4();
|
|
590
|
+
async dynamicServerSign({ walletId, message, isFormatted, context, bitcoinConfig, onError, dynamicRequestId: providedRequestId }) {
|
|
591
|
+
const dynamicRequestId = providedRequestId || v4();
|
|
592
592
|
this.ensureApiClientAuthenticated();
|
|
593
593
|
// Create the room and sign the message
|
|
594
594
|
if (typeof message !== 'string') {
|
|
@@ -604,7 +604,9 @@ class DynamicWalletClient {
|
|
|
604
604
|
forwardMPCClientEnabled: this.forwardMPCEnabled,
|
|
605
605
|
bitcoinConfig
|
|
606
606
|
});
|
|
607
|
-
return data
|
|
607
|
+
return _extends({}, data, {
|
|
608
|
+
dynamicRequestId
|
|
609
|
+
});
|
|
608
610
|
}
|
|
609
611
|
async externalServerSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted, bitcoinConfig }) {
|
|
610
612
|
try {
|
|
@@ -622,7 +624,7 @@ class DynamicWalletClient {
|
|
|
622
624
|
throw error;
|
|
623
625
|
}
|
|
624
626
|
}
|
|
625
|
-
async forwardMPCClientSign({ chainName, message, roomId, keyShare, derivationPath, formattedMessage, dynamicRequestId, isFormatted }) {
|
|
627
|
+
async forwardMPCClientSign({ chainName, message, roomId, keyShare, derivationPath, formattedMessage, dynamicRequestId, isFormatted, walletId }) {
|
|
626
628
|
try {
|
|
627
629
|
const messageForForwardMPC = serializeMessageForForwardMPC({
|
|
628
630
|
message,
|
|
@@ -639,7 +641,12 @@ class DynamicWalletClient {
|
|
|
639
641
|
signingAlgo: chainName === 'EVM' ? 'ECDSA' : 'ED25519',
|
|
640
642
|
hashAlgo: chainName === 'EVM' && !isFormatted ? 'keccak256' : undefined,
|
|
641
643
|
derivationPath: derivationPath,
|
|
642
|
-
roomUuid: roomId
|
|
644
|
+
roomUuid: roomId,
|
|
645
|
+
walletId,
|
|
646
|
+
environmentId: this.environmentId,
|
|
647
|
+
traceContext: {
|
|
648
|
+
traceId: dynamicRequestId
|
|
649
|
+
}
|
|
643
650
|
});
|
|
644
651
|
if (!(signatureBytes instanceof Uint8Array)) {
|
|
645
652
|
throw new TypeError(`Invalid signature format: expected Uint8Array, got ${typeof signatureBytes}`);
|
|
@@ -654,6 +661,7 @@ class DynamicWalletClient {
|
|
|
654
661
|
} catch (error) {
|
|
655
662
|
this.logger.error('Error signing message with forward MPC client', {
|
|
656
663
|
error,
|
|
664
|
+
walletId,
|
|
657
665
|
environmentId: this.environmentId,
|
|
658
666
|
dynamicRequestId
|
|
659
667
|
});
|
|
@@ -705,8 +713,9 @@ class DynamicWalletClient {
|
|
|
705
713
|
keyShare: externalServerKeyShares[0],
|
|
706
714
|
derivationPath,
|
|
707
715
|
formattedMessage,
|
|
708
|
-
dynamicRequestId:
|
|
709
|
-
isFormatted
|
|
716
|
+
dynamicRequestId: data.dynamicRequestId,
|
|
717
|
+
isFormatted,
|
|
718
|
+
walletId: wallet.walletId
|
|
710
719
|
});
|
|
711
720
|
return signature;
|
|
712
721
|
} else {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.324",
|
|
4
4
|
"license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/core": "0.0.
|
|
7
|
+
"@dynamic-labs-wallet/core": "0.0.324",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "0.5.5",
|
|
9
9
|
"@dynamic-labs/logger": "^4.45.2",
|
|
10
10
|
"@dynamic-labs/sdk-api-core": "^0.0.900",
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { EncryptionMetadata } from '@dynamic-labs-wallet/core';
|
|
2
|
+
export declare const ENCRYPTION_VERSION_LEGACY = "v1";
|
|
3
|
+
export declare const ENCRYPTION_VERSION_CURRENT = "v2";
|
|
4
|
+
export declare const PBKDF2_ALGORITHM = "PBKDF2";
|
|
5
|
+
export declare const PBKDF2_HASH_ALGORITHM = "SHA-256";
|
|
6
|
+
export declare const AES_GCM_ALGORITHM = "AES-GCM";
|
|
7
|
+
export declare const AES_GCM_LENGTH = 256;
|
|
8
|
+
export declare const ENCRYPTION_VERSIONS: {
|
|
9
|
+
readonly v1: {
|
|
10
|
+
readonly version: "v1";
|
|
11
|
+
readonly algorithm: "AES-GCM";
|
|
12
|
+
readonly keyDerivation: "PBKDF2";
|
|
13
|
+
readonly iterations: 100000;
|
|
14
|
+
readonly hashAlgorithm: "SHA-256";
|
|
15
|
+
readonly algorithmLength: 256;
|
|
16
|
+
};
|
|
17
|
+
readonly v2: {
|
|
18
|
+
readonly version: "v2";
|
|
19
|
+
readonly algorithm: "AES-GCM";
|
|
20
|
+
readonly keyDerivation: "PBKDF2";
|
|
21
|
+
readonly iterations: 1000000;
|
|
22
|
+
readonly hashAlgorithm: "SHA-256";
|
|
23
|
+
readonly algorithmLength: 256;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const PBKDF2_ITERATIONS: 1000000;
|
|
27
|
+
export declare const PBKDF2_ITERATIONS_LEGACY: 100000;
|
|
28
|
+
export type EncryptionVersion = (typeof ENCRYPTION_VERSIONS)[keyof typeof ENCRYPTION_VERSIONS];
|
|
29
|
+
/**
|
|
30
|
+
* Encrypts data using the specified encryption version.
|
|
31
|
+
* Always uses the latest encryption configuration for new encryptions by default.
|
|
32
|
+
*/
|
|
33
|
+
export declare const encryptData: ({ data, password, version, }: {
|
|
34
|
+
data: string;
|
|
35
|
+
password: string;
|
|
36
|
+
version?: string;
|
|
37
|
+
}) => Promise<{
|
|
38
|
+
salt: string;
|
|
39
|
+
iv: string;
|
|
40
|
+
cipher: string;
|
|
41
|
+
version: string;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Decrypts data with version-based configuration.
|
|
45
|
+
* Uses the version field from the data to determine encryption parameters.
|
|
46
|
+
* Falls back to legacy version for backward compatibility if no version is specified.
|
|
47
|
+
*/
|
|
48
|
+
export declare const decryptData: ({ data, password, }: {
|
|
49
|
+
data: {
|
|
50
|
+
salt: string;
|
|
51
|
+
iv: string;
|
|
52
|
+
cipher: string;
|
|
53
|
+
version?: string;
|
|
54
|
+
};
|
|
55
|
+
password: string;
|
|
56
|
+
}) => Promise<string>;
|
|
57
|
+
/**
|
|
58
|
+
* Gets encryption metadata for a specific version.
|
|
59
|
+
* Used when we need to include metadata in legacy systems or APIs that require it.
|
|
60
|
+
*/
|
|
61
|
+
export declare const getEncryptionMetadataForVersion: (version: string) => EncryptionMetadata;
|
|
62
|
+
//# sourceMappingURL=encryption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/backup/encryption.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;CAiBtB,CAAC;AAEX,eAAO,MAAM,iBAAiB,SAA6D,CAAC;AAC5F,eAAO,MAAM,wBAAwB,QAA4D,CAAC;AAElG,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAgC/F;;;GAGG;AACH,eAAO,MAAM,WAAW,iCAIrB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;;;;;EA6BA,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrE,QAAQ,EAAE,MAAM,CAAC;CAClB,oBAmCA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,YAAa,MAAM,KAAG,kBAajE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ServerKeyShare } from '../mpc/types.js';
|
|
2
|
+
import type { WalletProperties } from '../types.js';
|
|
3
|
+
export declare const checkIfExternalServerKeySharesAreRequired: (wallet: WalletProperties, externalServerKeyShares?: ServerKeyShare[]) => void;
|
|
4
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/backup/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,eAAO,MAAM,yCAAyC,WAC5C,gBAAgB,4BACE,cAAc,EAAE,SAW3C,CAAC"}
|
package/src/client.d.ts
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { BIP340KeygenResult, EcdsaKeygenResult, EcdsaSignature, MessageHash, type EcdsaPublicKey } from '#internal/node';
|
|
2
|
+
import { BackupLocation, DynamicApiClient, ThresholdSignatureScheme, type ILogger, WalletOperation, type BitcoinConfig, type KeyShareBackupInfo, type RequestWithElevatedAccessToken } from '@dynamic-labs-wallet/core';
|
|
3
|
+
import { ForwardMPCClientV2 } from '@dynamic-labs-wallet/forward-mpc-client';
|
|
4
|
+
import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
|
|
5
|
+
import type { ServerKeyShare } from './mpc/index.js';
|
|
6
|
+
import type { ServerInitKeygenResult } from './mpc/types.js';
|
|
7
|
+
import type { DynamicWalletClientProps, WalletProperties } from './types.js';
|
|
8
|
+
export declare class DynamicWalletClient {
|
|
9
|
+
environmentId: string;
|
|
10
|
+
debug: boolean;
|
|
11
|
+
protected logger: ILogger;
|
|
12
|
+
protected apiClient: DynamicApiClient;
|
|
13
|
+
protected walletMap: Record<string, WalletProperties>;
|
|
14
|
+
protected baseMPCRelayApiUrl?: string;
|
|
15
|
+
protected baseJWTAuthToken?: string;
|
|
16
|
+
protected baseApiUrl?: string;
|
|
17
|
+
protected isApiClientAuthenticated: boolean;
|
|
18
|
+
protected forwardMPCEnabled: boolean;
|
|
19
|
+
protected resolvedForwardMPCClient: ForwardMPCClientV2 | undefined;
|
|
20
|
+
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator, logger, }: DynamicWalletClientProps);
|
|
21
|
+
private ensureApiClientAuthenticated;
|
|
22
|
+
authenticateApiToken(authToken: string): Promise<void>;
|
|
23
|
+
dynamicServerInitializeKeyGen({ chainName, externalServerKeygenIds, thresholdSignatureScheme, dynamicRequestId, skipLock, bitcoinConfig, onError, onCeremonyComplete, }: {
|
|
24
|
+
chainName: string;
|
|
25
|
+
externalServerKeygenIds: string[];
|
|
26
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
27
|
+
dynamicRequestId: string;
|
|
28
|
+
skipLock?: boolean;
|
|
29
|
+
bitcoinConfig?: BitcoinConfig;
|
|
30
|
+
onError?: (error: Error) => void;
|
|
31
|
+
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
32
|
+
}): Promise<import("@dynamic-labs-wallet/core").KeygenCompleteResponse>;
|
|
33
|
+
externalServerInitializeKeyGen({ chainName, thresholdSignatureScheme, bitcoinConfig, }: {
|
|
34
|
+
chainName: string;
|
|
35
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
36
|
+
bitcoinConfig?: BitcoinConfig;
|
|
37
|
+
}): Promise<ServerInitKeygenResult[]>;
|
|
38
|
+
derivePublicKey({ chainName, keyShare, derivationPath, bitcoinConfig, }: {
|
|
39
|
+
chainName: string;
|
|
40
|
+
keyShare: ServerKeyShare;
|
|
41
|
+
derivationPath: Uint32Array | undefined;
|
|
42
|
+
bitcoinConfig?: BitcoinConfig;
|
|
43
|
+
}): Promise<string | EcdsaPublicKey | Uint8Array | undefined>;
|
|
44
|
+
forwardMPCExternalServerKeyGen({ chainName, roomId, dynamicServerKeygenIds, externalServerInitKeygenResults, thresholdSignatureScheme, bitcoinConfig, }: {
|
|
45
|
+
chainName: string;
|
|
46
|
+
roomId: string;
|
|
47
|
+
dynamicServerKeygenIds: string[];
|
|
48
|
+
externalServerInitKeygenResults: ServerInitKeygenResult[];
|
|
49
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
50
|
+
bitcoinConfig?: BitcoinConfig;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
53
|
+
externalServerKeyGenResults: ServerKeyShare[];
|
|
54
|
+
}>;
|
|
55
|
+
externalServerKeyGen({ chainName, roomId, dynamicServerKeygenIds, externalServerInitKeygenResults, thresholdSignatureScheme, bitcoinConfig, }: {
|
|
56
|
+
chainName: string;
|
|
57
|
+
roomId: string;
|
|
58
|
+
dynamicServerKeygenIds: string[];
|
|
59
|
+
externalServerInitKeygenResults: ServerInitKeygenResult[];
|
|
60
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
61
|
+
bitcoinConfig?: BitcoinConfig;
|
|
62
|
+
}): Promise<{
|
|
63
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
64
|
+
externalServerKeyGenResults: ServerKeyShare[];
|
|
65
|
+
}>;
|
|
66
|
+
keyGen({ chainName, thresholdSignatureScheme, skipLock, bitcoinConfig, onError, onCeremonyComplete, }: {
|
|
67
|
+
chainName: string;
|
|
68
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
69
|
+
skipLock?: boolean;
|
|
70
|
+
bitcoinConfig?: BitcoinConfig;
|
|
71
|
+
onError?: (error: Error) => void;
|
|
72
|
+
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
75
|
+
externalServerKeyShares: ServerKeyShare[];
|
|
76
|
+
}>;
|
|
77
|
+
importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, bitcoinConfig, onError, onCeremonyComplete, }: {
|
|
78
|
+
chainName: string;
|
|
79
|
+
privateKey: string;
|
|
80
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
81
|
+
bitcoinConfig?: BitcoinConfig;
|
|
82
|
+
onError?: (error: Error) => void;
|
|
83
|
+
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
84
|
+
}): Promise<{
|
|
85
|
+
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
86
|
+
externalServerKeyShares: ServerKeyShare[];
|
|
87
|
+
}>;
|
|
88
|
+
dynamicServerSign({ walletId, message, isFormatted, context, bitcoinConfig, onError, dynamicRequestId: providedRequestId, }: {
|
|
89
|
+
walletId: string;
|
|
90
|
+
message: string | Uint8Array;
|
|
91
|
+
isFormatted?: boolean;
|
|
92
|
+
context?: SignMessageContext;
|
|
93
|
+
bitcoinConfig?: BitcoinConfig;
|
|
94
|
+
onError?: (error: Error) => void;
|
|
95
|
+
dynamicRequestId?: string;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
dynamicRequestId: string;
|
|
98
|
+
roomId: string;
|
|
99
|
+
serverKeygenIds: string[];
|
|
100
|
+
}>;
|
|
101
|
+
externalServerSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted, bitcoinConfig, }: {
|
|
102
|
+
chainName: string;
|
|
103
|
+
message: string | Uint8Array;
|
|
104
|
+
roomId: string;
|
|
105
|
+
keyShare: ServerKeyShare;
|
|
106
|
+
derivationPath: Uint32Array | undefined;
|
|
107
|
+
isFormatted?: boolean;
|
|
108
|
+
bitcoinConfig?: BitcoinConfig;
|
|
109
|
+
}): Promise<Uint8Array | EcdsaSignature>;
|
|
110
|
+
forwardMPCClientSign({ chainName, message, roomId, keyShare, derivationPath, formattedMessage, dynamicRequestId, isFormatted, walletId, }: {
|
|
111
|
+
chainName: string;
|
|
112
|
+
message: string | Uint8Array;
|
|
113
|
+
roomId: string;
|
|
114
|
+
keyShare: ServerKeyShare;
|
|
115
|
+
derivationPath: Uint32Array | undefined;
|
|
116
|
+
formattedMessage: string | Uint8Array | MessageHash;
|
|
117
|
+
dynamicRequestId: string;
|
|
118
|
+
isFormatted?: boolean;
|
|
119
|
+
walletId?: string;
|
|
120
|
+
}): Promise<Uint8Array | EcdsaSignature>;
|
|
121
|
+
sign({ accountAddress, externalServerKeyShares, message, chainName, password, isFormatted, context, onError, bitcoinConfig, }: {
|
|
122
|
+
accountAddress: string;
|
|
123
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
124
|
+
message: string | Uint8Array;
|
|
125
|
+
chainName: string;
|
|
126
|
+
password?: string;
|
|
127
|
+
isFormatted?: boolean;
|
|
128
|
+
context?: SignMessageContext;
|
|
129
|
+
bitcoinConfig?: BitcoinConfig;
|
|
130
|
+
onError?: (error: Error) => void;
|
|
131
|
+
}): Promise<Uint8Array | EcdsaSignature>;
|
|
132
|
+
refreshWalletAccountShares({ accountAddress, chainName, password, externalServerKeyShares, backUpToClientShareService, }: {
|
|
133
|
+
accountAddress: string;
|
|
134
|
+
chainName: string;
|
|
135
|
+
password?: string;
|
|
136
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
137
|
+
backUpToClientShareService?: boolean;
|
|
138
|
+
}): Promise<(EcdsaKeygenResult | BIP340KeygenResult)[]>;
|
|
139
|
+
getExportId({ chainName, serverKeyShare, bitcoinConfig, }: {
|
|
140
|
+
chainName: string;
|
|
141
|
+
serverKeyShare: ServerKeyShare;
|
|
142
|
+
bitcoinConfig?: BitcoinConfig;
|
|
143
|
+
}): Promise<string>;
|
|
144
|
+
/**
|
|
145
|
+
* Helper function to create client shares required to complete a reshare ceremony.
|
|
146
|
+
* @param {string} chainName - The chain to create shares for
|
|
147
|
+
* @param {WalletProperties} wallet - The wallet to reshare
|
|
148
|
+
* @param {ThresholdSignatureScheme} oldThresholdSignatureScheme - The current threshold signature scheme
|
|
149
|
+
* @param {ThresholdSignatureScheme} newThresholdSignatureScheme - The target threshold signature scheme
|
|
150
|
+
* @returns {Promise<{
|
|
151
|
+
* newClientInitKeygenResults: ClientInitKeygenResult[],
|
|
152
|
+
* newClientKeygenIds: string[],
|
|
153
|
+
* existingClientKeygenIds: string[],
|
|
154
|
+
* existingClientKeyShares: ClientKeyShare[]
|
|
155
|
+
* }>} Object containing new and existing client keygen results, IDs and shares
|
|
156
|
+
* @todo Support higher to lower reshare strategies
|
|
157
|
+
*/
|
|
158
|
+
reshareStrategy({ chainName, wallet, oldThresholdSignatureScheme, newThresholdSignatureScheme, }: {
|
|
159
|
+
chainName: string;
|
|
160
|
+
wallet: WalletProperties;
|
|
161
|
+
oldThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
162
|
+
newThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
163
|
+
}): Promise<{
|
|
164
|
+
newExternalServerInitKeygenResults: ServerInitKeygenResult[];
|
|
165
|
+
newExternalServerKeygenIds: string[];
|
|
166
|
+
existingExternalServerKeygenIds: string[];
|
|
167
|
+
existingExternalServerKeyShares: ServerKeyShare[];
|
|
168
|
+
}>;
|
|
169
|
+
reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password, externalServerKeyShares, backUpToClientShareService, }: {
|
|
170
|
+
chainName: string;
|
|
171
|
+
accountAddress: string;
|
|
172
|
+
oldThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
173
|
+
newThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
174
|
+
password?: string;
|
|
175
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
176
|
+
backUpToClientShareService?: boolean;
|
|
177
|
+
}): Promise<(EcdsaKeygenResult | BIP340KeygenResult)[]>;
|
|
178
|
+
exportKey({ accountAddress, chainName, password, externalServerKeyShares, bitcoinConfig, elevatedAccessToken, }: RequestWithElevatedAccessToken<{
|
|
179
|
+
accountAddress: string;
|
|
180
|
+
chainName: string;
|
|
181
|
+
password?: string;
|
|
182
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
183
|
+
bitcoinConfig?: BitcoinConfig;
|
|
184
|
+
}>): Promise<{
|
|
185
|
+
derivedPrivateKey: string | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
offlineExportKey({ chainName, keyShares, derivationPath, }: {
|
|
188
|
+
chainName: string;
|
|
189
|
+
keyShares: ServerKeyShare[];
|
|
190
|
+
derivationPath?: string;
|
|
191
|
+
}): Promise<{
|
|
192
|
+
derivedPrivateKey: string | undefined;
|
|
193
|
+
}>;
|
|
194
|
+
encryptKeyShare({ keyShare, password }: {
|
|
195
|
+
keyShare: ServerKeyShare;
|
|
196
|
+
password?: string;
|
|
197
|
+
}): Promise<string>;
|
|
198
|
+
ensureCeremonyCompletionBeforeBackup({ accountAddress }: {
|
|
199
|
+
accountAddress: string;
|
|
200
|
+
}): Promise<void>;
|
|
201
|
+
storeEncryptedBackupByWallet({ accountAddress, externalServerKeyShares, password, backUpToClientShareService, }: {
|
|
202
|
+
accountAddress: string;
|
|
203
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
204
|
+
password?: string;
|
|
205
|
+
backUpToClientShareService: boolean;
|
|
206
|
+
}): Promise<{
|
|
207
|
+
share: ServerKeyShare;
|
|
208
|
+
backedUpToClientKeyShareService: boolean;
|
|
209
|
+
}[]>;
|
|
210
|
+
storeEncryptedBackupByWalletWithRetry({ accountAddress, externalServerKeyShares, password, backUpToClientShareService, }: {
|
|
211
|
+
accountAddress: string;
|
|
212
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
213
|
+
password?: string;
|
|
214
|
+
backUpToClientShareService: boolean;
|
|
215
|
+
}): Promise<Array<{
|
|
216
|
+
share: ServerKeyShare;
|
|
217
|
+
backedUpToClientKeyShareService: boolean;
|
|
218
|
+
}>>;
|
|
219
|
+
getExternalServerKeyShares({ accountAddress, password }: {
|
|
220
|
+
accountAddress: string;
|
|
221
|
+
password?: string;
|
|
222
|
+
}): Promise<any[]>;
|
|
223
|
+
updatePassword({ accountAddress, existingPassword, newPassword, backUpToClientShareService, }: {
|
|
224
|
+
accountAddress: string;
|
|
225
|
+
existingPassword?: string;
|
|
226
|
+
newPassword?: string;
|
|
227
|
+
backUpToClientShareService: boolean;
|
|
228
|
+
}): Promise<void>;
|
|
229
|
+
decryptKeyShare({ keyShare, password }: {
|
|
230
|
+
keyShare: string;
|
|
231
|
+
password?: string;
|
|
232
|
+
}): Promise<ServerKeyShare>;
|
|
233
|
+
/**
|
|
234
|
+
* Helper function to determine keyshare recovery strategy for dynamic shares.
|
|
235
|
+
* For REFRESH operations, retrieves enough shares to meet the client threshold.
|
|
236
|
+
* For all other operations, retrieves just 1 share.
|
|
237
|
+
*
|
|
238
|
+
* @param clientKeyShareBackupInfo - Information about backed up key shares
|
|
239
|
+
* @param thresholdSignatureScheme - The signature scheme being used (2-of-2, 2-of-3, etc)
|
|
240
|
+
* @param walletOperation - The operation being performed (REFRESH, SIGN_MESSAGE, etc)
|
|
241
|
+
* @param shareCount - The number of shares to recover if specified for reshare operations
|
|
242
|
+
* @returns @shares: Object mapping backup locations to arrays of share IDs to recover
|
|
243
|
+
* @returns @requiredShareCount: The number of shares required to recover
|
|
244
|
+
*/
|
|
245
|
+
recoverStrategy({ externalServerKeySharesBackupInfo, thresholdSignatureScheme, walletOperation, shareCount, }: {
|
|
246
|
+
externalServerKeySharesBackupInfo: KeyShareBackupInfo;
|
|
247
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
248
|
+
walletOperation: WalletOperation;
|
|
249
|
+
shareCount?: number;
|
|
250
|
+
}): {
|
|
251
|
+
shares: Partial<Record<BackupLocation, string[]>>;
|
|
252
|
+
requiredShareCount: number;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Attempts to recover key shares from backup if they are not provided.
|
|
256
|
+
* The recovered shares will be stored in the wallet map for use in signing operations.
|
|
257
|
+
* @param accountAddress - The account address to recover shares for
|
|
258
|
+
* @param password - The password to decrypt the shares
|
|
259
|
+
* @param walletOperation - The wallet operation being performed
|
|
260
|
+
* @param externalServerKeyShares - The provided key shares (if any)
|
|
261
|
+
* @param errorMessage - The error message to throw if recovery fails
|
|
262
|
+
* @throws Error if recovery is needed but fails
|
|
263
|
+
*/
|
|
264
|
+
protected ensureKeySharesRecovered({ accountAddress, password, walletOperation, externalServerKeyShares, errorMessage, }: {
|
|
265
|
+
accountAddress: string;
|
|
266
|
+
password?: string;
|
|
267
|
+
walletOperation: WalletOperation;
|
|
268
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
269
|
+
errorMessage: string;
|
|
270
|
+
}): Promise<void>;
|
|
271
|
+
recoverEncryptedBackupByWallet({ accountAddress, password, walletOperation, shareCount, storeRecoveredShares, }: {
|
|
272
|
+
accountAddress: string;
|
|
273
|
+
password?: string;
|
|
274
|
+
walletOperation: WalletOperation;
|
|
275
|
+
shareCount?: number;
|
|
276
|
+
storeRecoveredShares?: boolean;
|
|
277
|
+
}): Promise<any[]>;
|
|
278
|
+
exportExternalServerKeyShares({ accountAddress, password }: {
|
|
279
|
+
accountAddress: string;
|
|
280
|
+
password?: string;
|
|
281
|
+
}): Promise<any[]>;
|
|
282
|
+
/**
|
|
283
|
+
* Helper function to check if the required wallet fields are present and valid
|
|
284
|
+
* @param accountAddress - The account address of the wallet to check
|
|
285
|
+
* @param walletOperation - The wallet operation that determines required fields
|
|
286
|
+
* @returns boolean indicating if wallet needs to be re-fetched and restored from server
|
|
287
|
+
*/
|
|
288
|
+
private checkWalletFields;
|
|
289
|
+
/**
|
|
290
|
+
* verifyPassword attempts to recover and decrypt a single client key share using the provided password.
|
|
291
|
+
* If successful, the key share is encrypted with the new password. This method solely performs the recovery
|
|
292
|
+
* and decryption without storing the restored key shares. If unsuccessful, it throws an error.
|
|
293
|
+
*/
|
|
294
|
+
verifyPassword({ accountAddress, password }: {
|
|
295
|
+
accountAddress: string;
|
|
296
|
+
password?: string;
|
|
297
|
+
}): Promise<void>;
|
|
298
|
+
isPasswordEncrypted({ accountAddress }: {
|
|
299
|
+
accountAddress: string;
|
|
300
|
+
}): Promise<boolean>;
|
|
301
|
+
/**
|
|
302
|
+
* check if the operation requires a password
|
|
303
|
+
*/
|
|
304
|
+
requiresPasswordForOperation({ accountAddress, walletOperation, }: {
|
|
305
|
+
accountAddress: string;
|
|
306
|
+
walletOperation?: WalletOperation;
|
|
307
|
+
}): Promise<boolean>;
|
|
308
|
+
/**
|
|
309
|
+
* check if the operation requires restoring backup shares
|
|
310
|
+
*/
|
|
311
|
+
requiresRestoreBackupSharesForOperation({ accountAddress, walletOperation, }: {
|
|
312
|
+
accountAddress: string;
|
|
313
|
+
walletOperation?: WalletOperation;
|
|
314
|
+
}): Promise<boolean>;
|
|
315
|
+
getWalletExternalServerKeyShareBackupInfo({ accountAddress, }: {
|
|
316
|
+
accountAddress: string;
|
|
317
|
+
}): Promise<KeyShareBackupInfo>;
|
|
318
|
+
getWallet({ accountAddress, walletOperation, shareCount, password, }: {
|
|
319
|
+
accountAddress: string;
|
|
320
|
+
walletOperation?: WalletOperation;
|
|
321
|
+
shareCount?: number;
|
|
322
|
+
password?: string;
|
|
323
|
+
}): Promise<WalletProperties>;
|
|
324
|
+
/**
|
|
325
|
+
* Get a single wallet by address
|
|
326
|
+
* First tries the efficient getWaasWalletByAddress endpoint, falls back to getUser() if not available
|
|
327
|
+
*/
|
|
328
|
+
getWalletByAddress(accountAddress: string): Promise<WalletProperties | null>;
|
|
329
|
+
/**
|
|
330
|
+
* Get all wallets (kept for backward compatibility but now uses lazy loading)
|
|
331
|
+
* @deprecated Consider using getWalletByAddress for better performance with large wallet counts
|
|
332
|
+
*/
|
|
333
|
+
getWallets(): Promise<WalletProperties[]>;
|
|
334
|
+
/**
|
|
335
|
+
* Helper method to initialize or update a wallet entry in the walletMap.
|
|
336
|
+
* This provides a consistent way to set up wallet properties across different operations.
|
|
337
|
+
* @param accountAddress - The account address for the wallet
|
|
338
|
+
* @param walletId - The wallet ID
|
|
339
|
+
* @param chainName - The chain name (e.g., 'BTC', 'EVM')
|
|
340
|
+
* @param thresholdSignatureScheme - The threshold signature scheme
|
|
341
|
+
* @param derivationPath - Optional derivation path for the wallet
|
|
342
|
+
* @param additionalProps - Optional additional properties to merge into the wallet entry
|
|
343
|
+
*/
|
|
344
|
+
protected initializeWalletMapEntry({ accountAddress, walletId, chainName, thresholdSignatureScheme, derivationPath, additionalProps, }: {
|
|
345
|
+
accountAddress: string;
|
|
346
|
+
walletId: string;
|
|
347
|
+
chainName: string;
|
|
348
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
349
|
+
derivationPath?: string;
|
|
350
|
+
additionalProps?: Record<string, unknown>;
|
|
351
|
+
}): void;
|
|
352
|
+
}
|
|
353
|
+
//# 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,EAEL,kBAAkB,EAElB,iBAAiB,EACjB,cAAc,EAGd,WAAW,EACX,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,cAAc,EAGd,gBAAgB,EAIhB,wBAAwB,EACxB,KAAK,OAAO,EAEZ,eAAe,EAUf,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,8BAA8B,EAEpC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,EAAyB,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAG5F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG7E,qBAAa,mBAAmB;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,C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Ac,CAAC,EAAE,MAAM,CAAC;QACxB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC3C,GAAG,IAAI;CAqBT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../packages/src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,SAAS,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DynamicApiClient, type ILogger } from '@dynamic-labs-wallet/core';
|
|
2
|
+
export type CoreConfig = {
|
|
3
|
+
environmentId: string;
|
|
4
|
+
baseApiUrl?: string;
|
|
5
|
+
baseMPCRelayApiUrl?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Enables verbose debug-level logging when `true`.
|
|
8
|
+
*
|
|
9
|
+
* Only applies to the built-in default logger. If you provide a custom
|
|
10
|
+
* `logger`, configure its verbosity directly — this flag has no effect on it.
|
|
11
|
+
*
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Custom logger for SDK diagnostic output.
|
|
17
|
+
*
|
|
18
|
+
* Accepts any object that implements `ILogger` (`debug`, `info`, `warn`, `error`).
|
|
19
|
+
* When provided, the SDK routes all internal logging through this instance.
|
|
20
|
+
* You are responsible for configuring its log level — the `debug` flag has
|
|
21
|
+
* no effect on custom loggers.
|
|
22
|
+
*
|
|
23
|
+
* When omitted, a built-in logger is used with verbosity controlled by `debug`.
|
|
24
|
+
*/
|
|
25
|
+
logger?: ILogger;
|
|
26
|
+
};
|
|
27
|
+
export type Core = {
|
|
28
|
+
environmentId: string;
|
|
29
|
+
createApiClient: (options?: Partial<DynamicApiClientConfig>) => DynamicApiClient;
|
|
30
|
+
logger: ILogger;
|
|
31
|
+
baseMPCRelayApiUrl?: string;
|
|
32
|
+
baseApiUrl?: string;
|
|
33
|
+
debug: boolean;
|
|
34
|
+
apiKey?: string;
|
|
35
|
+
};
|
|
36
|
+
export type DynamicApiClientConfig = {
|
|
37
|
+
environmentId: string;
|
|
38
|
+
authToken?: string;
|
|
39
|
+
baseApiUrl?: string;
|
|
40
|
+
sdkVersion?: string;
|
|
41
|
+
};
|
|
42
|
+
export declare const createCore: ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, logger, }: CoreConfig) => Core;
|
|
43
|
+
//# sourceMappingURL=createCore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCore.d.ts","sourceRoot":"","sources":["../../src/core/createCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAU,KAAK,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGnF,MAAM,MAAM,UAAU,GAAG;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK,gBAAgB,CAAC;IACjF,MAAM,EAAE,OAAO,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,sEAMpB,UAAU,KAAG,IA4Bf,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Core } from './createCore.js';
|
|
2
|
+
export type WithCore<T> = T & {
|
|
3
|
+
_core: Core;
|
|
4
|
+
};
|
|
5
|
+
export declare const assignCore: <T extends object>(target: T, core: Core) => T;
|
|
6
|
+
export declare const getCore: <T extends object>(obj: WithCore<T>) => Core;
|
|
7
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG;IAC5B,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,UAAU,CAAC,QAAQ,IAAI,KAAG,CAOpE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAG,IAE5D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DynamicApiClient } from '@dynamic-labs-wallet/core';
|
|
2
|
+
import type { WalletProperties } from '../types.js';
|
|
3
|
+
export type DelegatedClientConfig = {
|
|
4
|
+
environmentId: string;
|
|
5
|
+
baseApiUrl?: string;
|
|
6
|
+
baseMPCRelayApiUrl?: string;
|
|
7
|
+
apiKey: string;
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type DelegatedWalletClient = {
|
|
11
|
+
get environmentId(): string;
|
|
12
|
+
get debug(): boolean;
|
|
13
|
+
get apiUrl(): string | undefined;
|
|
14
|
+
get wallets(): Record<string, WalletProperties>;
|
|
15
|
+
createApiClient: (options?: Record<string, any>) => DynamicApiClient;
|
|
16
|
+
logger: any;
|
|
17
|
+
apiKey: string;
|
|
18
|
+
baseMPCRelayApiUrl?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const createDelegatedApiClient: (client: DelegatedWalletClient, options?: Record<string, any>) => DynamicApiClient;
|
|
21
|
+
export declare const createDelegatedApiClientWithWalletKey: (client: DelegatedWalletClient, walletApiKey: string) => DynamicApiClient;
|
|
22
|
+
export declare const createDelegatedWalletClient: ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, apiKey, debug, }: DelegatedClientConfig) => DelegatedWalletClient;
|
|
23
|
+
//# sourceMappingURL=createDelegatedClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDelegatedClient.d.ts","sourceRoot":"","sources":["../../src/delegatedClient/createDelegatedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,aAAa,IAAI,MAAM,CAAC;IAC5B,IAAI,KAAK,IAAI,OAAO,CAAC;IACrB,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC;IACjC,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAChD,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,gBAAgB,CAAC;IACrE,MAAM,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAGF,eAAO,MAAM,wBAAwB,WAC3B,qBAAqB,YACpB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC3B,gBAEF,CAAC;AAGF,eAAO,MAAM,qCAAqC,WACxC,qBAAqB,gBACf,MAAM,KACnB,gBAOF,CAAC;AAEF,eAAO,MAAM,2BAA2B,sEAMrC,qBAAqB,0BAsCvB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createDelegatedWalletClient } from './createDelegatedClient.js';
|
|
2
|
+
export type { DelegatedWalletClient, DelegatedClientConfig } from './createDelegatedClient.js';
|
|
3
|
+
export { delegatedSignMessage } from './modules/sign.js';
|
|
4
|
+
export { revokeDelegation } from './modules/revokeDelegation.js';
|
|
5
|
+
export { decryptDelegatedWebhookData } from './modules/decryptWebhookData.js';
|
|
6
|
+
export type { EncryptedDelegatedPayload } from './modules/decryptWebhookData.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delegatedClient/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAG/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,YAAY,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ServerKeyShare } from '../../mpc/types.js';
|
|
2
|
+
export type EncryptedDelegatedPayload = {
|
|
3
|
+
alg: string;
|
|
4
|
+
iv: string;
|
|
5
|
+
ct: string;
|
|
6
|
+
tag: string;
|
|
7
|
+
ek: string;
|
|
8
|
+
kid?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function decryptDelegatedWebhookData({ privateKeyPem, encryptedDelegatedKeyShare, encryptedWalletApiKey, }: {
|
|
11
|
+
privateKeyPem: string;
|
|
12
|
+
encryptedDelegatedKeyShare: EncryptedDelegatedPayload;
|
|
13
|
+
encryptedWalletApiKey: EncryptedDelegatedPayload;
|
|
14
|
+
}): {
|
|
15
|
+
decryptedDelegatedShare: ServerKeyShare;
|
|
16
|
+
decryptedWalletApiKey: string;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=decryptWebhookData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decryptWebhookData.d.ts","sourceRoot":"","sources":["../../../src/delegatedClient/modules/decryptWebhookData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAyBF,wBAAgB,2BAA2B,CAAC,EAC1C,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,GACtB,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,0BAA0B,EAAE,yBAAyB,CAAC;IACtD,qBAAqB,EAAE,yBAAyB,CAAC;CAClD,GAAG;IACF,uBAAuB,EAAE,cAAc,CAAC;IACxC,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAkCA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revokeDelegation.d.ts","sourceRoot":"","sources":["../../../src/delegatedClient/modules/revokeDelegation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAEtB,MAAM,6BAA6B,CAAC;AAErC,eAAO,MAAM,gBAAgB,WAAkB,qBAAqB,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CAapG,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { EcdsaSignature } from '#internal/node';
|
|
2
|
+
import type { ServerKeyShare } from '../../mpc/types.js';
|
|
3
|
+
import type { DelegatedWalletClient } from '../createDelegatedClient.js';
|
|
4
|
+
import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
|
|
5
|
+
export declare const dynamicDelegatedSign: (client: DelegatedWalletClient, { walletId, message, isFormatted, walletApiKey, onError, context, }: {
|
|
6
|
+
walletId: string;
|
|
7
|
+
message: string | Uint8Array;
|
|
8
|
+
isFormatted?: boolean;
|
|
9
|
+
walletApiKey: string;
|
|
10
|
+
onError?: (error: Error) => void;
|
|
11
|
+
context?: SignMessageContext;
|
|
12
|
+
}) => Promise<import("@dynamic-labs-wallet/core").OpenRoomResponse>;
|
|
13
|
+
export declare const delegatedSign: (client: DelegatedWalletClient, { chainName, message, roomId, keyShare, derivationPath, isFormatted, }: {
|
|
14
|
+
chainName: string;
|
|
15
|
+
message: string | Uint8Array;
|
|
16
|
+
roomId: string;
|
|
17
|
+
keyShare: ServerKeyShare;
|
|
18
|
+
derivationPath: Uint32Array | undefined;
|
|
19
|
+
isFormatted?: boolean;
|
|
20
|
+
}) => Promise<Uint8Array | EcdsaSignature>;
|
|
21
|
+
export declare const delegatedSignMessage: (client: DelegatedWalletClient, { walletId, walletApiKey, keyShare, message, chainName, isFormatted, onError, context, }: {
|
|
22
|
+
walletId: string;
|
|
23
|
+
walletApiKey: string;
|
|
24
|
+
keyShare: ServerKeyShare;
|
|
25
|
+
message: string | Uint8Array;
|
|
26
|
+
chainName: string;
|
|
27
|
+
isFormatted?: boolean;
|
|
28
|
+
onError?: (error: Error) => void;
|
|
29
|
+
context?: SignMessageContext;
|
|
30
|
+
}) => Promise<Uint8Array | EcdsaSignature>;
|
|
31
|
+
//# sourceMappingURL=sign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../src/delegatedClient/modules/sign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,eAAO,MAAM,oBAAoB,WACvB,qBAAqB,uEAQ1B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B,kEAsBF,CAAC;AAEF,eAAO,MAAM,aAAa,WAChB,qBAAqB,0EAQ1B;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,cAAc,CAAC;IACzB,cAAc,EAAE,WAAW,GAAG,SAAS,CAAC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,KACA,OAAO,CAAC,UAAU,GAAG,cAAc,CAgBrC,CAAC;AAEF,eAAO,MAAM,oBAAoB,WACvB,qBAAqB,4FAU1B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B,KACA,OAAO,CAAC,UAAU,GAAG,cAAc,CAkCrC,CAAC"}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from '#internal/core';
|
|
2
|
+
export { ThresholdSignatureScheme } from '@dynamic-labs-wallet/core';
|
|
3
|
+
export type { TraceContext } from '@dynamic-labs-wallet/core';
|
|
4
|
+
export { WalletOperation, SOLANA_RPC_URL, getMPCChainConfig } from '@dynamic-labs-wallet/core';
|
|
5
|
+
export { getMPCSignatureScheme, getMPCSigner } from './mpc/index.js';
|
|
6
|
+
export type { ServerInitKeygenResult, ServerKeyShare, SignMessage } from './mpc/index.js';
|
|
7
|
+
export * from './client.js';
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
export * from './utils.js';
|
|
10
|
+
export * from './mpc/index.js';
|
|
11
|
+
export { createDelegatedWalletClient, delegatedSignMessage, revokeDelegation } from './delegatedClient/index.js';
|
|
12
|
+
export type { DelegatedWalletClient, DelegatedClientConfig } from './delegatedClient/index.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG/F,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG1F,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACjH,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mpc/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/src/mpc/mpc.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type BitcoinConfig, SigningAlgorithm } from '@dynamic-labs-wallet/core';
|
|
2
|
+
import { Ecdsa, ExportableEd25519, BIP340 } from '#internal/node';
|
|
3
|
+
export declare const getMPCSignatureScheme: ({ signingAlgorithm, baseRelayUrl, }: {
|
|
4
|
+
signingAlgorithm: SigningAlgorithm;
|
|
5
|
+
baseRelayUrl?: string;
|
|
6
|
+
}) => Ecdsa | ExportableEd25519 | BIP340;
|
|
7
|
+
export declare const getMPCSigner: ({ chainName, baseRelayUrl, bitcoinConfig, }: {
|
|
8
|
+
chainName: string;
|
|
9
|
+
baseRelayUrl?: string;
|
|
10
|
+
bitcoinConfig?: BitcoinConfig;
|
|
11
|
+
}) => Ecdsa | ExportableEd25519 | BIP340;
|
|
12
|
+
//# 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,EACL,KAAK,aAAa,EAElB,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIlE,eAAO,MAAM,qBAAqB,wCAG/B;IACD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,uCAWA,CAAC;AAEF,eAAO,MAAM,YAAY,gDAItB;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,uCAOA,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BIP340InitKeygenResult, BIP340KeygenResult, EcdsaInitKeygenResult, EcdsaKeygenResult, Ed25519InitKeygenResult, Ed25519KeygenResult, MessageHash } from '#internal/node';
|
|
2
|
+
export type ServerInitKeygenResult = EcdsaInitKeygenResult | Ed25519InitKeygenResult | BIP340InitKeygenResult;
|
|
3
|
+
export type ServerKeyShare = EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
|
|
4
|
+
export type SignMessage = MessageHash | Uint8Array;
|
|
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,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AAE9G,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAE1F,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,UAAU,CAAC"}
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ThresholdSignatureScheme, KeyShareBackupInfo, ILogger } from '@dynamic-labs-wallet/core';
|
|
2
|
+
import type { ForwardMPCClientV2 } from '@dynamic-labs-wallet/forward-mpc-client';
|
|
3
|
+
import type { ServerKeyShare } from './mpc/types.js';
|
|
4
|
+
export interface DynamicWalletClientProps {
|
|
5
|
+
environmentId: string;
|
|
6
|
+
baseApiUrl?: string;
|
|
7
|
+
baseMPCRelayApiUrl?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Enables verbose debug-level logging when `true`.
|
|
10
|
+
*
|
|
11
|
+
* Only applies to the built-in default logger. If you provide a custom
|
|
12
|
+
* `logger`, configure its verbosity directly — this flag has no effect on it.
|
|
13
|
+
*
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
debug?: boolean;
|
|
17
|
+
forwardMPCClient?: ForwardMPCClientV2;
|
|
18
|
+
enableMPCAccelerator?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Custom logger for SDK diagnostic output.
|
|
21
|
+
*
|
|
22
|
+
* Accepts any object that implements `ILogger` (`debug`, `info`, `warn`, `error`).
|
|
23
|
+
* When provided, the SDK routes all internal logging through this instance.
|
|
24
|
+
* You are responsible for configuring its log level — the `debug` flag has
|
|
25
|
+
* no effect on custom loggers.
|
|
26
|
+
*
|
|
27
|
+
* When omitted, a built-in logger is used with verbosity controlled by `debug`.
|
|
28
|
+
*/
|
|
29
|
+
logger?: ILogger;
|
|
30
|
+
}
|
|
31
|
+
export interface WalletProperties {
|
|
32
|
+
chainName: string;
|
|
33
|
+
walletId: string;
|
|
34
|
+
accountAddress: string;
|
|
35
|
+
externalServerKeyShares: ServerKeyShare[];
|
|
36
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
37
|
+
derivationPath?: string;
|
|
38
|
+
addressType?: string;
|
|
39
|
+
externalServerKeySharesBackupInfo: KeyShareBackupInfo;
|
|
40
|
+
}
|
|
41
|
+
//# 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,KAAK,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACvG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IACtC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,uBAAuB,EAAE,cAAc,EAAE,CAAC;IAC1C,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC,EAAE,kBAAkB,CAAC;CACvD"}
|
package/src/utils.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MessageHash } from '#internal/node';
|
|
2
|
+
import { type KeyShareBackupInfo, type WaasWalletProperties } from '@dynamic-labs-wallet/core';
|
|
3
|
+
import type { ServerKeyShare } from './mpc/types.js';
|
|
4
|
+
export declare const createLogError: (clientTag: string) => ({ message, error, context }: {
|
|
5
|
+
message: string;
|
|
6
|
+
error: Error;
|
|
7
|
+
context: Record<string, unknown>;
|
|
8
|
+
}) => void;
|
|
9
|
+
export declare const logError: ({ message, error, context, clientTag, }: {
|
|
10
|
+
message: string;
|
|
11
|
+
error: Error;
|
|
12
|
+
context: Record<string, unknown>;
|
|
13
|
+
clientTag?: string;
|
|
14
|
+
}) => void;
|
|
15
|
+
export declare const bytesToBase64: (arr: Uint8Array) => string;
|
|
16
|
+
export declare const stringToBytes: (str: string) => Uint8Array;
|
|
17
|
+
export declare const base64ToBytes: (base64: string) => Uint8Array;
|
|
18
|
+
export declare const ensureBase64Padding: (str: string) => string;
|
|
19
|
+
export declare const stripHexPrefix: (str: string) => string;
|
|
20
|
+
export declare const isHexString: (str: string) => boolean;
|
|
21
|
+
export declare const getExternalServerKeyShareBackupInfo: (params?: {
|
|
22
|
+
walletProperties: WaasWalletProperties;
|
|
23
|
+
}) => KeyShareBackupInfo;
|
|
24
|
+
/**
|
|
25
|
+
* Helper function to merge keyshares and remove duplicates based on pubkey and secretShare
|
|
26
|
+
* @param existingKeyShares - Array of existing keyshares
|
|
27
|
+
* @param newKeyShares - Array of new keyshares to merge
|
|
28
|
+
* @returns Array of merged unique keyshares
|
|
29
|
+
*/
|
|
30
|
+
export declare const mergeUniqueKeyShares: (existingKeyShares: ServerKeyShare[], newKeyShares: ServerKeyShare[]) => ServerKeyShare[];
|
|
31
|
+
interface RetryConfig {
|
|
32
|
+
maxAttempts?: number;
|
|
33
|
+
retryInterval?: number;
|
|
34
|
+
operationName?: string;
|
|
35
|
+
logContext?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Generic helper function to retry a promise-based operations
|
|
39
|
+
*
|
|
40
|
+
* @param operation - The async operation to retry
|
|
41
|
+
* @param config - Configuration options for retry behavior
|
|
42
|
+
* @returns Promise with the operation result
|
|
43
|
+
* @throws Last error encountered after all retries are exhausted
|
|
44
|
+
*/
|
|
45
|
+
export declare function retryPromise<T>(operation: () => Promise<T>, { maxAttempts, retryInterval, operationName, logContext }?: RetryConfig): Promise<T>;
|
|
46
|
+
export declare const formatEvmMessage: (message: string | Uint8Array) => MessageHash;
|
|
47
|
+
export declare const formatMessage: (chainName: string, message: string | Uint8Array) => string | Uint8Array | MessageHash;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAI1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,cAAc,cACb,MAAM,mCACY;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,KAAG,IAClD,CAAC;AAErD,eAAO,MAAM,QAAQ,4CAKlB;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,KAAG,IAUH,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,UAAU,WAE5C,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,MAAM,eAExC,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,MAAM,eAE3C,CAAC;AAGF,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,MAEjD,CAAC;AAEF,eAAO,MAAM,cAAc,QAAS,MAAM,WAAgD,CAAC;AAE3F,eAAO,MAAM,WAAW,QAAS,MA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