@dynamic-labs-wallet/browser 0.0.319 → 0.0.321
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 +19 -2
- package/index.esm.js +19 -2
- package/package.json +2 -2
- package/src/backup/encryption/argon2.d.ts +0 -10
- package/src/backup/encryption/argon2.d.ts.map +0 -1
- package/src/backup/encryption/config.d.ts +0 -39
- package/src/backup/encryption/config.d.ts.map +0 -1
- package/src/backup/encryption/constants.d.ts +0 -35
- package/src/backup/encryption/constants.d.ts.map +0 -1
- package/src/backup/encryption/core.d.ts +0 -31
- package/src/backup/encryption/core.d.ts.map +0 -1
- package/src/backup/encryption/pbkdf2.d.ts +0 -10
- package/src/backup/encryption/pbkdf2.d.ts.map +0 -1
- package/src/backup/encryption/types.d.ts +0 -46
- package/src/backup/encryption/types.d.ts.map +0 -1
- package/src/backup/encryption/utils.d.ts +0 -9
- package/src/backup/encryption/utils.d.ts.map +0 -1
- package/src/backup/providers/googleDrive.d.ts +0 -19
- package/src/backup/providers/googleDrive.d.ts.map +0 -1
- package/src/backup/providers/iCloud.d.ts +0 -64
- package/src/backup/providers/iCloud.d.ts.map +0 -1
- package/src/backup/utils.d.ts +0 -14
- package/src/backup/utils.d.ts.map +0 -1
- package/src/client.d.ts +0 -770
- package/src/client.d.ts.map +0 -1
- package/src/constants.d.ts +0 -9
- package/src/constants.d.ts.map +0 -1
- package/src/errorConstants.d.ts +0 -13
- package/src/errorConstants.d.ts.map +0 -1
- package/src/index.d.ts +0 -14
- package/src/index.d.ts.map +0 -1
- package/src/mpc/index.d.ts +0 -5
- package/src/mpc/index.d.ts.map +0 -1
- package/src/mpc/mpc.d.ts +0 -20
- package/src/mpc/mpc.d.ts.map +0 -1
- package/src/mpc/types.d.ts +0 -6
- package/src/mpc/types.d.ts.map +0 -1
- package/src/normalizeAddress.d.ts +0 -7
- package/src/normalizeAddress.d.ts.map +0 -1
- package/src/passwordValidation.d.ts +0 -29
- package/src/passwordValidation.d.ts.map +0 -1
- package/src/queue.d.ts +0 -96
- package/src/queue.d.ts.map +0 -1
- package/src/services/encryption.d.ts +0 -19
- package/src/services/encryption.d.ts.map +0 -1
- package/src/services/localStorage.d.ts +0 -34
- package/src/services/localStorage.d.ts.map +0 -1
- package/src/services/logger.d.ts +0 -6
- package/src/services/logger.d.ts.map +0 -1
- package/src/types.d.ts +0 -129
- package/src/types.d.ts.map +0 -1
- package/src/utils.d.ts +0 -90
- package/src/utils.d.ts.map +0 -1
- package/src/walletState.d.ts +0 -28
- package/src/walletState.d.ts.map +0 -1
package/index.cjs.js
CHANGED
|
@@ -1721,6 +1721,17 @@ const readEnvironmentSettings = ()=>{
|
|
|
1721
1721
|
const ENCRYPTED_SHARES_PENDING_SUFFIX = `${core.ENCRYPTED_SHARES_STORAGE_SUFFIX}-pending`;
|
|
1722
1722
|
class DynamicWalletClient {
|
|
1723
1723
|
/**
|
|
1724
|
+
* Resolves the signed session ID from an explicit value or falls back to the callback.
|
|
1725
|
+
* Throws if neither source provides a value.
|
|
1726
|
+
*/ async resolveSignedSessionId(signedSessionId) {
|
|
1727
|
+
const resolved = signedSessionId != null ? signedSessionId : await (this.getSignedSessionIdCallback == null ? void 0 : this.getSignedSessionIdCallback.call(this));
|
|
1728
|
+
if (!resolved) {
|
|
1729
|
+
const errorMsg = signedSessionId === undefined && this.getSignedSessionIdCallback ? 'signedSessionId callback returned an invalid value' : 'signedSessionId is required for backup but was not provided and no callback is configured';
|
|
1730
|
+
throw new Error(errorMsg);
|
|
1731
|
+
}
|
|
1732
|
+
return resolved;
|
|
1733
|
+
}
|
|
1734
|
+
/**
|
|
1724
1735
|
* Check if wallet has heavy operations in progress
|
|
1725
1736
|
*/ static isHeavyOpInProgress(accountAddress) {
|
|
1726
1737
|
return WalletQueueManager.isHeavyOpInProgress(accountAddress);
|
|
@@ -3560,6 +3571,8 @@ class DynamicWalletClient {
|
|
|
3560
3571
|
const dynamicRequestId = uuid.v4();
|
|
3561
3572
|
try {
|
|
3562
3573
|
var _backupData_locationsWithKeyShares;
|
|
3574
|
+
// Resolve signed session ID lazily once, so all downstream calls receive a string.
|
|
3575
|
+
const resolvedSignedSessionId = await this.resolveSignedSessionId(signedSessionId);
|
|
3563
3576
|
const walletData = this.getWalletFromMap(accountAddress);
|
|
3564
3577
|
if (!(walletData == null ? void 0 : walletData.walletId)) {
|
|
3565
3578
|
const error = new Error(`WalletId not found for accountAddress ${accountAddress}`);
|
|
@@ -3611,7 +3624,7 @@ class DynamicWalletClient {
|
|
|
3611
3624
|
walletId: walletData.walletId,
|
|
3612
3625
|
clientShares: distribution.clientShares,
|
|
3613
3626
|
password,
|
|
3614
|
-
signedSessionId,
|
|
3627
|
+
signedSessionId: resolvedSignedSessionId,
|
|
3615
3628
|
dynamicRequestId,
|
|
3616
3629
|
chainName: walletData.chainName,
|
|
3617
3630
|
bitcoinConfig,
|
|
@@ -3641,7 +3654,7 @@ class DynamicWalletClient {
|
|
|
3641
3654
|
uploadPromises.push(retryPromise(()=>this.publishDelegatedShare({
|
|
3642
3655
|
walletId: walletData.walletId,
|
|
3643
3656
|
delegatedShare: distribution.delegatedShare,
|
|
3644
|
-
signedSessionId,
|
|
3657
|
+
signedSessionId: resolvedSignedSessionId,
|
|
3645
3658
|
dynamicRequestId,
|
|
3646
3659
|
chainName: walletData.chainName,
|
|
3647
3660
|
bitcoinConfig,
|
|
@@ -5240,6 +5253,10 @@ class DynamicWalletClient {
|
|
|
5240
5253
|
if (internalOptions == null ? void 0 : internalOptions.secureStorage) {
|
|
5241
5254
|
this.secureStorage = internalOptions.secureStorage;
|
|
5242
5255
|
}
|
|
5256
|
+
// Set signed session ID callback if provided (internal use only)
|
|
5257
|
+
if (internalOptions == null ? void 0 : internalOptions.getSignedSessionId) {
|
|
5258
|
+
this.getSignedSessionIdCallback = internalOptions.getSignedSessionId;
|
|
5259
|
+
}
|
|
5243
5260
|
this.apiClient = new core.DynamicApiClient({
|
|
5244
5261
|
environmentId,
|
|
5245
5262
|
authToken,
|
package/index.esm.js
CHANGED
|
@@ -1722,6 +1722,17 @@ const readEnvironmentSettings = ()=>{
|
|
|
1722
1722
|
const ENCRYPTED_SHARES_PENDING_SUFFIX = `${ENCRYPTED_SHARES_STORAGE_SUFFIX}-pending`;
|
|
1723
1723
|
class DynamicWalletClient {
|
|
1724
1724
|
/**
|
|
1725
|
+
* Resolves the signed session ID from an explicit value or falls back to the callback.
|
|
1726
|
+
* Throws if neither source provides a value.
|
|
1727
|
+
*/ async resolveSignedSessionId(signedSessionId) {
|
|
1728
|
+
const resolved = signedSessionId != null ? signedSessionId : await (this.getSignedSessionIdCallback == null ? void 0 : this.getSignedSessionIdCallback.call(this));
|
|
1729
|
+
if (!resolved) {
|
|
1730
|
+
const errorMsg = signedSessionId === undefined && this.getSignedSessionIdCallback ? 'signedSessionId callback returned an invalid value' : 'signedSessionId is required for backup but was not provided and no callback is configured';
|
|
1731
|
+
throw new Error(errorMsg);
|
|
1732
|
+
}
|
|
1733
|
+
return resolved;
|
|
1734
|
+
}
|
|
1735
|
+
/**
|
|
1725
1736
|
* Check if wallet has heavy operations in progress
|
|
1726
1737
|
*/ static isHeavyOpInProgress(accountAddress) {
|
|
1727
1738
|
return WalletQueueManager.isHeavyOpInProgress(accountAddress);
|
|
@@ -3561,6 +3572,8 @@ class DynamicWalletClient {
|
|
|
3561
3572
|
const dynamicRequestId = v4();
|
|
3562
3573
|
try {
|
|
3563
3574
|
var _backupData_locationsWithKeyShares;
|
|
3575
|
+
// Resolve signed session ID lazily once, so all downstream calls receive a string.
|
|
3576
|
+
const resolvedSignedSessionId = await this.resolveSignedSessionId(signedSessionId);
|
|
3564
3577
|
const walletData = this.getWalletFromMap(accountAddress);
|
|
3565
3578
|
if (!(walletData == null ? void 0 : walletData.walletId)) {
|
|
3566
3579
|
const error = new Error(`WalletId not found for accountAddress ${accountAddress}`);
|
|
@@ -3612,7 +3625,7 @@ class DynamicWalletClient {
|
|
|
3612
3625
|
walletId: walletData.walletId,
|
|
3613
3626
|
clientShares: distribution.clientShares,
|
|
3614
3627
|
password,
|
|
3615
|
-
signedSessionId,
|
|
3628
|
+
signedSessionId: resolvedSignedSessionId,
|
|
3616
3629
|
dynamicRequestId,
|
|
3617
3630
|
chainName: walletData.chainName,
|
|
3618
3631
|
bitcoinConfig,
|
|
@@ -3642,7 +3655,7 @@ class DynamicWalletClient {
|
|
|
3642
3655
|
uploadPromises.push(retryPromise(()=>this.publishDelegatedShare({
|
|
3643
3656
|
walletId: walletData.walletId,
|
|
3644
3657
|
delegatedShare: distribution.delegatedShare,
|
|
3645
|
-
signedSessionId,
|
|
3658
|
+
signedSessionId: resolvedSignedSessionId,
|
|
3646
3659
|
dynamicRequestId,
|
|
3647
3660
|
chainName: walletData.chainName,
|
|
3648
3661
|
bitcoinConfig,
|
|
@@ -5241,6 +5254,10 @@ class DynamicWalletClient {
|
|
|
5241
5254
|
if (internalOptions == null ? void 0 : internalOptions.secureStorage) {
|
|
5242
5255
|
this.secureStorage = internalOptions.secureStorage;
|
|
5243
5256
|
}
|
|
5257
|
+
// Set signed session ID callback if provided (internal use only)
|
|
5258
|
+
if (internalOptions == null ? void 0 : internalOptions.getSignedSessionId) {
|
|
5259
|
+
this.getSignedSessionIdCallback = internalOptions.getSignedSessionId;
|
|
5260
|
+
}
|
|
5244
5261
|
this.apiClient = new DynamicApiClient({
|
|
5245
5262
|
environmentId,
|
|
5246
5263
|
authToken,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.321",
|
|
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.321",
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "^0.0.900",
|
|
9
9
|
"argon2id": "1.0.1",
|
|
10
10
|
"axios": "1.13.5",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { EncryptionConfig } from './config.js';
|
|
2
|
-
import type { KeyDerivationParams } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Derives a key using Argon2id algorithm
|
|
5
|
-
* @param params - Key derivation parameters
|
|
6
|
-
* @param encryptionConfig - Encryption configuration
|
|
7
|
-
* @returns Promise<CryptoKey>
|
|
8
|
-
*/
|
|
9
|
-
export declare const deriveArgon2Key: ({ password, salt }: KeyDerivationParams, encryptionConfig: EncryptionConfig) => Promise<CryptoKey>;
|
|
10
|
-
//# sourceMappingURL=argon2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"argon2.d.ts","sourceRoot":"","sources":["../../../src/backup/encryption/argon2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,KAAK,EAA0B,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,eAAe,uBACN,mBAAmB,oBACrB,gBAAgB,KACjC,OAAO,CAAC,SAAS,CAyBnB,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { EncryptionVersion } from './constants.js';
|
|
2
|
-
import type { Argon2EncryptionConfig, BaseEncryptionConfig } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Encryption configuration for each version
|
|
5
|
-
*/
|
|
6
|
-
export declare const ENCRYPTION_VERSIONS: {
|
|
7
|
-
readonly v1: {
|
|
8
|
-
readonly version: EncryptionVersion.V1_LEGACY;
|
|
9
|
-
readonly algorithm: "AES-GCM";
|
|
10
|
-
readonly keyDerivation: "PBKDF2";
|
|
11
|
-
readonly iterations: 100000;
|
|
12
|
-
readonly hashAlgorithm: "SHA-256";
|
|
13
|
-
readonly algorithmLength: 256;
|
|
14
|
-
};
|
|
15
|
-
readonly v2: {
|
|
16
|
-
readonly version: EncryptionVersion.V2_PBKDF2;
|
|
17
|
-
readonly algorithm: "AES-GCM";
|
|
18
|
-
readonly keyDerivation: "PBKDF2";
|
|
19
|
-
readonly iterations: 1000000;
|
|
20
|
-
readonly hashAlgorithm: "SHA-256";
|
|
21
|
-
readonly algorithmLength: 256;
|
|
22
|
-
};
|
|
23
|
-
readonly v3: Argon2EncryptionConfig;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Type for the encryption configuration
|
|
27
|
-
*/
|
|
28
|
-
export type EncryptionConfig = BaseEncryptionConfig | Argon2EncryptionConfig;
|
|
29
|
-
/**
|
|
30
|
-
* Helper function to get encryption configuration by version string
|
|
31
|
-
* @param version - The version string (e.g., 'v1', 'v2', 'v3')
|
|
32
|
-
* @returns The encryption configuration for the specified version
|
|
33
|
-
*/
|
|
34
|
-
export declare const getEncryptionConfig: (version?: string) => EncryptionConfig;
|
|
35
|
-
/**
|
|
36
|
-
* Check if a configuration uses Argon2
|
|
37
|
-
*/
|
|
38
|
-
export declare const isArgon2Config: (config: EncryptionConfig) => config is Argon2EncryptionConfig;
|
|
39
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/backup/encryption/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,iBAAiB,EAKlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;iBA2BzB,sBAAsB;CACnB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,KAAG,gBAYtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,WAAY,gBAAgB,KAAG,MAAM,IAAI,sBAEnE,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encryption version identifiers
|
|
3
|
-
*/
|
|
4
|
-
export declare enum EncryptionVersion {
|
|
5
|
-
V1_LEGACY = "v1",
|
|
6
|
-
V2_PBKDF2 = "v2",
|
|
7
|
-
V3_ARGON2 = "v3"
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Current default version for new encryptions
|
|
11
|
-
*/
|
|
12
|
-
export declare const ENCRYPTION_VERSION_CURRENT = EncryptionVersion.V3_ARGON2;
|
|
13
|
-
/**
|
|
14
|
-
* Algorithm constants
|
|
15
|
-
*/
|
|
16
|
-
export declare const PBKDF2_ALGORITHM = "PBKDF2";
|
|
17
|
-
export declare const PBKDF2_HASH_ALGORITHM = "SHA-256";
|
|
18
|
-
export declare const HASH_ALGORITHM = "SHA-256";
|
|
19
|
-
export declare const ARGON2_ALGORITHM = "Argon2id";
|
|
20
|
-
export declare const AES_GCM_ALGORITHM = "AES-GCM";
|
|
21
|
-
export declare const AES_GCM_LENGTH = 256;
|
|
22
|
-
/**
|
|
23
|
-
* Argon2 configuration constants, values were chosen based on RFC (https://www.rfc-editor.org/rfc/rfc9106.html#name-parameter-choice)
|
|
24
|
-
* taking into account that this runs in the client, possibly in smartphones with limited resources
|
|
25
|
-
*/
|
|
26
|
-
export declare const ARGON2_MEMORY_SIZE = 65536;
|
|
27
|
-
export declare const ARGON2_ITERATIONS = 3;
|
|
28
|
-
export declare const ARGON2_PARALLELISM = 2;
|
|
29
|
-
export declare const ARGON2_HASH_LENGTH = 32;
|
|
30
|
-
/**
|
|
31
|
-
* PBKDF2 configuration constants
|
|
32
|
-
*/
|
|
33
|
-
export declare const PBKDF2_ITERATIONS_V1 = 100000;
|
|
34
|
-
export declare const PBKDF2_ITERATIONS_V2 = 1000000;
|
|
35
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/backup/encryption/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,SAAS,OAAO;IAChB,SAAS,OAAO;IAChB,SAAS,OAAO;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAC3C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AACxC,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,oBAAoB,SAAS,CAAC;AAC3C,eAAO,MAAM,oBAAoB,UAAU,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { EncryptionMetadata } from '@dynamic-labs-wallet/core';
|
|
2
|
-
import type { DecryptionData, EncryptedData } from './types.js';
|
|
3
|
-
export declare const INVALID_PASSWORD_ERROR = "Decryption failed: Invalid password. Please check your password and try again.";
|
|
4
|
-
export declare class InvalidPasswordError extends Error {
|
|
5
|
-
constructor();
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Encrypts data using the specified encryption version.
|
|
9
|
-
* Always uses the latest encryption configuration for new encryptions by default.
|
|
10
|
-
*/
|
|
11
|
-
export declare const encryptData: ({ data, password, version, }: {
|
|
12
|
-
data: string;
|
|
13
|
-
password: string;
|
|
14
|
-
version?: string;
|
|
15
|
-
}) => Promise<EncryptedData>;
|
|
16
|
-
/**
|
|
17
|
-
* Decrypts data with version-based configuration.
|
|
18
|
-
* Uses the version field from the data to determine encryption parameters.
|
|
19
|
-
* Falls back to legacy version for backward compatibility if no version is specified.
|
|
20
|
-
* For v3 (Argon2), retries with parallelism=1 if an OperationError occurs.
|
|
21
|
-
*/
|
|
22
|
-
export declare const decryptData: ({ data, password }: {
|
|
23
|
-
data: DecryptionData;
|
|
24
|
-
password: string;
|
|
25
|
-
}) => Promise<string>;
|
|
26
|
-
/**
|
|
27
|
-
* Gets encryption metadata for a specific version.
|
|
28
|
-
* Used when we need to include metadata in legacy systems or APIs that require it.
|
|
29
|
-
*/
|
|
30
|
-
export declare const getEncryptionMetadataForVersion: (version: string) => EncryptionMetadata;
|
|
31
|
-
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/backup/encryption/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAMpE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAuB,MAAM,YAAY,CAAC;AAGrF,eAAO,MAAM,sBAAsB,mFAAmF,CAAC;AAEvH,qBAAa,oBAAqB,SAAQ,KAAK;;CAK9C;AAoBD;;;GAGG;AACH,eAAO,MAAM,WAAW,iCAIrB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,OAAO,CAAC,aAAa,CA2BxB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,uBAA8B;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,KAAG,OAAO,CAAC,MAAM,CAyDhH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,YAAa,MAAM,KAAG,kBAmBjE,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { EncryptionConfig } from './config.js';
|
|
2
|
-
import type { KeyDerivationParams } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Derives a key using PBKDF2 algorithm
|
|
5
|
-
* @param params - Key derivation parameters
|
|
6
|
-
* @param encryptionConfig - Encryption configuration
|
|
7
|
-
* @returns Promise<CryptoKey>
|
|
8
|
-
*/
|
|
9
|
-
export declare const derivePBKDF2Key: ({ password, salt }: KeyDerivationParams, encryptionConfig: EncryptionConfig) => Promise<CryptoKey>;
|
|
10
|
-
//# sourceMappingURL=pbkdf2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pbkdf2.d.ts","sourceRoot":"","sources":["../../../src/backup/encryption/pbkdf2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGtD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,uBACN,mBAAmB,oBACrB,gBAAgB,KACjC,OAAO,CAAC,SAAS,CAoBnB,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { EncryptionVersion } from './constants.js';
|
|
2
|
-
/**
|
|
3
|
-
* Base encryption configuration
|
|
4
|
-
*/
|
|
5
|
-
export interface BaseEncryptionConfig {
|
|
6
|
-
version: EncryptionVersion;
|
|
7
|
-
algorithm: string;
|
|
8
|
-
keyDerivation: string;
|
|
9
|
-
iterations: number;
|
|
10
|
-
hashAlgorithm: string;
|
|
11
|
-
algorithmLength: number;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Argon2-specific encryption configuration
|
|
15
|
-
*/
|
|
16
|
-
export interface Argon2EncryptionConfig extends BaseEncryptionConfig {
|
|
17
|
-
memorySize: number;
|
|
18
|
-
parallelism: number;
|
|
19
|
-
hashLength: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Encrypted data structure
|
|
23
|
-
*/
|
|
24
|
-
export interface EncryptedData {
|
|
25
|
-
salt: string;
|
|
26
|
-
iv: string;
|
|
27
|
-
cipher: string;
|
|
28
|
-
version: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Decryption input data structure
|
|
32
|
-
*/
|
|
33
|
-
export interface DecryptionData {
|
|
34
|
-
salt: string;
|
|
35
|
-
iv: string;
|
|
36
|
-
cipher: string;
|
|
37
|
-
version?: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Key derivation parameters
|
|
41
|
-
*/
|
|
42
|
-
export interface KeyDerivationParams {
|
|
43
|
-
password: string;
|
|
44
|
-
salt: Uint8Array;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/backup/encryption/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;CAClB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for encryption operations
|
|
3
|
-
* These functions are separated to avoid circular dependencies
|
|
4
|
-
*/
|
|
5
|
-
export declare const bytesToBase64: (arr: Uint8Array) => string;
|
|
6
|
-
export declare const stringToBytes: (str: string) => Uint8Array;
|
|
7
|
-
export declare const base64ToBytes: (base64: string) => Uint8Array;
|
|
8
|
-
export declare const ensureBase64Padding: (str: string) => string;
|
|
9
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/backup/encryption/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,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"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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, fileName, }: {
|
|
12
|
-
accessToken: string;
|
|
13
|
-
fileName: string;
|
|
14
|
-
}) => Promise<any>;
|
|
15
|
-
export declare const downloadFileFromGoogleDrive: ({ accessToken, fileName, }: {
|
|
16
|
-
accessToken: string;
|
|
17
|
-
fileName: string;
|
|
18
|
-
}) => Promise<unknown | null>;
|
|
19
|
-
//# sourceMappingURL=googleDrive.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAuCF,eAAO,MAAM,wBAAwB,+BAGlC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,iBAsBA,CAAC;AAEF,eAAO,MAAM,2BAA2B,+BAGrC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CA6BzB,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { BackupData, ICloudConfig } from '@dynamic-labs-wallet/core';
|
|
2
|
-
import type * as CloudKitTypes from 'tsl-apple-cloudkit';
|
|
3
|
-
export type SavedRecord = CloudKitTypes.RecordReceived;
|
|
4
|
-
export type ICloudBackupRecord = {
|
|
5
|
-
recordName: string;
|
|
6
|
-
created: number;
|
|
7
|
-
modified: number;
|
|
8
|
-
backupData: BackupData;
|
|
9
|
-
};
|
|
10
|
-
export type ICloudAuthOptions = {
|
|
11
|
-
pollIntervalMs?: number;
|
|
12
|
-
timeoutMs?: number;
|
|
13
|
-
signal?: AbortSignal;
|
|
14
|
-
};
|
|
15
|
-
export declare const loadCloudKit: () => Promise<void>;
|
|
16
|
-
export declare const configureCloudKit: (config?: ICloudConfig, signInButtonId?: string) => void;
|
|
17
|
-
export declare const resetCloudKitConfig: () => void;
|
|
18
|
-
/**
|
|
19
|
-
* Ensures CloudKit is loaded and configured without requiring the auth flow.
|
|
20
|
-
* Used for checking authentication status before showing sign-in UI.
|
|
21
|
-
*/
|
|
22
|
-
export declare const ensureCloudKitInitialized: (config?: ICloudConfig) => Promise<boolean>;
|
|
23
|
-
/**
|
|
24
|
-
* Check if user is already authenticated using fetchCurrentUserIdentity.
|
|
25
|
-
* This is more reliable than setUpAuth which sometimes returns undefined
|
|
26
|
-
* even when the user has an existing session.
|
|
27
|
-
*/
|
|
28
|
-
export declare const isUserAuthenticated: (container: CloudKitTypes.Container) => Promise<boolean>;
|
|
29
|
-
/**
|
|
30
|
-
* Check if the user is authenticated with iCloud using the default container.
|
|
31
|
-
* Returns false if CloudKit is not configured or user is not authenticated.
|
|
32
|
-
* Optionally accepts config to auto-initialize CloudKit before checking.
|
|
33
|
-
*/
|
|
34
|
-
export declare const isICloudAuthenticated: (config?: ICloudConfig) => Promise<boolean>;
|
|
35
|
-
/**
|
|
36
|
-
* Cancel any ongoing authentication attempt
|
|
37
|
-
*/
|
|
38
|
-
export declare const cancelICloudAuth: () => void;
|
|
39
|
-
export declare const ensureICloudAuth: (onSignInRequired?: () => void, onSignInComplete?: () => void, onAuthStatusUpdate?: (status: string) => void, options?: ICloudAuthOptions) => Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Save backup data to iCloud with retry logic
|
|
42
|
-
* Optionally accepts config to auto-initialize CloudKit before saving.
|
|
43
|
-
*/
|
|
44
|
-
export declare const saveBackupToICloud: (backupData: unknown, retryOptions?: {
|
|
45
|
-
maxAttempts?: number;
|
|
46
|
-
retryInterval?: number;
|
|
47
|
-
}, config?: ICloudConfig) => Promise<SavedRecord>;
|
|
48
|
-
/**
|
|
49
|
-
* List all backups from iCloud
|
|
50
|
-
* Optionally accepts config to auto-initialize CloudKit before listing.
|
|
51
|
-
*/
|
|
52
|
-
export declare const listICloudBackups: (config?: ICloudConfig) => Promise<ICloudBackupRecord[]>;
|
|
53
|
-
/**
|
|
54
|
-
* Retrieve a specific backup from iCloud by record name
|
|
55
|
-
* Optionally accepts config to auto-initialize CloudKit before fetching.
|
|
56
|
-
*/
|
|
57
|
-
export declare const getICloudBackup: (recordName: string, config?: ICloudConfig) => Promise<ICloudBackupRecord | null>;
|
|
58
|
-
/**
|
|
59
|
-
* Delete a backup from iCloud
|
|
60
|
-
* Optionally accepts config to auto-initialize CloudKit before deleting.
|
|
61
|
-
*/
|
|
62
|
-
export declare const deleteICloudBackup: (recordName: string, config?: ICloudConfig) => Promise<void>;
|
|
63
|
-
export declare const initializeCloudKit: (config?: ICloudConfig, signInButtonId?: string, onSignInRequired?: () => void, onSignInComplete?: () => void, onAuthStatusUpdate?: (status: string) => void, authOptions?: ICloudAuthOptions) => Promise<void>;
|
|
64
|
-
//# sourceMappingURL=iCloud.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iCloud.d.ts","sourceRoot":"","sources":["../../../src/backup/providers/iCloud.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,KAAK,aAAa,MAAM,oBAAoB,CAAC;AAIzD,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC,cAAc,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAsCF,eAAO,MAAM,YAAY,QAAO,OAAO,CAAC,IAAI,CAkB3C,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAAa,YAAY,mBAAmB,MAAM,KAAG,IA+BlF,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,IAGtC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,YAAmB,YAAY,KAAG,OAAO,CAAC,OAAO,CAYtF,CAAC;AAaF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,cAAqB,aAAa,CAAC,SAAS,KAAG,OAAO,CAAC,OAAO,CAO7F,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,YAAa,YAAY,KAAG,OAAO,CAAC,OAAO,CAYzE,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,IAKnC,CAAC;AAEF,eAAO,MAAM,gBAAgB,sBACR,MAAM,IAAI,qBACV,MAAM,IAAI,uBACR,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,YACnC,iBAAiB,KAC1B,OAAO,CAAC,IAAI,CAgHd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,eACjB,OAAO,iBACJ;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,WACtD,YAAY,KACpB,OAAO,CAAC,WAAW,CAuClB,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,iBAAiB,YAAa,YAAY,KAAG,OAAO,CAAC,kBAAkB,EAAE,CAuClF,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,eAAe,eAAgB,MAAM,WAAW,YAAY,KAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAuCzG,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,kBAAkB,eAAgB,MAAM,WAAW,YAAY,KAAG,OAAO,CAAC,IAAI,CAiBvF,CAAC;AAEL,eAAO,MAAM,kBAAkB,YACpB,YAAY,mBACJ,MAAM,qBACJ,MAAM,IAAI,qBACV,MAAM,IAAI,uBACR,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,gBAC/B,iBAAiB,KAC9B,OAAO,CAAC,IAAI,CASd,CAAC"}
|
package/src/backup/utils.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Uploads a backup to Google Drive App
|
|
3
|
-
* @param accessToken - The access token for the Google Drive API
|
|
4
|
-
* @param fileName - The name of the file to upload
|
|
5
|
-
* @param backupData - The data to upload
|
|
6
|
-
* @param accountAddress - The account address associated with the backup
|
|
7
|
-
*/
|
|
8
|
-
export declare const uploadBackupToGoogleDrive: ({ accessToken, fileName, backupData, accountAddress, }: {
|
|
9
|
-
accessToken: string;
|
|
10
|
-
fileName: string;
|
|
11
|
-
backupData: any;
|
|
12
|
-
accountAddress: string;
|
|
13
|
-
}) => Promise<void>;
|
|
14
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/backup/utils.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,2DAKnC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,GAAG,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB,kBAmDA,CAAC"}
|