@dynamic-labs-wallet/browser 1.1.20 → 1.1.21
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 +9 -2
- package/index.esm.js +9 -2
- package/package.json +3 -3
- package/src/services/signedSession.d.ts.map +1 -1
package/index.cjs
CHANGED
|
@@ -667,6 +667,12 @@ function meetsMinVersion(sdkVersion, { minVersionByNamespace, fallbackMinVersion
|
|
|
667
667
|
* retried. `alsoRetry` lets callers opt into additional retryable statuses
|
|
668
668
|
* (e.g. 429 / 5xx) on top of the nonce refresh.
|
|
669
669
|
*/ refreshShouldRetry({ onRefreshed, operationName, logContext, alsoRetry }) {
|
|
670
|
+
// Per-operation state: a slow-but-succeeding attempt can consume the nonce
|
|
671
|
+
// after the client already moved on (e.g. a transient error on attempt 1
|
|
672
|
+
// triggered an `alsoRetry`), so the replay 400 can land on any attempt, not
|
|
673
|
+
// just the first. Refresh on the first such 400 seen, whichever attempt
|
|
674
|
+
// it's on, and never again — preserves the single-refresh-per-operation limit.
|
|
675
|
+
let hasRefreshed = false;
|
|
670
676
|
return async (error, attempt)=>{
|
|
671
677
|
const status = getHttpStatus(error);
|
|
672
678
|
// A 400 is a refreshable replay nonce; a 401 is a session-key mismatch the
|
|
@@ -677,7 +683,7 @@ function meetsMinVersion(sdkVersion, { minVersionByNamespace, fallbackMinVersion
|
|
|
677
683
|
const isSessionSignatureFailure = status === 401 && SESSION_SIGNATURE_FAILURE_REASONS.has(classifyNonceFailure(readErrorBody(error)));
|
|
678
684
|
const shouldInstrument = status === 400 || isSessionSignatureFailure;
|
|
679
685
|
if (shouldInstrument) {
|
|
680
|
-
const willRefresh = status === 400 &&
|
|
686
|
+
const willRefresh = status === 400 && !hasRefreshed && this.canRefresh && this.supportsReverseChannel();
|
|
681
687
|
this.instrumentNonceFailure({
|
|
682
688
|
error,
|
|
683
689
|
attempt,
|
|
@@ -687,7 +693,7 @@ function meetsMinVersion(sdkVersion, { minVersionByNamespace, fallbackMinVersion
|
|
|
687
693
|
logContext
|
|
688
694
|
});
|
|
689
695
|
}
|
|
690
|
-
if (status === 400 &&
|
|
696
|
+
if (status === 400 && !hasRefreshed && this.canRefresh) {
|
|
691
697
|
// canRefresh only proves a local callback exists, not that the host answers it.
|
|
692
698
|
if (!this.supportsReverseChannel()) {
|
|
693
699
|
this.logger.warn(`[${operationName}] host SDK version predates the signed-session reverse channel, declining nonce refresh`, _extends({
|
|
@@ -697,6 +703,7 @@ function meetsMinVersion(sdkVersion, { minVersionByNamespace, fallbackMinVersion
|
|
|
697
703
|
}, logContext));
|
|
698
704
|
return alsoRetry ? alsoRetry(status) : false;
|
|
699
705
|
}
|
|
706
|
+
hasRefreshed = true;
|
|
700
707
|
onRefreshed(await this.resolve());
|
|
701
708
|
this.logger.info(`[${operationName}] refreshed signed session, retrying`, _extends({
|
|
702
709
|
http: {
|
package/index.esm.js
CHANGED
|
@@ -668,6 +668,12 @@ function meetsMinVersion(sdkVersion, { minVersionByNamespace, fallbackMinVersion
|
|
|
668
668
|
* retried. `alsoRetry` lets callers opt into additional retryable statuses
|
|
669
669
|
* (e.g. 429 / 5xx) on top of the nonce refresh.
|
|
670
670
|
*/ refreshShouldRetry({ onRefreshed, operationName, logContext, alsoRetry }) {
|
|
671
|
+
// Per-operation state: a slow-but-succeeding attempt can consume the nonce
|
|
672
|
+
// after the client already moved on (e.g. a transient error on attempt 1
|
|
673
|
+
// triggered an `alsoRetry`), so the replay 400 can land on any attempt, not
|
|
674
|
+
// just the first. Refresh on the first such 400 seen, whichever attempt
|
|
675
|
+
// it's on, and never again — preserves the single-refresh-per-operation limit.
|
|
676
|
+
let hasRefreshed = false;
|
|
671
677
|
return async (error, attempt)=>{
|
|
672
678
|
const status = getHttpStatus(error);
|
|
673
679
|
// A 400 is a refreshable replay nonce; a 401 is a session-key mismatch the
|
|
@@ -678,7 +684,7 @@ function meetsMinVersion(sdkVersion, { minVersionByNamespace, fallbackMinVersion
|
|
|
678
684
|
const isSessionSignatureFailure = status === 401 && SESSION_SIGNATURE_FAILURE_REASONS.has(classifyNonceFailure(readErrorBody(error)));
|
|
679
685
|
const shouldInstrument = status === 400 || isSessionSignatureFailure;
|
|
680
686
|
if (shouldInstrument) {
|
|
681
|
-
const willRefresh = status === 400 &&
|
|
687
|
+
const willRefresh = status === 400 && !hasRefreshed && this.canRefresh && this.supportsReverseChannel();
|
|
682
688
|
this.instrumentNonceFailure({
|
|
683
689
|
error,
|
|
684
690
|
attempt,
|
|
@@ -688,7 +694,7 @@ function meetsMinVersion(sdkVersion, { minVersionByNamespace, fallbackMinVersion
|
|
|
688
694
|
logContext
|
|
689
695
|
});
|
|
690
696
|
}
|
|
691
|
-
if (status === 400 &&
|
|
697
|
+
if (status === 400 && !hasRefreshed && this.canRefresh) {
|
|
692
698
|
// canRefresh only proves a local callback exists, not that the host answers it.
|
|
693
699
|
if (!this.supportsReverseChannel()) {
|
|
694
700
|
this.logger.warn(`[${operationName}] host SDK version predates the signed-session reverse channel, declining nonce refresh`, _extends({
|
|
@@ -698,6 +704,7 @@ function meetsMinVersion(sdkVersion, { minVersionByNamespace, fallbackMinVersion
|
|
|
698
704
|
}, logContext));
|
|
699
705
|
return alsoRetry ? alsoRetry(status) : false;
|
|
700
706
|
}
|
|
707
|
+
hasRefreshed = true;
|
|
701
708
|
onRefreshed(await this.resolve());
|
|
702
709
|
this.logger.info(`[${operationName}] refreshed signed session, retrying`, _extends({
|
|
703
710
|
http: {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/browser",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.21",
|
|
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": "1.1.
|
|
7
|
+
"@dynamic-labs-wallet/core": "1.1.21",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "2.0.2",
|
|
9
|
-
"@dynamic-labs-wallet/primitives": "1.1.
|
|
9
|
+
"@dynamic-labs-wallet/primitives": "1.1.21",
|
|
10
10
|
"@dynamic-labs/sdk-api-core": "0.50.0",
|
|
11
11
|
"@noble/curves": "1.8.0",
|
|
12
12
|
"argon2id": "1.0.1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signedSession.d.ts","sourceRoot":"","sources":["../../src/services/signedSession.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIzD,gEAAgE;AAChE,KAAK,WAAW,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEnF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,sCAAsC,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAC1B,yBAAyB,GACzB,2BAA2B,GAC3B,oBAAoB,GACpB,OAAO,CAAC;AAkCZ,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,sBAAuB;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,kBAoB7F,CAAC;AAEF;;;;;;;;;;GAUG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4C;IAGxE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAU;gBAEtC,EACV,MAAM,EACN,UAAU,EACV,WAAW,GACZ,EAAE;QACD,MAAM,EAAE,OAAO,CAAC;QACh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