mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
crypto: fixup bug in keygen error handling
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/36779 Refs: https://github.com/nodejs/node/pull/36729 Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
1 file changed
+4
-2
@@ -94,13 +94,15 @@ function generateKeyPairSync(type, options) {
|
||||
}
|
||||
|
||||
function handleError(ret) {
|
||||
if (ret === undefined)
|
||||
if (ret == null)
|
||||
return; // async
|
||||
|
||||
const [err, [publicKey, privateKey]] = ret;
|
||||
const [err, keys] = ret;
|
||||
if (err !== undefined)
|
||||
throw err;
|
||||
|
||||
const [publicKey, privateKey] = keys;
|
||||
|
||||
// If no encoding was chosen, return key objects instead.
|
||||
return {
|
||||
publicKey: wrapKey(publicKey, PublicKeyObject),
|
||||
|
||||
Reference in new issue
Block a user