Skip to content

Commit

Permalink
fix: swallow promisified crypto.verify errors
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Apr 29, 2021
1 parent 7b1d98b commit d512ede
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/runtime/node/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ const verify: VerifyFunction = async (alg, key: unknown, signature, data) => {
const keyObject = getVerifyKey(alg, key, 'verify')
const keyInput = nodeKey(alg, keyObject)
try {
return oneShotVerify(algorithm, data, keyInput, signature)
let result = oneShotVerify(algorithm, data, keyInput, signature)
// @ts-expect-error
if (result instanceof Promise) {
result = await result;
}
return result
} catch {
return false
}
Expand Down

0 comments on commit d512ede

Please sign in to comment.