Skip to content

Commit

Permalink
Fix floating promise rejection
Browse files Browse the repository at this point in the history
  • Loading branch information
larabr committed Aug 3, 2023
1 parent add9046 commit 373928c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/type/s2k/argon2.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Argon2S2K {
try {
// on first load, the argon2 lib is imported and the WASM module is initialized.
// the two steps need to be atomic to avoid race conditions causing multiple wasm modules
// to be loaded when `argon2Promise` is not initialized.
// being loaded when `argon2Promise` is not initialized.
loadArgonWasmModule = loadArgonWasmModule || (await import('argon2id')).default;
argon2Promise = argon2Promise || loadArgonWasmModule();

Expand All @@ -116,6 +116,7 @@ class Argon2S2K {
if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
// it will be awaited if needed at the next `produceKey` invocation
argon2Promise = loadArgonWasmModule();
argon2Promise.catch(() => {});
}
return hash;
} catch (e) {
Expand Down

0 comments on commit 373928c

Please sign in to comment.