@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.
@@ -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
  import buffer from 'buffer';
@@ -2935,7 +2935,7 @@ var config = {
2935
2935
  * @memberof module:config
2936
2936
  * @property {String} versionString A version string to be included in armored messages
2937
2937
  */
2938
- versionString: 'OpenPGP.js 5.9.0',
2938
+ versionString: 'OpenPGP.js 5.9.1-0',
2939
2939
  /**
2940
2940
  * @memberof module:config
2941
2941
  * @property {String} commentString A comment string to be included in armored messages
@@ -16009,10 +16009,12 @@ class Argon2S2K {
16009
16009
  const decodedM = 2 << (this.encodedM - 1);
16010
16010
 
16011
16011
  try {
16012
- if (!argon2Promise) { // first load
16013
- loadArgonWasmModule = loadArgonWasmModule || (await Promise.resolve().then(function () { return index; })).default;
16014
- argon2Promise = loadArgonWasmModule();
16015
- }
16012
+ // on first load, the argon2 lib is imported and the WASM module is initialized.
16013
+ // the two steps need to be atomic to avoid race conditions causing multiple wasm modules
16014
+ // being loaded when `argon2Promise` is not initialized.
16015
+ loadArgonWasmModule = loadArgonWasmModule || (await Promise.resolve().then(function () { return index; })).default;
16016
+ argon2Promise = argon2Promise || loadArgonWasmModule();
16017
+
16016
16018
  // important to keep local ref to argon2 in case the module is reloaded by another instance
16017
16019
  const argon2 = await argon2Promise;
16018
16020
 
@@ -16032,6 +16034,7 @@ class Argon2S2K {
16032
16034
  if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
16033
16035
  // it will be awaited if needed at the next `produceKey` invocation
16034
16036
  argon2Promise = loadArgonWasmModule();
16037
+ argon2Promise.catch(() => {});
16035
16038
  }
16036
16039
  return hash;
16037
16040
  } catch (e) {
@@ -44678,8 +44681,9 @@ async function wasmLoader(memory, getSIMD, getNonSIMD) {
44678
44681
  const importObject = { env: { memory } };
44679
44682
  if (isSIMDSupported === undefined) {
44680
44683
  try {
44681
- isSIMDSupported = true; // will be overwritten in the catch
44682
- return await getSIMD(importObject);
44684
+ const loaded = await getSIMD(importObject);
44685
+ isSIMDSupported = true;
44686
+ return loaded;
44683
44687
  } catch(e) {
44684
44688
  isSIMDSupported = false;
44685
44689
  }
package/dist/openpgp.js 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
  var openpgp = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -2932,7 +2932,7 @@ var openpgp = (function (exports) {
2932
2932
  * @memberof module:config
2933
2933
  * @property {String} versionString A version string to be included in armored messages
2934
2934
  */
2935
- versionString: 'OpenPGP.js 5.9.0',
2935
+ versionString: 'OpenPGP.js 5.9.1-0',
2936
2936
  /**
2937
2937
  * @memberof module:config
2938
2938
  * @property {String} commentString A comment string to be included in armored messages
@@ -16000,10 +16000,12 @@ var openpgp = (function (exports) {
16000
16000
  const decodedM = 2 << (this.encodedM - 1);
16001
16001
 
16002
16002
  try {
16003
- if (!argon2Promise) { // first load
16004
- loadArgonWasmModule = loadArgonWasmModule || (await Promise.resolve().then(function () { return index; })).default;
16005
- argon2Promise = loadArgonWasmModule();
16006
- }
16003
+ // on first load, the argon2 lib is imported and the WASM module is initialized.
16004
+ // the two steps need to be atomic to avoid race conditions causing multiple wasm modules
16005
+ // being loaded when `argon2Promise` is not initialized.
16006
+ loadArgonWasmModule = loadArgonWasmModule || (await Promise.resolve().then(function () { return index; })).default;
16007
+ argon2Promise = argon2Promise || loadArgonWasmModule();
16008
+
16007
16009
  // important to keep local ref to argon2 in case the module is reloaded by another instance
16008
16010
  const argon2 = await argon2Promise;
16009
16011
 
@@ -16023,6 +16025,7 @@ var openpgp = (function (exports) {
16023
16025
  if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
16024
16026
  // it will be awaited if needed at the next `produceKey` invocation
16025
16027
  argon2Promise = loadArgonWasmModule();
16028
+ argon2Promise.catch(() => {});
16026
16029
  }
16027
16030
  return hash;
16028
16031
  } catch (e) {
@@ -44669,8 +44672,9 @@ var openpgp = (function (exports) {
44669
44672
  const importObject = { env: { memory } };
44670
44673
  if (isSIMDSupported === undefined) {
44671
44674
  try {
44672
- isSIMDSupported = true; // will be overwritten in the catch
44673
- return await getSIMD(importObject);
44675
+ const loaded = await getSIMD(importObject);
44676
+ isSIMDSupported = true;
44677
+ return loaded;
44674
44678
  } catch(e) {
44675
44679
  isSIMDSupported = false;
44676
44680
  }