Add endpoint to list (about-to-)expired wallet credentials#4224
Add endpoint to list (about-to-)expired wallet credentials#4224
Conversation
Adds GET /internal/vcr/v2/holder/expiring which aggregates credentials across all wallets on the node and returns a JSON object grouping expiring credentials by subject ID. Operators can poll a single URL to monitor and refresh credentials before they expire (closes #4217). The response is a focused monitoring DTO (id, holder, issuer, type, expirationDate) rather than the raw VC, so the shape stays uniform regardless of whether the underlying credential is JSON-LD or JWT-encoded. Assisted by AI
1 new issue
|
|
TODO / open question — filtering by credential type: Some credential types are expected to expire and shouldn't trigger refresh alerts, but operators still want to keep them in the wallet for audit / paper-trail purposes (e.g. We may want to add type-based filtering to this endpoint, e.g. Assisted by AI |
|
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
|

Closes #4217.
Summary
GET /internal/vcr/v2/holder/expiring?within=<duration>— aggregates across all wallets on the node, returns a JSON object keyed by subject ID with the list of expired or about-to-expire credentials per subject.withinis720h(30 days);0sreturns only already-expired credentials. Negative or unparseable values give400.id,holder,issuer,type,expirationDate) rather than the raw VC, so the shape stays uniform regardless of whether the underlying credential is JSON-LD or JWT-encoded. Operators needing the full VC can fetch it by id via existing wallet endpoints.{ "90BC1AE9-752B-432F-ADC3-DD9F9C61843C": [ { "id": "did:web:issuer.example.com#abc", "holder": "did:web:example.com:iam:123", "issuer": "did:web:issuer.example.com", "type": ["NutsOrganizationCredential"], "expirationDate": "2026-05-15T12:00:00Z" } ] }Subjects with no expiring credentials are omitted from the response.
Test plan
within,within=0(only already-expired), no subjects (empty map), invalidwithin, negativewithin, subject manager errorgo build ./...go test ./vcr/api/vcr/v2/...Assisted by AI