Repository navigation
feat(resource): add Verifier.IssueDPoPNonce - #693
Merged
Merged
Conversation
A resource server can hand out a DPoP nonce ahead of a request, not only in answer to one: OpenID4VCI 1.0 §7.2 lets the Credential Issuer's Nonce Response carry one in its DPoP-Nonce header, for the Wallet to use at the Credential Endpoint. The nonce must come from the store the Credential Endpoint's Verifier checks, and only Verify could issue one. IssueDPoPNonce issues a fresh nonce the Verifier will accept. It returns "" and no error when Dependencies.Nonces is nil. Its doc notes that called from an endpoint anyone may call, it lets anyone add records, as that endpoint's own c_nonce does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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.



Adds
(*resource.Verifier).IssueDPoPNonce(ctx), the issuer-side counterpart of #691. This is an additive API.Why
OpenID4VCI 1.0 §7.2 lets a Credential Issuer's Nonce Response carry a
DPoP-Nonceheader, which the Wallet uses at the Credential Endpoint.That nonce must come from the store the Credential Endpoint's
resource.Verifierchecks, or the Verifier will refuse it. Until now onlyVerifycould issue one, in answer to a request. So an issuer built on FAPIgo couldn't hand one out ahead of time, and #691's wallet side had nothing to receive from it.Change
IssueDPoPNonceissues and stores a fresh nonce, valid forLimits.DPoPNonceLifetime, whichVerifythen accepts once.Dependencies.Noncesconfigured, it returns""and no error, because that Verifier doesn't use DPoP nonces.c_noncedoes. Rate-limit the endpoint accordingly.Testing
Verify, refused the second time, and a Verifier without nonces returns"".go vet, golangci-lint (0 issues), andgo test -raceon Go 1.26.9 forresource.🤖 Generated with Claude Code