Conversation
Ryanmtate
reviewed
Feb 17, 2026
Ryanmtate
approved these changes
Feb 17, 2026
Add comment verifying why unwrap is acceptable in this case Co-authored-by: Ryan Tate <ryan.tate@spruceid.com>
Ryanmtate
reviewed
Feb 17, 2026
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.
Summary
Fixes double-encoding of JWT credential payloads for
jwt_vc_jsonandjwt_vc_json-ldformats inRawCredential::from_oid4vci.The
StandardFormat::W3carm was callingserde_json::to_vec(&credential.value)to produce the payload bytes. When the credential value is aserde_json::Value::String(which it is forjwt_vc_jsonandjwt_vc_json-ld), this JSON-encodes the string again, wrapping the raw JWT bytes in literal"characters. This causes aFormatException: Invalid base64 dataerror on the client side when attempting to decode the JWT.The other string-based format arms (
DcSdJwt,MsoMdoc,vc+sd-jwt) already handle this correctly by extracting the inner string with pattern matching before calling.into_bytes(). This PR applies the same pattern to theW3carm, while preserving theserde_json::to_vecpath forldp_vcwhere the credential value is a JSON object.Bug introduced in ecf7eb2 ("Migrate OID4VCI 1.0 (#269)").
Changes
rust/src/oid4vci/credential.rs: Extract string values before converting to bytes in theW3carm, matching the pattern used by all other string-based formatsrust/src/tests.rs: Add regression tests forjwt_vc_json,jwt_vc_json-ld, andldp_vcpayload encoding