Repository navigation
Conversation
arckoor
reviewed
Oct 4, 2026
arckoor
left a comment
Collaborator
There was a problem hiding this comment.
Looks mostly fine, a few nits and needs a rebase to master. Obviously breaking, but should hopefully be mergeable without major conflicts when the time comes.
The five fn pointers in KeyUtils already return Result. new_unimplemented filled them with stubs that panic. A provider that opts out of JWK support is configured correctly. Whether a caller hits a stub depends on the key passed at runtime, so the stubs return ErrorKind::Provider. The message is UNIMPLEMENTED_ERROR: "This CryptoProvider does not support JWKs". After Keats#540, new_unimplemented has no callers inside the crate.
SebTardif
force-pushed
the
fix/jwk-utils-return-error
branch
from
October 4, 2026 14:59
8054b91 to
bf5f17f
Compare
SebTardif
marked this pull request as ready for review
October 4, 2026 15:00
The first rustdoc sentence says the stubs return ErrorKind::Provider. The short "Use this if" sentence stays. The paragraph about how Result works stays out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebased onto current master after #540 merged (
bf5f17f). Follow-up4c15dc7puts theErrorKind::Providersentence back. The doc is that line, then "Use this if your [CryptoProvider] does not support JWKs." The paragraph about howResultworks stays out. The stub returnsErrorKind::ProviderwithUNIMPLEMENTED_ERRORset to "This CryptoProvider does not support JWKs".The change
The five fn pointers in
KeyUtilsall returnResult:new_unimplementedfilled them with stubs that panic instead. The error channel already exists; the stubs were throwing it away. This makes them returnErrorKind::Provider, the variant that already exists for exactly this ("Custom provider error: …").Why this one isn't the same as #540
I argued for returning an error in #540 and was wrong: a missing process-level provider is a static configuration error, there is nothing to do at the call site, and panicking is right.
This is a different situation, and the distinction is whether the failure is decided by
Cargo.tomlor by runtime data:Jwk::from_encoding_keywith an RSA key hitsrsa_pub_components_from_private_key; the same call with an HMAC key never does, because that arm returns early. So the same correct configuration succeeds or fails depending on the input.Cargo.toml".This reads to me like the same line drawn in #524, where
thumbprintstopped panicking on a curve/parameter mismatch and returnedErrorKind::InvalidKeyFormat. Tell me if I'm reading that wrong.Interaction with #540
Before #540,
new_unimplementedhad two callers with very different meanings: the crate's own placeholder provider (a config error) and user-supplied providers (a runtime condition). One message had to cover both, which is why it currently reads:#540 removes the placeholder, leaving no callers inside the crate. The advice about crate features and
install_defaultthen has nothing to do with why the stub fires, and the only consumer left is a user's own provider. That is why this is worth doing after #540 and not before — onmasterit would change the no-provider path back to an error, which is the thing we just agreed not to do.Validation
cargo test --features aws_lc_rscargo test --features rust_cryptocargo test --features aws_lc_rs --test unimplemented_jwkcargo clippy --all-targets -- -D warnings, all three configscargo fmt --check