Skip to content

Commit

Permalink
crypto: remove check for condition that is always true
Browse files Browse the repository at this point in the history
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.
2 changes: 1 addition & 1 deletion lib/internal/crypto/sig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 1e4a2bc

Please sign in to comment.