@dynamic-labs-wallet/browser 1.0.88 → 1.0.90
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 +149 -50
- package/index.esm.js +150 -52
- package/internal/web/generated/libmpc_executor.js +1 -1
- package/internal/web/index.js +1 -1
- package/package.json +4 -4
- package/src/backup/utils.d.ts.map +1 -1
- package/src/client.d.ts +14 -0
- package/src/client.d.ts.map +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.d.ts.map +1 -1
- package/src/observability.d.ts.map +1 -1
- package/src/services/logger.d.ts +15 -0
- package/src/services/logger.d.ts.map +1 -1
- package/src/services/signedSession.d.ts.map +1 -1
package/index.cjs
CHANGED
|
@@ -652,13 +652,17 @@ function meetsMinVersion(sdkVersion, { minVersionByNamespace, fallbackMinVersion
|
|
|
652
652
|
// canRefresh only proves a local callback exists, not that the host answers it.
|
|
653
653
|
if (!this.supportsReverseChannel()) {
|
|
654
654
|
this.logger.warn(`[${operationName}] host SDK version predates the signed-session reverse channel, declining nonce refresh`, _extends({
|
|
655
|
-
|
|
655
|
+
http: {
|
|
656
|
+
status_code: status
|
|
657
|
+
}
|
|
656
658
|
}, logContext));
|
|
657
659
|
return alsoRetry ? alsoRetry(status) : false;
|
|
658
660
|
}
|
|
659
661
|
onRefreshed(await this.resolve());
|
|
660
662
|
this.logger.info(`[${operationName}] refreshed signed session, retrying`, _extends({
|
|
661
|
-
|
|
663
|
+
http: {
|
|
664
|
+
status_code: status
|
|
665
|
+
}
|
|
662
666
|
}, logContext));
|
|
663
667
|
return true;
|
|
664
668
|
}
|
|
@@ -674,7 +678,9 @@ function meetsMinVersion(sdkVersion, { minVersionByNamespace, fallbackMinVersion
|
|
|
674
678
|
this.logger.info(NONCE_FAILURE_EVENT, _extends({}, logContext, {
|
|
675
679
|
operationName,
|
|
676
680
|
attempt,
|
|
677
|
-
|
|
681
|
+
http: {
|
|
682
|
+
status_code: status
|
|
683
|
+
},
|
|
678
684
|
reason: classifyNonceFailure(body),
|
|
679
685
|
errorCode: body.code,
|
|
680
686
|
errorMessage: body.message,
|
|
@@ -2114,17 +2120,21 @@ const initializeCloudKit = async (config, signInButtonId, onSignInRequired, onSi
|
|
|
2114
2120
|
// Downgrade them to warn so monitors can filter on status:error and
|
|
2115
2121
|
// still catch real system-side failures (5xx/network/unknown) without
|
|
2116
2122
|
// the user-side noise drowning out the signal.
|
|
2117
|
-
const logFn = isUserActionable ? logger.warn : logger.error;
|
|
2118
2123
|
// When every location failed for the same reason (the dominant case)
|
|
2119
2124
|
// surface a single string; otherwise emit the array so consumers can
|
|
2120
2125
|
// see the mix.
|
|
2121
2126
|
const logErrorReason = uniqueReasons.length === 1 ? uniqueReasons[0] : uniqueReasons;
|
|
2122
|
-
|
|
2127
|
+
const logPayload = _extends({}, logContext, {
|
|
2123
2128
|
errorCount: failures.length,
|
|
2124
2129
|
errorReason: logErrorReason,
|
|
2125
2130
|
isUserActionable,
|
|
2126
2131
|
errors: failures.map((f)=>`Failed to backup keyshares to ${f.locationName}: ${f.message}`)
|
|
2127
|
-
})
|
|
2132
|
+
});
|
|
2133
|
+
if (isUserActionable) {
|
|
2134
|
+
logger.warn('[DynamicWaasWalletClient] Google Drive backup failed', logPayload);
|
|
2135
|
+
} else {
|
|
2136
|
+
logger.error('[DynamicWaasWalletClient] Google Drive backup failed', logPayload);
|
|
2137
|
+
}
|
|
2128
2138
|
// Both upload destinations (appDataFolder + personal) commonly fail with
|
|
2129
2139
|
// the same underlying error (e.g., missing OAuth scope). When all failures
|
|
2130
2140
|
// share one message, surface it once without per-location wrapping;
|
|
@@ -2171,7 +2181,12 @@ const classifyWaasErrorKind = (error)=>{
|
|
|
2171
2181
|
// only if the deadline passes; per-attempt we just tag the kind.
|
|
2172
2182
|
const classifyTransientPollError = (error)=>{
|
|
2173
2183
|
const status = readHttpStatus(error);
|
|
2174
|
-
|
|
2184
|
+
// `NETWORK_ERROR_STATUS` (0) is "no response received" — as transient as a 5xx.
|
|
2185
|
+
// It previously arrived here as 500 because handleAxiosError coerced every
|
|
2186
|
+
// unmapped failure to that, so it must stay classified as transient.
|
|
2187
|
+
if (status === 429 || status === core.NETWORK_ERROR_STATUS || status !== undefined && status >= 500) {
|
|
2188
|
+
return 'transient_exhausted';
|
|
2189
|
+
}
|
|
2175
2190
|
return classifyWaasErrorKind(error);
|
|
2176
2191
|
};
|
|
2177
2192
|
// Builds a structured log payload tagged with the HTTPS transport, dropping
|
|
@@ -2187,18 +2202,35 @@ const buildHttpCeremonyMeta = (fields)=>_extends({
|
|
|
2187
2202
|
* so they don't pollute error dashboards with user mistakes.
|
|
2188
2203
|
*/ const isExpectedUserError = (error)=>error instanceof InvalidPasswordError;
|
|
2189
2204
|
/**
|
|
2190
|
-
*
|
|
2191
|
-
*
|
|
2192
|
-
* `
|
|
2193
|
-
*
|
|
2194
|
-
|
|
2205
|
+
* Reads the HTTP status off a `WalletApiError`.
|
|
2206
|
+
*
|
|
2207
|
+
* Matches on `name` as well as `instanceof` because core is inlined into more
|
|
2208
|
+
* than one bundle, and a second copy of the class makes `instanceof` fail
|
|
2209
|
+
* against the first — which would silently defeat every downgrade below. An
|
|
2210
|
+
* error without a numeric status is treated as unrecognised (fail safe: stays
|
|
2211
|
+
* at the caller's fallback level).
|
|
2212
|
+
*/ const getWalletApiErrorStatus = (error)=>{
|
|
2213
|
+
const isWalletApiError = error instanceof core.WalletApiError || error instanceof Error && error.name === 'WalletApiError';
|
|
2214
|
+
if (!isWalletApiError) return undefined;
|
|
2215
|
+
const { status } = error;
|
|
2216
|
+
return typeof status === 'number' ? status : undefined;
|
|
2217
|
+
};
|
|
2195
2218
|
/**
|
|
2196
|
-
* Returns true for
|
|
2197
|
-
*
|
|
2198
|
-
*
|
|
2199
|
-
*
|
|
2200
|
-
*
|
|
2201
|
-
|
|
2219
|
+
* Returns true for client-class API errors (4xx, including 429 and 401)
|
|
2220
|
+
* surfaced as `WalletApiError`. A bad request, missing/invalid auth, forbidden,
|
|
2221
|
+
* or rate-limit is caused by the caller or is transient, so none of them are
|
|
2222
|
+
* actionable as backend errors — the catch-site `logError` logs them at `warn`
|
|
2223
|
+
* to keep them out of error-level dashboards. 401 in particular was the
|
|
2224
|
+
* dominant `Error in getWallet` catch-all contributor.
|
|
2225
|
+
*
|
|
2226
|
+
* 5xx is deliberately NOT downgraded: those are genuine backend failures and
|
|
2227
|
+
* the 500 monitors depend on them staying at `error`. The `handleAxiosError`
|
|
2228
|
+
* HTTP-layer log also records them with fuller context, now that it no longer
|
|
2229
|
+
* collides with Datadog's reserved `status` field.
|
|
2230
|
+
*/ const isDowngradableApiError = (error)=>{
|
|
2231
|
+
const status = getWalletApiErrorStatus(error);
|
|
2232
|
+
return status !== undefined && status < 500;
|
|
2233
|
+
};
|
|
2202
2234
|
/**
|
|
2203
2235
|
* Returns true for p-queue TimeoutError. These are transient and
|
|
2204
2236
|
* retryable client-side, so logging at `warn` prevents them from
|
|
@@ -2218,12 +2250,33 @@ const CLIENT_NETWORK_ERROR_MESSAGES = new Set([
|
|
|
2218
2250
|
const msg = error.message.toLowerCase();
|
|
2219
2251
|
return CLIENT_NETWORK_ERROR_MESSAGES.has(msg) || msg.startsWith('webassembly compilation aborted: network error');
|
|
2220
2252
|
};
|
|
2221
|
-
const
|
|
2222
|
-
if (isExpectedUserError(error))
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2253
|
+
const classifyOne = (error)=>{
|
|
2254
|
+
if (isExpectedUserError(error)) return 'info';
|
|
2255
|
+
if (isDowngradableApiError(error) || isQueueTimeoutError(error) || isClientNetworkError(error)) return 'warn';
|
|
2256
|
+
return undefined;
|
|
2257
|
+
};
|
|
2258
|
+
/** Bounded so a self-referencing or cyclic `cause` chain cannot spin. */ const MAX_CAUSE_DEPTH = 5;
|
|
2259
|
+
/**
|
|
2260
|
+
* Single source of truth for "how bad is this error". Exported so callers
|
|
2261
|
+
* classify identically instead of hard-coding `logger.error` for every failure.
|
|
2262
|
+
*
|
|
2263
|
+
* Walks the `cause` chain, because the outermost error is frequently a wrapper
|
|
2264
|
+
* that carries no information about severity — a chain client throws
|
|
2265
|
+
* `new Error(ERROR_SIGN_MESSAGE, { cause })`, so classifying only the top link
|
|
2266
|
+
* sees a bare `Error` and falls through to `error`. That is how a Cloudflare WAF
|
|
2267
|
+
* 429 kept being reported as a hard SDK failure even after the direct call sites
|
|
2268
|
+
* were fixed: the wrapper, not the cause, was being classified.
|
|
2269
|
+
*
|
|
2270
|
+
* The first classifiable link wins, so the most specific known failure in the
|
|
2271
|
+
* chain decides.
|
|
2272
|
+
*/ const resolveLogLevel = (error, fallback)=>{
|
|
2273
|
+
let current = error;
|
|
2274
|
+
for(let depth = 0; current !== undefined && current !== null && depth < MAX_CAUSE_DEPTH; depth += 1){
|
|
2275
|
+
const level = classifyOne(current);
|
|
2276
|
+
if (level) return level;
|
|
2277
|
+
const next = current instanceof Error ? current.cause : undefined;
|
|
2278
|
+
if (next === current) break;
|
|
2279
|
+
current = next;
|
|
2227
2280
|
}
|
|
2228
2281
|
return fallback;
|
|
2229
2282
|
};
|
|
@@ -2990,6 +3043,17 @@ class DynamicWalletClient {
|
|
|
2990
3043
|
return this.walletMap[normalizeAddress(accountAddress)];
|
|
2991
3044
|
}
|
|
2992
3045
|
/**
|
|
3046
|
+
* Sync variant of {@link requireWalletFromMap} (no refetch). Replaces the
|
|
3047
|
+
* `getWalletFromMap(...)!` non-null assertions that surfaced a missing
|
|
3048
|
+
* wallet as an opaque property-access TypeError at some later line.
|
|
3049
|
+
*/ getRequiredWalletFromMap(accountAddress) {
|
|
3050
|
+
const walletData = this.getWalletFromMap(accountAddress);
|
|
3051
|
+
if (!walletData) {
|
|
3052
|
+
throw new Error(`Wallet not found for address: ${accountAddress}`);
|
|
3053
|
+
}
|
|
3054
|
+
return walletData;
|
|
3055
|
+
}
|
|
3056
|
+
/**
|
|
2993
3057
|
* Get wallet properties from the map, refetching once if not found.
|
|
2994
3058
|
* Uses getWallet (with NO_OPERATION) when signedSessionId is available for a
|
|
2995
3059
|
* more robust fetch, otherwise falls back to getWallets().
|
|
@@ -4882,7 +4946,7 @@ class DynamicWalletClient {
|
|
|
4882
4946
|
signedSessionId
|
|
4883
4947
|
});
|
|
4884
4948
|
const walletId = wallet.walletId;
|
|
4885
|
-
const currentScheme = this.
|
|
4949
|
+
const currentScheme = this.getRequiredWalletFromMap(accountAddress).thresholdSignatureScheme;
|
|
4886
4950
|
const bitcoinConfig = this.getBitcoinConfigForChain(chainName, accountAddress);
|
|
4887
4951
|
// Same-parties reshare — only the caller's share participates.
|
|
4888
4952
|
const [existingClientShare] = await this.ensureClientShare(accountAddress);
|
|
@@ -5797,7 +5861,7 @@ class DynamicWalletClient {
|
|
|
5797
5861
|
useShareSetReshare,
|
|
5798
5862
|
initialSignerRules
|
|
5799
5863
|
});
|
|
5800
|
-
const backupInfo = this.
|
|
5864
|
+
const backupInfo = this.getRequiredWalletFromMap(accountAddress).clientKeySharesBackupInfo;
|
|
5801
5865
|
const delegatedKeyShares = backupInfo.backups[core.BackupLocation.DELEGATED] || [];
|
|
5802
5866
|
return delegatedKeyShares;
|
|
5803
5867
|
}
|
|
@@ -6260,7 +6324,7 @@ class DynamicWalletClient {
|
|
|
6260
6324
|
if (shares.length > 1) {
|
|
6261
6325
|
this.logger.warn('[DynamicWaasWalletClient] Multiple client key shares found in storage', {
|
|
6262
6326
|
accountAddress,
|
|
6263
|
-
source,
|
|
6327
|
+
shareSource: source,
|
|
6264
6328
|
count: shares.length
|
|
6265
6329
|
});
|
|
6266
6330
|
}
|
|
@@ -6311,7 +6375,7 @@ class DynamicWalletClient {
|
|
|
6311
6375
|
*/ logSharePersistence({ accountAddress, clientKeyShares, source }) {
|
|
6312
6376
|
this.logger.info('[DynamicWaasWalletClient] Persisting client key shares', {
|
|
6313
6377
|
accountAddress,
|
|
6314
|
-
source,
|
|
6378
|
+
shareSource: source,
|
|
6315
6379
|
inputCount: clientKeyShares.length
|
|
6316
6380
|
});
|
|
6317
6381
|
}
|
|
@@ -6818,8 +6882,8 @@ class DynamicWalletClient {
|
|
|
6818
6882
|
} catch (error) {
|
|
6819
6883
|
var _error_cause_context;
|
|
6820
6884
|
const errorReason = classifyPasswordBackupError(error);
|
|
6821
|
-
const
|
|
6822
|
-
|
|
6885
|
+
const isUserActionable = isUserActionablePasswordBackupErrorReason(errorReason);
|
|
6886
|
+
const logPayload = _extends({}, logContext, {
|
|
6823
6887
|
chainName: walletData == null ? void 0 : walletData.chainName,
|
|
6824
6888
|
errorReason,
|
|
6825
6889
|
errorName: error instanceof Error ? error.name : undefined,
|
|
@@ -6829,7 +6893,12 @@ class DynamicWalletClient {
|
|
|
6829
6893
|
// failures show the underlying KeyShareDecryptionError / kdfVersion.
|
|
6830
6894
|
errorCauseName: error instanceof Error && error.cause instanceof Error ? error.cause.name : undefined,
|
|
6831
6895
|
kdfVersion: error instanceof Error && error.cause instanceof KeyShareDecryptionError ? (_error_cause_context = error.cause.context) == null ? void 0 : _error_cause_context.kdfVersion : undefined
|
|
6832
|
-
})
|
|
6896
|
+
});
|
|
6897
|
+
if (isUserActionable) {
|
|
6898
|
+
this.logger.warn('[backupSharesWithDistribution] failed', logPayload);
|
|
6899
|
+
} else {
|
|
6900
|
+
this.logger.error('[backupSharesWithDistribution] failed', logPayload);
|
|
6901
|
+
}
|
|
6833
6902
|
logError({
|
|
6834
6903
|
message: 'Error in backupSharesWithDistribution',
|
|
6835
6904
|
error: error,
|
|
@@ -7080,9 +7149,9 @@ class DynamicWalletClient {
|
|
|
7080
7149
|
// they don't count against the dashboard's System-side Success Rate metric.
|
|
7081
7150
|
logPasswordOperationFailure(passwordOperation, error, context) {
|
|
7082
7151
|
const errorReason = classifyPasswordBackupError(error);
|
|
7083
|
-
const
|
|
7152
|
+
const isUserActionable = isUserActionablePasswordBackupErrorReason(errorReason);
|
|
7084
7153
|
const errorContext = error instanceof KeyShareDecryptionError ? error.context : undefined;
|
|
7085
|
-
|
|
7154
|
+
const logPayload = _extends({}, context, {
|
|
7086
7155
|
passwordOperation,
|
|
7087
7156
|
errorReason,
|
|
7088
7157
|
environmentId: this.environmentId,
|
|
@@ -7092,7 +7161,12 @@ class DynamicWalletClient {
|
|
|
7092
7161
|
errorStack: error instanceof Error ? error.stack : undefined
|
|
7093
7162
|
}, errorContext ? {
|
|
7094
7163
|
errorContext
|
|
7095
|
-
} : {})
|
|
7164
|
+
} : {});
|
|
7165
|
+
if (isUserActionable) {
|
|
7166
|
+
this.logger.warn(`[${passwordOperation}] failed`, logPayload);
|
|
7167
|
+
} else {
|
|
7168
|
+
this.logger.error(`[${passwordOperation}] failed`, logPayload);
|
|
7169
|
+
}
|
|
7096
7170
|
}
|
|
7097
7171
|
async updatePassword({ accountAddress, existingPassword, newPassword, signedSessionId, sessionPublicKey, passwordUpdateBatchId }) {
|
|
7098
7172
|
const dynamicRequestId = uuid.v4();
|
|
@@ -7407,7 +7481,14 @@ class DynamicWalletClient {
|
|
|
7407
7481
|
*/ recoverStrategy({ clientKeyShareBackupInfo, thresholdSignatureScheme, walletOperation, shareCount = undefined }) {
|
|
7408
7482
|
var _clientKeyShareBackupInfo_backups_BackupLocation_DYNAMIC;
|
|
7409
7483
|
const { backups } = clientKeyShareBackupInfo;
|
|
7410
|
-
|
|
7484
|
+
// Wallet metadata can carry a missing/unknown scheme (e.g. legacy or
|
|
7485
|
+
// partially-created wallets); indexing MPC_CONFIG with it used to throw a
|
|
7486
|
+
// bare destructuring TypeError that hid the actual problem.
|
|
7487
|
+
const mpcConfig = core.MPC_CONFIG[thresholdSignatureScheme];
|
|
7488
|
+
if (!mpcConfig) {
|
|
7489
|
+
throw new Error(`Unsupported or missing thresholdSignatureScheme: ${String(thresholdSignatureScheme)}`);
|
|
7490
|
+
}
|
|
7491
|
+
const { clientThreshold } = mpcConfig;
|
|
7411
7492
|
let requiredShareCount = walletOperation === core.WalletOperation.REFRESH || walletOperation === core.WalletOperation.REACH_ALL_PARTIES || walletOperation === core.WalletOperation.RESHARE ? clientThreshold : 1;
|
|
7412
7493
|
// Override requiredShareCount if shareCount is provided
|
|
7413
7494
|
if (shareCount !== undefined) {
|
|
@@ -7476,7 +7557,7 @@ class DynamicWalletClient {
|
|
|
7476
7557
|
}
|
|
7477
7558
|
async internalRecoverEncryptedBackupByWallet({ accountAddress, password, walletOperation, signedSessionId, shareCount = undefined, storeRecoveredShares = true, mfaToken }) {
|
|
7478
7559
|
try {
|
|
7479
|
-
const wallet = this.
|
|
7560
|
+
const wallet = this.getRequiredWalletFromMap(accountAddress);
|
|
7480
7561
|
this.logger.debug(`recoverEncryptedBackupByWallet wallet: ${walletOperation}`, wallet);
|
|
7481
7562
|
const { shares } = this.recoverStrategy({
|
|
7482
7563
|
clientKeyShareBackupInfo: wallet.clientKeySharesBackupInfo,
|
|
@@ -7585,7 +7666,7 @@ class DynamicWalletClient {
|
|
|
7585
7666
|
password,
|
|
7586
7667
|
signedSessionId
|
|
7587
7668
|
});
|
|
7588
|
-
const walletData = this.
|
|
7669
|
+
const walletData = this.getRequiredWalletFromMap(accountAddress);
|
|
7589
7670
|
const currentThresholdSignatureScheme = walletData.thresholdSignatureScheme;
|
|
7590
7671
|
if (currentThresholdSignatureScheme === core.ThresholdSignatureScheme.TWO_OF_TWO) {
|
|
7591
7672
|
// Reshare to 2-of-3, which will automatically handle the backup distribution
|
|
@@ -7644,7 +7725,7 @@ class DynamicWalletClient {
|
|
|
7644
7725
|
* every provider already holding a backup plus the requested one,
|
|
7645
7726
|
* restricted to providers the reshare can deliver to.
|
|
7646
7727
|
*/ async reshareNonDelegatedTwoOfThree({ accountAddress, backupLocation, password, signedSessionId, sessionPublicKey, googleDriveAccessToken, googleDriveTokenSource }) {
|
|
7647
|
-
const walletData = this.
|
|
7728
|
+
const walletData = this.getRequiredWalletFromMap(accountAddress);
|
|
7648
7729
|
const cloudProviders = new Set([
|
|
7649
7730
|
...getActiveCloudProviders(walletData.clientKeySharesBackupInfo).filter((provider)=>provider === core.BackupLocation.GOOGLE_DRIVE || provider === core.BackupLocation.ICLOUD),
|
|
7650
7731
|
backupLocation
|
|
@@ -7783,14 +7864,18 @@ class DynamicWalletClient {
|
|
|
7783
7864
|
// misuse of an externally-supplied token (e.g. repeated failures) is
|
|
7784
7865
|
// traceable, not just completed backups. Enum only; the original error
|
|
7785
7866
|
// still propagates after this. Failures log at warn to surface them.
|
|
7786
|
-
const
|
|
7787
|
-
logFn.call(this.logger, '[DynamicWaasWalletClient] Google Drive backup token source', {
|
|
7867
|
+
const logPayload = {
|
|
7788
7868
|
accountAddress,
|
|
7789
7869
|
environmentId: this.environmentId,
|
|
7790
7870
|
userId: this.userId,
|
|
7791
7871
|
tokenSource,
|
|
7792
7872
|
success
|
|
7793
|
-
}
|
|
7873
|
+
};
|
|
7874
|
+
if (success) {
|
|
7875
|
+
this.logger.info('[DynamicWaasWalletClient] Google Drive backup token source', logPayload);
|
|
7876
|
+
} else {
|
|
7877
|
+
this.logger.warn('[DynamicWaasWalletClient] Google Drive backup token source', logPayload);
|
|
7878
|
+
}
|
|
7794
7879
|
}
|
|
7795
7880
|
}
|
|
7796
7881
|
/**
|
|
@@ -7809,8 +7894,7 @@ class DynamicWalletClient {
|
|
|
7809
7894
|
]);
|
|
7810
7895
|
const { blocking } = preflightResult;
|
|
7811
7896
|
if (blocking) {
|
|
7812
|
-
const
|
|
7813
|
-
logFn.call(this.logger, '[DynamicWaasWalletClient] Google Drive backup failed (preflight)', {
|
|
7897
|
+
const logPayload = {
|
|
7814
7898
|
accountAddress,
|
|
7815
7899
|
environmentId: this.environmentId,
|
|
7816
7900
|
userId: this.userId,
|
|
@@ -7821,8 +7905,13 @@ class DynamicWalletClient {
|
|
|
7821
7905
|
`Preflight (${blocking.source}): ${blocking.message}`
|
|
7822
7906
|
],
|
|
7823
7907
|
preflight: true,
|
|
7824
|
-
|
|
7825
|
-
}
|
|
7908
|
+
preflightSource: blocking.source
|
|
7909
|
+
};
|
|
7910
|
+
if (blocking.isUserActionable) {
|
|
7911
|
+
this.logger.warn('[DynamicWaasWalletClient] Google Drive backup failed (preflight)', logPayload);
|
|
7912
|
+
} else {
|
|
7913
|
+
this.logger.error('[DynamicWaasWalletClient] Google Drive backup failed (preflight)', logPayload);
|
|
7914
|
+
}
|
|
7826
7915
|
throw createGoogleDriveError({
|
|
7827
7916
|
message: blocking.message,
|
|
7828
7917
|
isRetryable: false,
|
|
@@ -7938,7 +8027,7 @@ class DynamicWalletClient {
|
|
|
7938
8027
|
if (encryptedKeyShares.length === 0) {
|
|
7939
8028
|
throw new Error('No key shares found');
|
|
7940
8029
|
}
|
|
7941
|
-
const thresholdSignatureScheme = this.
|
|
8030
|
+
const thresholdSignatureScheme = this.getRequiredWalletFromMap(accountAddress).thresholdSignatureScheme;
|
|
7942
8031
|
const backupData = createBackupData({
|
|
7943
8032
|
encryptedKeyShares,
|
|
7944
8033
|
accountAddress,
|
|
@@ -7965,7 +8054,7 @@ class DynamicWalletClient {
|
|
|
7965
8054
|
signedSessionId
|
|
7966
8055
|
});
|
|
7967
8056
|
const accessToken = googleDriveAccessToken != null ? googleDriveAccessToken : await this.fetchGoogleDriveAccessToken(accountAddress);
|
|
7968
|
-
const thresholdSignatureScheme = this.
|
|
8057
|
+
const thresholdSignatureScheme = this.getRequiredWalletFromMap(accountAddress).thresholdSignatureScheme;
|
|
7969
8058
|
const backupFileName = getClientKeyShareExportFileName({
|
|
7970
8059
|
thresholdSignatureScheme,
|
|
7971
8060
|
accountAddress,
|
|
@@ -8185,7 +8274,7 @@ class DynamicWalletClient {
|
|
|
8185
8274
|
});
|
|
8186
8275
|
const { requiredShareCount } = this.recoverStrategy({
|
|
8187
8276
|
clientKeyShareBackupInfo: clientKeySharesBackupInfo,
|
|
8188
|
-
thresholdSignatureScheme: this.
|
|
8277
|
+
thresholdSignatureScheme: this.getRequiredWalletFromMap(accountAddress).thresholdSignatureScheme,
|
|
8189
8278
|
walletOperation
|
|
8190
8279
|
});
|
|
8191
8280
|
if (clientKeyShares.length >= requiredShareCount) {
|
|
@@ -8290,7 +8379,7 @@ class DynamicWalletClient {
|
|
|
8290
8379
|
accountAddress,
|
|
8291
8380
|
walletOperation
|
|
8292
8381
|
})) {
|
|
8293
|
-
const walletData = this.
|
|
8382
|
+
const walletData = this.getRequiredWalletFromMap(accountAddress);
|
|
8294
8383
|
const isPasswordEncrypted = isWalletPasswordEncrypted(walletData);
|
|
8295
8384
|
// Locked wallet (password-encrypted, no password supplied): its shares need the
|
|
8296
8385
|
// user's password, not the environmentId. Return it ENCRYPTED for any operation
|
|
@@ -8595,7 +8684,7 @@ class DynamicWalletClient {
|
|
|
8595
8684
|
additionalWalletsUnlocked,
|
|
8596
8685
|
additionalWalletsFailed
|
|
8597
8686
|
});
|
|
8598
|
-
return this.
|
|
8687
|
+
return this.getRequiredWalletFromMap(accountAddress);
|
|
8599
8688
|
} catch (error) {
|
|
8600
8689
|
this.logPasswordOperationFailure('unlockWallet', error, {
|
|
8601
8690
|
accountAddress
|
|
@@ -9042,6 +9131,15 @@ class DynamicWalletClient {
|
|
|
9042
9131
|
time: (traceContext == null ? void 0 : traceContext.startTime) ? now - traceContext.startTime : 0
|
|
9043
9132
|
}, traceContext);
|
|
9044
9133
|
}
|
|
9134
|
+
/**
|
|
9135
|
+
* Log a chain-client operation failure at a severity that matches the
|
|
9136
|
+
* underlying cause. Logs through `this.logger` (not `logError`) so the
|
|
9137
|
+
* structured `error.causes` chain survives — that chain is what makes these
|
|
9138
|
+
* failures diagnosable — while still honouring the shared level policy, so a
|
|
9139
|
+
* transient 429/401/network blip does not read as a hard SDK error.
|
|
9140
|
+
*/ logOperationFailure(message, error) {
|
|
9141
|
+
this.logger[resolveLogLevel(error, 'error')](message, error);
|
|
9142
|
+
}
|
|
9045
9143
|
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, storageKey, debug, featureFlags, argon2idRebackupTargets, authMode = core.AuthMode.HEADER, authToken = undefined, backupServiceAuthToken, // Represents the version of the client SDK used by developer
|
|
9046
9144
|
sdkVersion, forwardMPCClient, baseClientKeysharesRelayApiUrl, iCloudConfig, logger }, internalOptions){
|
|
9047
9145
|
this.userId = undefined;
|
|
@@ -9281,6 +9379,7 @@ exports.isStaleClientSharesError = isStaleClientSharesError;
|
|
|
9281
9379
|
exports.listICloudBackups = listICloudBackups;
|
|
9282
9380
|
exports.markCeremonyErrorNonRetryable = markCeremonyErrorNonRetryable;
|
|
9283
9381
|
exports.readEnvironmentSettings = readEnvironmentSettings;
|
|
9382
|
+
exports.resolveLogLevel = resolveLogLevel;
|
|
9284
9383
|
exports.retryPromise = retryPromise;
|
|
9285
9384
|
exports.shouldReshareToSameBackups = shouldReshareToSameBackups;
|
|
9286
9385
|
exports.timeoutPromise = timeoutPromise;
|