fix: VPResponse.VPToken as map[string][]string per OID4VP DCQL spec#386
Merged
Conversation
Per OID4VP §6.3 with DCQL, vp_token values are arrays of Verifiable Presentations keyed by credential query ID. The previous map[string]string type caused json.Unmarshal to fail with spec-compliant wallets that send array values. - Change VPToken from map[string]string to map[string][]string - Unwrap first token from array in apigw DCQL credential query loop - Unwrap first token from array in verifier scope-based lookup - Update tests to use new type Forward-port of 5caa770 to the main-branch DCQL handler structure. Fixes SUNET#365
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the OpenID4VP DCQL vp_token response handling to align with the spec requirement that each credential query ID maps to an array of Verifiable Presentations, preventing JSON unmarshal failures from spec-compliant wallets.
Changes:
- Change
VPResponse.VPTokenfrommap[string]stringtomap[string][]string. - Update verifier and API gateway handlers to unwrap the first presentation from each
vp_tokenarray. - Update unit tests to reflect the new
VPTokentype.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/openid4vp/response_parameters.go | Updates VPResponse.VPToken to map[string][]string per OID4VP DCQL expectations. |
| pkg/openid4vp/response_parameters_additional_test.go | Adjusts VPResponse marshalling/unmarshalling test data to use array-valued map entries. |
| internal/verifier/apiv1/handlers_verification.go | Unwraps first token from vp_token arrays when mapping VP tokens to requested scopes. |
| internal/apigw/apiv1/handlers_verifier.go | Unwraps first token from vp_token arrays when selecting VP token for a DCQL credential query. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 8, 2026
Current verifier only processes the first VP token per credential query. Add Info-level log when additional tokens are present to make the limitation explicit rather than silently ignoring extras.
|
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
Per OID4VP §6.3 with DCQL,
vp_tokenvalues are arrays of Verifiable Presentations keyed by credential query ID. The previousmap[string]stringtype causedjson.Unmarshalto fail when a spec-compliant wallet sends array values, resulting in errors likefailed to unmarshal decrypted JWE.Changes
VPTokenfrommap[string]stringtomap[string][]stringinVPResponsehandlers_verifier.go)handlers_verification.go)Notes
This is the forward-port of sirosfoundation/vc@5caa7704 (already deployed in
release/sirosid/v0.5.0) to themain-branch DCQL handler structure, which uses afor _, cq := range authCtx.DCQLQuery.Credentialsloop instead of a single key lookup.Fixes #365