X Tutup
The Wayback Machine - https://web.archive.org/web/20230222012221/https://github.com/nodejs/node/commit/1e4a2bcbee
Skip to content
Permalink
Browse files
crypto: remove check for condition that is always true
The value of `key` will always be `!= null` because earlier in the
function, `ERR_CRYPTO_SIGN_KEY_REQUIRED` is thrown if `key` is falsy.
Remove condition that subsequently checks that `key != null`.

PR-URL: #38072
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and jasnell committed Apr 6, 2021
1 parent 78b6f38 commit 1e4a2bc
Showing 1 changed file with 1 addition and 1 deletion.
@@ -177,7 +177,7 @@ function signOneShot(algorithm, data, key, callback) {
let keyData;
if (isKeyObject(key) || isCryptoKey(key)) {
({ data: keyData } = preparePrivateKey(key));
} else if (key != null && (isKeyObject(key.key) || isCryptoKey(key.key))) {
} else if (isKeyObject(key.key) || isCryptoKey(key.key)) {
({ data: keyData } = preparePrivateKey(key.key));
} else {
keyData = createPrivateKey(key)[kHandle];

0 comments on commit 1e4a2bc

Please sign in to comment.
X Tutup