Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42aca13

Browse filesBrowse files
jasnelldanielleadams
authored andcommitted
crypto: fixup bug in keygen error handling
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #36779 Refs: #36729 Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 4c819d6 commit 42aca13
Copy full SHA for 42aca13

File tree

Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Open diff view settings
Collapse file

‎lib/internal/crypto/keygen.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/keygen.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ function generateKeyPairSync(type, options) {
9494
}
9595

9696
function handleError(ret) {
97-
if (ret === undefined)
97+
if (ret == null)
9898
return; // async
9999

100-
const [err, [publicKey, privateKey]] = ret;
100+
const [err, keys] = ret;
101101
if (err !== undefined)
102102
throw err;
103103

104+
const [publicKey, privateKey] = keys;
105+
104106
// If no encoding was chosen, return key objects instead.
105107
return {
106108
publicKey: wrapKey(publicKey, PublicKeyObject),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.