#4088: CredentialSelector extension point in PD matcher#4098
#4088: CredentialSelector extension point in PD matcher#4098stevenvegt wants to merge 4 commits intofeature/4067-credential-selection-dcqlfrom
Conversation
Introduces CredentialSelector function type and FirstMatchSelector. Refactors matchConstraints to collect all matching VCs per input descriptor, then call the selector to pick one. Match delegates to MatchWithSelector with FirstMatchSelector. No behavior change — all existing tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds SetCredentialSelector method to configure a custom CredentialSelector on the builder. Build passes it through to MatchWithSelector. Falls back to FirstMatchSelector when not set. Tests verify: custom selector picks non-first credential, default behavior preserved, selector receives all matching candidates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CredentialSelector doc now describes return value semantics: when to return nil (unfulfilled), ErrNoCredentials (no match), or ErrMultipleCredentials (ambiguous). Adds error propagation test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 new issues
|
|
Coverage Impact ⬇️ Merging this pull request will decrease total coverage on Modified Files with Diff Coverage (2)
🛟 Help
|
Review finding:
|
…bility When a CredentialSelector returns ErrNoCredentials, treat it as a nil selection (unfulfilled descriptor) instead of a hard failure. This allows submission requirements with pick rules (e.g., min: 0) to evaluate whether zero fulfilled descriptors is acceptable. ErrMultipleCredentials and other errors remain hard failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Summary
CredentialSelectorfunction type invcr/pefor pluggable credential selectionFirstMatchSelectoras the default (preserves existing behavior)matchConstraintsto collect all matching VCs per input descriptor, then call the selectorMatchWithSelectortoPresentationDefinition—Matchdelegates to it withFirstMatchSelectorSetCredentialSelectortoPresentationSubmissionBuilder—Builduses it when setErrMultipleCredentialserror for selectors that enforce strict matchingCredentialSelectorcontract (nil vs error return semantics)Closes #4088
Part of #4067
Usage example
Without
SetCredentialSelector, the builder usesFirstMatchSelectorwhich picks the first matching credential per input descriptor — identical to the previous behavior.Test plan