feat: add PEX support for OID4VP presentations - #370
Open
romitshah02 wants to merge 2 commits into
Open
romitshah02 wants to merge 2 commits into
romitshah02 wants to merge 2 commits into
Conversation
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.
Description
Adds DIF Presentation Exchange (PEX) v2.0 support to
oid4vc-service's OID4VP verifier flow, as an alternative query language to the existing DCQL-only implementation. Enables live VP round trips against wallets (e.g. Inji) that implement PEX but not DCQL. Also fixes real holder-binding and key-selection bugs surfaced by testing against a live wallet, and addsJsonWebSignature2020proof verification + localdid:jwkresolution tocredentials-service.Type of Change
Microservice(s) Affected
oid4vc-servicecredentials-serviceChanges
oid4vc-service— PEX support:PexService(pex.service.ts): full DIF PEX v2.0 evaluator —input_descriptors[].constraints.fieldspath/filter matching, format restriction,submission_requirements(pick/all,from/from_nested)jsonpath.util.ts: minimal JSONPath subset (dot/bracket segments, numeric indices) used by bothPexServiceand descriptor-map resolutionoid4vp.service.ts:VpTxn.queryMode: 'dcql' | 'pex'— request acceptspresentation_definitionas a mutually-exclusive alternative todcql_query;submitResponse()branches per mode; per-credential verification extracted into a sharedverifyPresentationEntry()used by both DCQL and PEX loopsresolveDescriptorMapEntry(): resolvesdescriptor_map[].path/path_nestedchains against the wallet'svp_tokennormalizePexVpToken(): absorbs PEX'svp_tokenshape (raw presentation, not always JSON, unlike DCQL's always-object shape)Bug fixes (found via live wallet testing):
resolveDescriptorMapEntry()no longer descends intopath_nestedwhen the outer format isldp_vp— descending discarded the outer VP's holder-binding proof and exposed only the embedded VC's static issuance-time proof#fragment(did:jwk:...#0vs the bare DID) before comparing tocredentialSubject.idoid4vci.service.ts: issuer metadata now advertisesEdDSAinproof_types_supported.jwt.proof_signing_alg_values_supported(previouslyES256only) — some wallets hardcode Ed25519 for presentation-signing independent of their issuance-time key selection, so the issuer must advertise EdDSA for that key to ever be selectable at issuancecredentials-service:verifyCredential()dispatches to a newverifyPresentation()path whentypeincludesVerifiablePresentation, instead of only ever treating the body as a bare VCjws2020.util.ts: hand-rolledJsonWebSignature2020Linked-Data proof verifier (URDNA2015 canonicalization + detached JWS per RFC7797) — no installed suite covers this proof typeself-contained-did.util.ts: localdid:jwkresolution (public key is the DID's own base64url JWK payload, no network lookup)Notes
DcqlService's existing non-library approachpresentation_definitionis an additive, mutually-exclusive alternative field on the existingPOST /vp/requestbodyqr_datalink is now returned by-value instead of always by-reference; issued VC@contextnow rewritesinternalUrl→publicUrlfor all issuance;ldp_vcplain-VP-object holder binding is stricter (credentialSubject.idmust equal the VP'sholder, not merely exist)