Overview

The local-did-host is a simple Hono server designed to serve did: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:

pnpm run setup

Running the Server

Start the local server:

pnpm run dev

The server is accessible at: http://0.0.0.0:3458

Available Identities

Default served identities:

EntityDID URIResolved URL
agentdid:web:0.0.0.0%3A3458:agenthttp://0.0.0.0:3458/agent/.well-known/did.json
controllerdid:web:0.0.0.0%3A3458:controllerhttp://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.com resolves to https://example.com/.well-known/did.json
  • did:web:example.com:special resolves to https://example.com/special/.well-known/did.json

References