Skip to content

DCQL credential query parser with claims/values matching #4087

Closed

Description

@stevenvegt

Parent PRD

#4067 (see PRD comment)

What to build

Standalone DCQL credential query parser that evaluates DCQL credential queries (OpenID4VP sections 6.1/6.3/7) against a list of Verifiable Credentials and returns matching VCs.

Interface: takes a DCQL credential query object and a list of VCs, returns the subset that matches (or an error for invalid queries).

Spec compliance

This implements a subset of the DCQL specification (OpenID4VP 1.0 sections 6 and 7). The supported and unsupported features are documented in the package.

Credential Query (section 6.1) — supported fields:

  • id (REQUIRED): validated per spec (non-empty, alphanumeric/underscore/hyphen only)
  • claims (OPTIONAL): array of claims queries

Credential Query — not supported (not needed for our use case):

  • format: credential format selection is handled by PD matching
  • meta: credential metadata constraints are handled by PD matching
  • multiple: we use match_policy in the filter chain instead
  • claim_sets: not needed for our value-matching use case
  • trusted_authorities: trust is handled by PD matching and DID resolution
  • require_cryptographic_holder_binding: handled by VP verification

Claims Query (section 6.3) — supported fields:

  • path (REQUIRED): Claims Path Pointer per section 7 (strings, integers, null)
  • values (OPTIONAL): exact value matching with OR semantics

Claims Query — not supported:

  • id: only needed when claim_sets is used
  • claim_sets on the credential query: not needed

Claims Path Pointer (section 7) — supported:

  • String elements: key lookup in JSON objects
  • Non-negative integer elements: array index lookup
  • Null elements: wildcard, selects all elements of an array
  • Path starts at the credential root (not scoped to credentialSubject)

Implementation details

  • Exact value matching via values parameter (strings, integers, booleans)
  • OR semantics when multiple values are specified (match if any value matches)
  • Multiple claims entries in a single query (AND semantics — all must match)
  • Path resolution supports the full credential JSON (root-level fields like type, issuer, as well as nested credentialSubject fields)
  • credentialSubject is unwrapped from its Go array representation to a single object for ergonomic path access

No integration with PD matching, wallet, or API yet — this is purely the matching engine.

See "DCQL Support" and "DCQL credential query parser" in the PRD for full context.

Acceptance criteria

  • Parses DCQL credential query objects with id and claims array
  • Validates id per spec: non-empty, alphanumeric/underscore/hyphen characters only
  • Returns error for invalid credential query (empty or invalid id)
  • Path resolution starts at the credential root, supporting top-level fields (type, issuer, etc.)
  • Path supports string elements (key lookup in objects)
  • Path supports non-negative integer elements (array index lookup)
  • Path supports null elements (wildcard: select all array elements)
  • Matches values with exact equality for strings, integers, and booleans
  • Multiple values in a single claim query use OR semantics
  • Multiple claims entries use AND semantics
  • Returns all matching VCs from the input list
  • Returns empty list (not error) when no VCs match
  • Handles edge cases: missing fields in credential, empty claims array, deeply nested paths
  • Supported DCQL subset is documented in the package
  • Unit tests covering all of the above
  • Benchmark: ~14ms worst case for 2000 credentials

Blocked by

None.

User stories addressed

  • User story 7: standard DCQL syntax
  • User story 10: exact value matching on claim fields
  • User story 11: multiple values with OR semantics

Activity

  1. added 15 commits that reference this issue on Mar 23, 2026
  2. linked a pull request that will close this issue#4087: DCQL credential query parser #4091on Mar 23, 2026
  3. added 6 commits that reference this issue on Mar 24, 2026
  4. reinkrul commented on Mar 25, 2026

    @reinkrul
    Member

    Alternative approach:

    • build subject (attestation) VP
    • extract values with PD
    • supplement client_attestation with extracted values
    • build client attestation

    Don't know if that order always works in all cases, but it does for the DelegationCredential. Because if you know which care organization it's about, you then know which DelegationCredential you need for the
    client attestation.

    (so through parameterization of the PD, essentially the same as with this proposal:

    "credential_selection": { "patient_id": "123456789" }

    the principle would also work with DCQL by the way)"

  5. stevenvegt commented on Mar 25, 2026

    @stevenvegt
    MemberAuthor

    Yes, the credential_selection route is simpler for the use and doesn't require a DCQL parser. Too bad, I liked this implementation. But we can close this one.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions