Skip to content

fix(sdjwt): dump JsonWebKey in json mode so enums are serialized as strings - #385

Open
aksharprabhudesai wants to merge 1 commit into
google-agentic-commerce:mainfrom
aksharprabhudesai:fix/cnf-jwk-json-mode
Open

aksharprabhudesai wants to merge 1 commit into
google-agentic-commerce:mainfrom
aksharprabhudesai:fix/cnf-jwk-json-mode

Conversation

@aksharprabhudesai

Copy link
Copy Markdown

Description

In ParsedToken.cnf_jwk, jwk_model.model_dump() without mode="json" leaves enum fields like use as Python enum instances (Use.sig) rather than strings. Passing those into jwcrypto.jwk.JWK causes signature verification on delegation hops to fail with InvalidJWSSignature.

This sets mode="json" on the model_dump() call so enum values are serialized as strings, and adds test coverage for cnf_jwk and delegation hops with use="sig".

Fixes #372 🦕

@aksharprabhudesai
aksharprabhudesai requested a review from a team as a code owner October 18, 2026 07:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: A delegation hop never verifies when cnf.jwk carries "use" (ParsedToken.cnf_jwk hands jwcrypto an enum)

1 participant