fix(did): add did:web resolution to document endpoint#227
Merged
Conversation
The GetDIDDocument handler only resolved did:key identities via the in-memory registry. did:web lookups returned "DID not found" even when the agent had a valid did:web document stored in the database. Add did:web resolution (via didWebService) before falling back to did:key, matching the pattern already used by the ResolveDID handler and the server's serveDIDDocument method. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gin URL-decodes path parameters, turning did:web:localhost%3A8080:agents:foo into did:web:localhost:8080:agents:foo. The database stores the canonical form with %3A, so lookups failed with "DID not found". Add normalizeDIDWeb() helper that detects decoded port separators and re-encodes them. Applied to both ResolveDID and GetDIDDocument handlers. Manually verified against running control plane: - /api/v1/did/document/did:web:... → 200 with W3C DID Document - /api/v1/did/resolve/did:web:... → 200 with DID resolution result - did:key paths unchanged (no regression) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
/api/v1/did/document/:didendpoint only resolveddid:keyidentities via the in-memory registry, returning "DID not found" for validdid:webidentifiersdid:webresolution (viadidWebService) before falling back todid:key, matching the pattern already used by the/api/v1/did/resolve/:didhandler and the server'sserveDIDDocumentmethodTest plan
TestGetDIDDocumentHandlerpasses (did:key path unchanged)curl http://localhost:8080/api/v1/did/document/did:web:localhost%3A8080:agents:<agent-id>returns W3C DID Document🤖 Generated with Claude Code