@dynamic-labs-wallet/browser 0.0.320 → 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/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",
|