From e8c66f92a5630f301439735701a8e4ec1eb7dd7d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 17 Jul 2022 21:49:16 -0700 Subject: [PATCH] crypto: remove unneeded guard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit createCFRGRaw() will always return an object. The error for an undefined return value will never occur. PR-URL: https://github.com/nodejs/node/pull/43856 Reviewed-By: Tobias Nießen Reviewed-By: Filip Skokan Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Luigi Pinca --- lib/internal/crypto/cfrg.js | 2 -- lib/internal/crypto/keys.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/internal/crypto/cfrg.js b/lib/internal/crypto/cfrg.js index 6910aa84134a57..ba39bc117b89ff 100644 --- a/lib/internal/crypto/cfrg.js +++ b/lib/internal/crypto/cfrg.js @@ -291,8 +291,6 @@ async function cfrgImportKey( case 'raw': { verifyAcceptableCfrgKeyUse(name, 'public', usagesSet); keyObject = createCFRGRawKey(name, keyData, true); - if (keyObject === undefined) - throw lazyDOMException('Unable to import CFRG key', 'OperationError'); break; } } diff --git a/lib/internal/crypto/keys.js b/lib/internal/crypto/keys.js index 5d00727813250a..881cf00f051fcd 100644 --- a/lib/internal/crypto/keys.js +++ b/lib/internal/crypto/keys.js @@ -85,7 +85,7 @@ for (const m of [[kKeyEncodingPKCS1, 'pkcs1'], [kKeyEncodingPKCS8, 'pkcs8'], encodingNames[m[0]] = m[1]; // Creating the KeyObject class is a little complicated due to inheritance -// and that fact that KeyObjects should be transferrable between threads, +// and the fact that KeyObjects should be transferrable between threads, // which requires the KeyObject base class to be implemented in C++. // The creation requires a callback to make sure that the NativeKeyObject // base class cannot exist without the other KeyObject implementations.