@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.
package/dist/openpgp.mjs 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
  const globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3
3
 
4
4
  const doneWritingPromise = Symbol('doneWritingPromise');
@@ -2950,7 +2950,7 @@ var config = {
2950
2950
  * @memberof module:config
2951
2951
  * @property {String} versionString A version string to be included in armored messages
2952
2952
  */
2953
- versionString: 'OpenPGP.js 5.11.1',
2953
+ versionString: 'OpenPGP.js 5.11.2-0',
2954
2954
  /**
2955
2955
  * @memberof module:config
2956
2956
  * @property {String} commentString A comment string to be included in armored messages
@@ -16429,9 +16429,26 @@ class Argon2OutOfMemoryError extends Error {
16429
16429
  let loadArgonWasmModule;
16430
16430
  let argon2Promise;
16431
16431
  // reload wasm module above this treshold, to deallocated used memory
16432
- const ARGON2_WASM_MEMORY_THRESHOLD_RELOAD = 2 << 19;
16432
+ // (cannot be declared as a simple `static` field as its not supported by Safari 14)
16433
+ let ARGON2_WASM_MEMORY_THRESHOLD_RELOAD = 2 << 19;
16433
16434
 
16434
16435
  class Argon2S2K {
16436
+ static get ARGON2_WASM_MEMORY_THRESHOLD_RELOAD() {
16437
+ return ARGON2_WASM_MEMORY_THRESHOLD_RELOAD;
16438
+ }
16439
+
16440
+ static set ARGON2_WASM_MEMORY_THRESHOLD_RELOAD(memoryThreshold) {
16441
+ ARGON2_WASM_MEMORY_THRESHOLD_RELOAD = memoryThreshold;
16442
+ }
16443
+
16444
+ static reloadWasmModule() {
16445
+ if (!loadArgonWasmModule) return;
16446
+
16447
+ // it will be awaited if needed at the next `produceKey` invocation
16448
+ argon2Promise = loadArgonWasmModule();
16449
+ argon2Promise.catch(() => {});
16450
+ }
16451
+
16435
16452
  /**
16436
16453
  * @param {Object} [config] - Full configuration, defaults to openpgp.config
16437
16454
  */
@@ -16519,10 +16536,8 @@ class Argon2S2K {
16519
16536
  });
16520
16537
 
16521
16538
  // a lot of memory was used, reload to deallocate
16522
- if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
16523
- // it will be awaited if needed at the next `produceKey` invocation
16524
- argon2Promise = loadArgonWasmModule();
16525
- argon2Promise.catch(() => {});
16539
+ if (decodedM > Argon2S2K.ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
16540
+ Argon2S2K.reloadWasmModule();
16526
16541
  }
16527
16542
  return hash;
16528
16543
  } catch (e) {
package/openpgp.d.ts CHANGED
@@ -925,6 +925,8 @@ export namespace enums {
925
925
  }
926
926
 
927
927
  export declare class Argon2S2K {
928
+ static reloadWasmModule(): void;
929
+ static ARGON2_WASM_MEMORY_THRESHOLD_RELOAD: number;
928
930
  constructor(config: Config);
929
931
  salt: Uint8Array;
930
932
  /** @throws Argon2OutOfMemoryError */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@protontech/openpgp",
3
3
  "description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
4
- "version": "5.11.1",
4
+ "version": "5.11.2-0",
5
5
  "license": "LGPL-3.0+",
6
6
  "homepage": "https://openpgpjs.org/",
7
7
  "engines": {