Skip to content

feat(diddoc): add an HTTP handler that serves a DID document - #94

Merged
alanshaw merged 2 commits into
mainfrom
ash/feat/did-document-handler
Nov 20, 2026
Merged

alanshaw merged 2 commits into
mainfrom
ash/feat/did-document-handler

Conversation

@alanshaw

Copy link
Copy Markdown
Member

Every service that publishes a did:web identity has its own small handler for /.well-known/did.json, and none of them tells clients how long the document may be cached. This adds one handler for all of them to share.

  • Responses say how long the document may be cached: five minutes by default, configurable.
  • Responses carry an ETag derived from the document's content and a Last-Modified time, and a client that already holds the current document gets a 304 with no body. The ETag is the same across restarts and replicas serving the same document.
  • It is a plain net/http handler, so it mounts in echo and fiber through their adaptors.

It pairs with the did:web resolver cache in fil-forge/ucantone#80, which reads these headers, but does not depend on it. Moving the services over to this handler follows in their own PRs.

🤖 Generated with Claude Code

Services publishing a did:web identity each wrote their own handler for
/.well-known/did.json, and none of them told clients how long the
document could be cached. This one sends a Cache-Control max-age (five
minutes unless configured), an ETag derived from the document and a
Last-Modified time, and answers conditional requests with a 304.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 15:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@alanshaw

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T15:24:11.168921Z 7d530eb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 7d530eb449

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Picks up the did:web resolver cache, and adds a test that runs the
resolver against the handler: one fetch, then a 304 for each
revalidation.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

2 participants