Skip to content

Commit

Permalink
fix(node): crypto.verify callback invocation with a private keyobject
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Mar 26, 2021
1 parent 39b5bbe commit d3d4acd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/runtime/node/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ import nodeKey from './node_key.js'
import sign from './sign.js'
import { isCryptoKey, getKeyObject } from './webcrypto.js'

const [major, minor] = process.version
.substr(1)
.split('.')
.map((str) => parseInt(str, 10))

const oneShotCallbackSupported = major >= 16 || (major === 15 && minor >= 13)

let oneShotVerify = crypto.verify
if (oneShotVerify.length > 4) {
if (oneShotVerify.length > 4 && oneShotCallbackSupported) {
// @ts-expect-error
oneShotVerify = promisify(oneShotVerify)
}
Expand Down

0 comments on commit d3d4acd

Please sign in to comment.