Skip to content

fix: ClaimsExtractor DCQL response type to map[string][]string#6

Merged
s-jairl merged 1 commit into
release/sirosid/v0.5.0from
fix/claims-extractor-dcql-array-v050
May 11, 2026
Merged

fix: ClaimsExtractor DCQL response type to map[string][]string#6
s-jairl merged 1 commit into
release/sirosid/v0.5.0from
fix/claims-extractor-dcql-array-v050

Conversation

@leifj
Copy link
Copy Markdown
Collaborator

@leifj leifj commented May 8, 2026

Summary

PR #5 correctly changed VPResponse.VPToken from map[string]string to map[string][]string, but the ClaimsExtractor.extractClaimsFromDCQLResponse was not updated to match. When a spec-compliant wallet sends DCQL array values, json.Unmarshal fails with:

json: cannot unmarshal array into Go value of type string

Changes

  • Change dcqlResponse from map[string]string to map[string][]string
  • Iterate over all tokens per credential query ID
  • Add empty-array guard
  • Add tests for DCQL array format acceptance/rejection

Affected code paths

The OIDC handler (handler_oidc.go) and OpenID4VP direct-post handler (handler_openid4vp.go) both pass raw DCQL JSON to extractAndMapClaimsExtractClaimsFromVPTokenextractClaimsFromDCQLResponse, hitting this bug.

The verifier handler (handlers_verification.go) is not affected because it unwraps vpTokens[0] before calling the claims extractor.

OID4VP §6.3 DCQL vp_token values are arrays of presentations, not
single strings. The extractClaimsFromDCQLResponse function used
map[string]string which caused json.Unmarshal to fail with:
  cannot unmarshal array into Go value of type string

Change dcqlResponse to map[string][]string and iterate over all
tokens per credential query ID. Add empty-array guard and tests.

Fixes the claims extraction path used by OIDC and OpenID4VP
direct-post handlers that pass raw DCQL JSON to
ExtractClaimsFromVPToken.
@s-jairl s-jairl merged commit c3dffed into release/sirosid/v0.5.0 May 11, 2026
2 checks passed
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.

2 participants