Overview
The local-did-host is a simple Hono server designed to servedid:web documents locally, which is useful for local development.
The server dynamically serves .well-known/did.json routes, enabling local testing and development of DID documents. It supports subpaths for multiple identities, such as /agent/.well-known/did.json and /controller/.well-known/did.json, served by default at 0.0.0.0:3458.
The DID Documents created here are dynamic and intended only for development purposes. Static serving is more appropriate for production.
Installation and Setup
Generate private keys for local identities. From within the example directory (e.g., from project root:./examples/local-did-host) execute the setup:
Running the Server
Start the local server:Available Identities
Default served identities:| Entity | DID URI | Resolved URL |
|---|---|---|
agent | did:web:0.0.0.0%3A3458:agent | http://0.0.0.0:3458/agent/.well-known/did.json |
controller | did:web:0.0.0.0%3A3458:controller | http://0.0.0.0:3458/controller/.well-known/did.json |
How did:web Resolution Works
Resolving a did:web DID involves fetching .well-known/did.json from the indicated domain or subpath. Examples:
did:web:example.comresolves tohttps://example.com/.well-known/did.jsondid:web:example.com:specialresolves tohttps://example.com/special/.well-known/did.json