Skip to content

Make wallet_did optional in request-credential API#4390

Open
reinkrul wants to merge 2 commits into
masterfrom
issue/4365-optional-wallet-did
Open

Make wallet_did optional in request-credential API#4390
reinkrul wants to merge 2 commits into
masterfrom
issue/4365-optional-wallet-did

Conversation

@reinkrul

@reinkrul reinkrul commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

  • wallet_did is now optional in POST /internal/auth/v2/{subjectID}/request-credential. When provided, behavior is unchanged (validated against the subject's DIDs). When omitted, it defaults to the subject's sole did:web DID, and fails with a 400 InvalidInputError if the subject has zero or multiple did:web DIDs.
  • Adds Wrapper.subjectWebDID in auth/api/iam/api.go, filtering ListDIDs to did:web and enforcing exactly one match.
  • Regenerated auth/api/iam/generated.go and e2e-tests/browser/client/iam/generated.go from the updated docs/_static/auth/v2.yaml.

Fixes #4365

Test plan

  • go build ./...
  • go test ./auth/...
  • New tests: omitted wallet_did with a sole did:web DID (success), with multiple did:web DIDs (400), with zero did:web DIDs (400)
  • TestWrapper_subjectWebDID unit tests for the new helper

Assisted by AI

v2 API consumers (EHRs) operate on subjects, not DIDs, so requiring
wallet_did forces an extra round-trip just to pick a DID to pass back
in. When omitted, wallet_did now defaults to the subject's sole
did:web DID; it fails loud with a 400 if the subject has zero or
multiple did:web DIDs.

Fixes #4365

Assisted by AI
@qltysh

qltysh Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

1 new issue

Tool Category Rule Count
qlty Structure Function with many returns (count = 16): RequestOpenid4VCICredentialIssuance 1

@qltysh

qltysh Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on master by 0.01%.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
auth/api/iam/openid4vci.go74.1%54-55, 57, 59-60, 65-66
Total74.1%
🤖 Increase coverage with AI coding...
In the `issue/4365-optional-wallet-did` branch, add test coverage for this new code:

- `auth/api/iam/openid4vci.go` -- Lines 54-55, 57, 59-60, and 65-66

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

…suance

subjectWebDID looked like a general-purpose helper next to subjectOwns/
determineClientDID, but it's only ever used by (and only makes sense
for) this one call site, including its error message.

Assisted by AI
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.

OpenID4VCI: make wallet_did optional in RequestCredential, default to the subject's did:web

1 participant