@protontech/openpgp 5.9.0 → 5.9.1-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.9.0 - 2023-05-15 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v5.9.1-0 - 2023-08-03 - 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');
@@ -2929,7 +2929,7 @@ var config = {
2929
2929
  * @memberof module:config
2930
2930
  * @property {String} versionString A version string to be included in armored messages
2931
2931
  */
2932
- versionString: 'OpenPGP.js 5.9.0',
2932
+ versionString: 'OpenPGP.js 5.9.1-0',
2933
2933
  /**
2934
2934
  * @memberof module:config
2935
2935
  * @property {String} commentString A comment string to be included in armored messages
@@ -15997,10 +15997,12 @@ class Argon2S2K {
15997
15997
  const decodedM = 2 << (this.encodedM - 1);
15998
15998
 
15999
15999
  try {
16000
- if (!argon2Promise) { // first load
16001
- loadArgonWasmModule = loadArgonWasmModule || (await Promise.resolve().then(function () { return index; })).default;
16002
- argon2Promise = loadArgonWasmModule();
16003
- }
16000
+ // on first load, the argon2 lib is imported and the WASM module is initialized.
16001
+ // the two steps need to be atomic to avoid race conditions causing multiple wasm modules
16002
+ // being loaded when `argon2Promise` is not initialized.
16003
+ loadArgonWasmModule = loadArgonWasmModule || (await Promise.resolve().then(function () { return index; })).default;
16004
+ argon2Promise = argon2Promise || loadArgonWasmModule();
16005
+
16004
16006
  // important to keep local ref to argon2 in case the module is reloaded by another instance
16005
16007
  const argon2 = await argon2Promise;
16006
16008
 
@@ -16020,6 +16022,7 @@ class Argon2S2K {
16020
16022
  if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
16021
16023
  // it will be awaited if needed at the next `produceKey` invocation
16022
16024
  argon2Promise = loadArgonWasmModule();
16025
+ argon2Promise.catch(() => {});
16023
16026
  }
16024
16027
  return hash;
16025
16028
  } catch (e) {
@@ -44666,8 +44669,9 @@ async function wasmLoader(memory, getSIMD, getNonSIMD) {
44666
44669
  const importObject = { env: { memory } };
44667
44670
  if (isSIMDSupported === undefined) {
44668
44671
  try {
44669
- isSIMDSupported = true; // will be overwritten in the catch
44670
- return await getSIMD(importObject);
44672
+ const loaded = await getSIMD(importObject);
44673
+ isSIMDSupported = true;
44674
+ return loaded;
44671
44675
  } catch(e) {
44672
44676
  isSIMDSupported = false;
44673
44677
  }
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.9.0",
4
+ "version": "5.9.1-0",
5
5
  "license": "LGPL-3.0+",
6
6
  "homepage": "https://openpgpjs.org/",
7
7
  "engines": {
@@ -66,7 +66,7 @@
66
66
  "@rollup/plugin-replace": "^2.3.2",
67
67
  "@rollup/plugin-wasm": "^6.1.2",
68
68
  "@types/chai": "^4.2.14",
69
- "argon2id": "^1.0.0",
69
+ "argon2id": "^1.0.1",
70
70
  "benchmark": "^2.1.4",
71
71
  "bn.js": "^4.11.8",
72
72
  "chai": "^4.3.6",