Make wallet_did optional in request-credential API#4390
Open
reinkrul wants to merge 2 commits into
Open
Conversation
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
Contributor
1 new issue
|
Contributor
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (1)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
…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
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.

Summary
wallet_didis now optional inPOST /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 soledid:webDID, and fails with a 400InvalidInputErrorif the subject has zero or multipledid:webDIDs.Wrapper.subjectWebDIDinauth/api/iam/api.go, filteringListDIDstodid:weband enforcing exactly one match.auth/api/iam/generated.goande2e-tests/browser/client/iam/generated.gofrom the updateddocs/_static/auth/v2.yaml.Fixes #4365
Test plan
go build ./...go test ./auth/...wallet_didwith a sole did:web DID (success), with multiple did:web DIDs (400), with zero did:web DIDs (400)TestWrapper_subjectWebDIDunit tests for the new helperAssisted by AI