@protontech/openpgp 5.11.1 → 5.11.2-0

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.
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v5.11.1 - 2024-04-10 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v5.11.2-0 - 2024-04-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  const globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3
3
 
4
4
  import buffer from 'buffer';
@@ -2956,7 +2956,7 @@ var config = {
2956
2956
  * @memberof module:config
2957
2957
  * @property {String} versionString A version string to be included in armored messages
2958
2958
  */
2959
- versionString: 'OpenPGP.js 5.11.1',
2959
+ versionString: 'OpenPGP.js 5.11.2-0',
2960
2960
  /**
2961
2961
  * @memberof module:config
2962
2962
  * @property {String} commentString A comment string to be included in armored messages
@@ -16441,9 +16441,26 @@ class Argon2OutOfMemoryError extends Error {
16441
16441
  let loadArgonWasmModule;
16442
16442
  let argon2Promise;
16443
16443
  // reload wasm module above this treshold, to deallocated used memory
16444
- const ARGON2_WASM_MEMORY_THRESHOLD_RELOAD = 2 << 19;
16444
+ // (cannot be declared as a simple `static` field as its not supported by Safari 14)
16445
+ let ARGON2_WASM_MEMORY_THRESHOLD_RELOAD = 2 << 19;
16445
16446
 
16446
16447
  class Argon2S2K {
16448
+ static get ARGON2_WASM_MEMORY_THRESHOLD_RELOAD() {
16449
+ return ARGON2_WASM_MEMORY_THRESHOLD_RELOAD;
16450
+ }
16451
+
16452
+ static set ARGON2_WASM_MEMORY_THRESHOLD_RELOAD(memoryThreshold) {
16453
+ ARGON2_WASM_MEMORY_THRESHOLD_RELOAD = memoryThreshold;
16454
+ }
16455
+
16456
+ static reloadWasmModule() {
16457
+ if (!loadArgonWasmModule) return;
16458
+
16459
+ // it will be awaited if needed at the next `produceKey` invocation
16460
+ argon2Promise = loadArgonWasmModule();
16461
+ argon2Promise.catch(() => {});
16462
+ }
16463
+
16447
16464
  /**
16448
16465
  * @param {Object} [config] - Full configuration, defaults to openpgp.config
16449
16466
  */
@@ -16531,10 +16548,8 @@ class Argon2S2K {
16531
16548
  });
16532
16549
 
16533
16550
  // a lot of memory was used, reload to deallocate
16534
- if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
16535
- // it will be awaited if needed at the next `produceKey` invocation
16536
- argon2Promise = loadArgonWasmModule();
16537
- argon2Promise.catch(() => {});
16551
+ if (decodedM > Argon2S2K.ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
16552
+ Argon2S2K.reloadWasmModule();
16538
16553
  }
16539
16554
  return hash;
16540
16555
  } catch (e) {
package/dist/openpgp.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v5.11.1 - 2024-04-10 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v5.11.2-0 - 2024-04-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  var openpgp = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -2953,7 +2953,7 @@ var openpgp = (function (exports) {
2953
2953
  * @memberof module:config
2954
2954
  * @property {String} versionString A version string to be included in armored messages
2955
2955
  */
2956
- versionString: 'OpenPGP.js 5.11.1',
2956
+ versionString: 'OpenPGP.js 5.11.2-0',
2957
2957
  /**
2958
2958
  * @memberof module:config
2959
2959
  * @property {String} commentString A comment string to be included in armored messages
@@ -16432,9 +16432,26 @@ var openpgp = (function (exports) {
16432
16432
  let loadArgonWasmModule;
16433
16433
  let argon2Promise;
16434
16434
  // reload wasm module above this treshold, to deallocated used memory
16435
- const ARGON2_WASM_MEMORY_THRESHOLD_RELOAD = 2 << 19;
16435
+ // (cannot be declared as a simple `static` field as its not supported by Safari 14)
16436
+ let ARGON2_WASM_MEMORY_THRESHOLD_RELOAD = 2 << 19;
16436
16437
 
16437
16438
  class Argon2S2K {
16439
+ static get ARGON2_WASM_MEMORY_THRESHOLD_RELOAD() {
16440
+ return ARGON2_WASM_MEMORY_THRESHOLD_RELOAD;
16441
+ }
16442
+
16443
+ static set ARGON2_WASM_MEMORY_THRESHOLD_RELOAD(memoryThreshold) {
16444
+ ARGON2_WASM_MEMORY_THRESHOLD_RELOAD = memoryThreshold;
16445
+ }
16446
+
16447
+ static reloadWasmModule() {
16448
+ if (!loadArgonWasmModule) return;
16449
+
16450
+ // it will be awaited if needed at the next `produceKey` invocation
16451
+ argon2Promise = loadArgonWasmModule();
16452
+ argon2Promise.catch(() => {});
16453
+ }
16454
+
16438
16455
  /**
16439
16456
  * @param {Object} [config] - Full configuration, defaults to openpgp.config
16440
16457
  */
@@ -16522,10 +16539,8 @@ var openpgp = (function (exports) {
16522
16539
  });
16523
16540
 
16524
16541
  // a lot of memory was used, reload to deallocate
16525
- if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
16526
- // it will be awaited if needed at the next `produceKey` invocation
16527
- argon2Promise = loadArgonWasmModule();
16528
- argon2Promise.catch(() => {});
16542
+ if (decodedM > Argon2S2K.ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
16543
+ Argon2S2K.reloadWasmModule();
16529
16544
  }
16530
16545
  return hash;
16531
16546
  } catch (e) {