@dynamic-labs-wallet/browser 0.0.162 → 0.0.163

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 CHANGED
@@ -239,6 +239,7 @@ const ensureBase64Padding = (str)=>{
239
239
  * Decrypts data with version-based configuration.
240
240
  * Uses the version field from the data to determine encryption parameters.
241
241
  * Falls back to legacy version for backward compatibility if no version is specified.
242
+ * For v3 (Argon2), retries with parallelism=1 if an OperationError occurs.
242
243
  */ const decryptData = async ({ data, password })=>{
243
244
  const { salt, iv, cipher, version } = data;
244
245
  // Ensure proper base64 padding for all values
@@ -261,6 +262,29 @@ const ensureBase64Padding = (str)=>{
261
262
  }, key, cipherBytes);
262
263
  return new TextDecoder().decode(decryptedData);
263
264
  } catch (error) {
265
+ // For a short period of time we lowered the parallelism for v3 (Argon2) to 1 to try to fix issues
266
+ // for users with limited resources, however this introduced a new issue that the decryption would fail
267
+ // for existing users with v3 (Argon2) encryption, this is a fallback for a few users.
268
+ if (error instanceof Error && error.name === 'OperationError' && version === 'v3' && isArgon2Config(encryptionConfig)) {
269
+ try {
270
+ // Create a modified config with parallelism=1
271
+ const modifiedConfig = _extends({}, encryptionConfig, {
272
+ parallelism: 1
273
+ });
274
+ const key = await getKey({
275
+ password,
276
+ salt: saltBytes
277
+ }, modifiedConfig);
278
+ const decryptedData = await crypto.subtle.decrypt({
279
+ name: AES_GCM_ALGORITHM,
280
+ iv: ivBytes
281
+ }, key, cipherBytes);
282
+ return new TextDecoder().decode(decryptedData);
283
+ } catch (retryError) {
284
+ // If retry also fails, throw the original error with additional context
285
+ throw new Error(`Decryption failed after retry with parallelism=1: ${retryError}`);
286
+ }
287
+ }
264
288
  throw new Error('Decryption failed: ' + error);
265
289
  }
266
290
  };
package/index.esm.js CHANGED
@@ -240,6 +240,7 @@ const ensureBase64Padding = (str)=>{
240
240
  * Decrypts data with version-based configuration.
241
241
  * Uses the version field from the data to determine encryption parameters.
242
242
  * Falls back to legacy version for backward compatibility if no version is specified.
243
+ * For v3 (Argon2), retries with parallelism=1 if an OperationError occurs.
243
244
  */ const decryptData = async ({ data, password })=>{
244
245
  const { salt, iv, cipher, version } = data;
245
246
  // Ensure proper base64 padding for all values
@@ -262,6 +263,29 @@ const ensureBase64Padding = (str)=>{
262
263
  }, key, cipherBytes);
263
264
  return new TextDecoder().decode(decryptedData);
264
265
  } catch (error) {
266
+ // For a short period of time we lowered the parallelism for v3 (Argon2) to 1 to try to fix issues
267
+ // for users with limited resources, however this introduced a new issue that the decryption would fail
268
+ // for existing users with v3 (Argon2) encryption, this is a fallback for a few users.
269
+ if (error instanceof Error && error.name === 'OperationError' && version === 'v3' && isArgon2Config(encryptionConfig)) {
270
+ try {
271
+ // Create a modified config with parallelism=1
272
+ const modifiedConfig = _extends({}, encryptionConfig, {
273
+ parallelism: 1
274
+ });
275
+ const key = await getKey({
276
+ password,
277
+ salt: saltBytes
278
+ }, modifiedConfig);
279
+ const decryptedData = await crypto.subtle.decrypt({
280
+ name: AES_GCM_ALGORITHM,
281
+ iv: ivBytes
282
+ }, key, cipherBytes);
283
+ return new TextDecoder().decode(decryptedData);
284
+ } catch (retryError) {
285
+ // If retry also fails, throw the original error with additional context
286
+ throw new Error(`Decryption failed after retry with parallelism=1: ${retryError}`);
287
+ }
288
+ }
265
289
  throw new Error('Decryption failed: ' + error);
266
290
  }
267
291
  };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/browser",
3
- "version": "0.0.162",
3
+ "version": "0.0.163",
4
4
  "license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
5
5
  "type": "commonjs",
6
6
  "dependencies": {
7
- "@dynamic-labs-wallet/core": "0.0.162",
7
+ "@dynamic-labs-wallet/core": "0.0.163",
8
8
  "@dynamic-labs/logger": "^4.25.3",
9
9
  "@dynamic-labs/sdk-api-core": "^0.0.764",
10
10
  "argon2id": "1.0.1",
@@ -13,6 +13,7 @@ export declare const encryptData: ({ data, password, version, }: {
13
13
  * Decrypts data with version-based configuration.
14
14
  * Uses the version field from the data to determine encryption parameters.
15
15
  * Falls back to legacy version for backward compatibility if no version is specified.
16
+ * For v3 (Argon2), retries with parallelism=1 if an OperationError occurs.
16
17
  */
17
18
  export declare const decryptData: ({ data, password, }: {
18
19
  data: DecryptionData;
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/backup/encryption/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAU/D,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAEd,MAAM,SAAS,CAAC;AAkBjB;;;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,CAiCxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB,KAAG,OAAO,CAAC,MAAM,CA4BjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,YACjC,MAAM,KACd,kBAmBF,CAAC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/backup/encryption/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAU/D,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAEd,MAAM,SAAS,CAAC;AAkBjB;;;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,CAiCxB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB,KAAG,OAAO,CAAC,MAAM,CA6DjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,YACjC,MAAM,KACd,kBAmBF,CAAC"}