> For the complete documentation index, see [llms.txt](https://docs.empe.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.empe.io/develop/wallet-server/did-web-and-hosting.md).

# did:web & Hosting

Wallet Server can create and serve a did:web document per authenticated user.

## How paths are built

The server reads:

* `DID_WEB_DOMAIN` (required): host/FQDN, without protocol
* `DID_WEB_JSON_PATH` (optional): base path; can contain `:id` placeholder
* `DID_WEB_PORT` (optional): included in the DID if set

Rules:

* If `DID_WEB_JSON_PATH` contains `:id`, it is replaced with the JWT `sub`.
* If `DID_WEB_JSON_PATH` is empty, the path becomes `/<sub>`.
* The server serves `GET /did/user/:id/did.json` publicly to match the did:web location.

## Examples

Given:

```
DID_WEB_DOMAIN=example.com
DID_WEB_JSON_PATH=/did/user/:id
```

For `sub = 1234`, the did:web is:

```
did:web:example.com:did:user:1234
```

And the document is available at:

```
https://example.com/did/user/1234/did.json
```

If no base path is set:

```
DID_WEB_DOMAIN=example.com
# DID_WEB_JSON_PATH not set
```

For `sub = 1234` → did:web path is `/1234/did.json` and the DID is `did:web:example.com:1234`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.empe.io/develop/wallet-server/did-web-and-hosting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
