Skip to content

fix(web-client): decode every hop of a dSD-JWT delegation chain - #351

Open
maxcabd wants to merge 1 commit into
google-agentic-commerce:mainfrom
maxcabd:fix/web-client-sdjwt-chain-decode
Open

fix(web-client): decode every hop of a dSD-JWT delegation chain#351
maxcabd wants to merge 1 commit into
google-agentic-commerce:mainfrom
maxcabd:fix/web-client-sdjwt-chain-decode

Conversation

@maxcabd

@maxcabd maxcabd commented Sep 6, 2026

Copy link
Copy Markdown

A display bug in the sample UI.

sdJwtDecoder.ts splits on a single ~ before checking for the ~~ chain separator used by delegation chains. When a token is a real chain, which is common for Checkout and Payment mandates, this misreads the second hop as a trailing KB JWT and drops that hop's disclosures.

The fix splits on ~~ first and decodes each hop on its own. DecodedSdJwt now has an optional hops field with one entry per hop. The existing issuerJwt, disclosures, and kbJwt fields still describe hop 0, so MandateCard.tsx and any other caller keep working without changes. Confirmed with tsc --noEmit.

Added vitest, since this package didn't have a test runner, and a test using a real two hop chain from the Python SDK. The test fails on the old code and passes after the fix.

@maxcabd
maxcabd requested a review from a team as a code owner September 6, 2026 18:08
@maxcabd
maxcabd force-pushed the fix/web-client-sdjwt-chain-decode branch from 8f843b9 to e7182b8 Compare September 6, 2026 18:11
@maxcabd
maxcabd force-pushed the fix/web-client-sdjwt-chain-decode branch from e7182b8 to 6fcd85d Compare September 6, 2026 18:13
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.

1 participant