Skip to content

Commit

Permalink
src: fix error handling in ExportJWKAsymmetricKey
Browse files Browse the repository at this point in the history
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: #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>
  • Loading branch information
tniessen authored and marco-ippolito committed Aug 19, 2024
1 parent 2a2620e commit 0c24b91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/crypto/crypto_keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 0c24b91

Please sign in to comment.