src: fix error handling in ExportJWKAsymmetricKey

Because call sites check IsNothing() on the return value of
ExportJWKAsymmetricKey() and ignore the boolean value if the return
value is Just (i.e., not nothing), this function must return Nothing()
instead of Just(false) when throwing a JavaScript error.

PR-URL: https://github.com/nodejs/node/pull/53767
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Tobias Nießen authored and GitHub committed 2024-07-10 20:46:33 +00:00
1 parent 345b3de602
commit 97918364f6
1 file changed
+1 -1
+1 -1
View File
@@ -505,7 +505,7 @@ Maybe<bool> ExportJWKAsymmetricKey(
case EVP_PKEY_X448: return ExportJWKEdKey(env, key, target);
}
THROW_ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE(env);
return Just(false);
return Nothing<bool>();
}
std::shared_ptr<KeyObjectData> ImportJWKAsymmetricKey(