> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.adid.dev/llms.txt.
> For full documentation content, see https://docs.adid.dev/llms-full.txt.

# DID Attributes

##### When to use

You want to attach a small piece of structured data to your DID — e.g. a service URL, a name, a hash — without modifying the DID Document directly. This mirrors the ERC-1056 attribute mechanism: signed key/value pairs anchored on chain.

##### Before you begin

* You own the DID.
* The attribute name is short (≤32 bytes) and meaningful.

##### Steps

1. Open `/dids/:did` and scroll to **Attributes**.
2. Click **Set attribute**.
3. Enter:
   * **Name** — e.g. `did/svc/HubService`, `did/auth/email`.
   * **Value** — string or hex-encoded bytes.
   * **Validity** — seconds.
4. Save. Calls `POST /api/v1/dids/{did}/attributes` (`did.go:369`).

##### API & SDK

<table>
  <tr>
    <th>cURL — set</th>

    <th>cURL — revoke</th>
  </tr>

  <tr>
    <td>
      ```bash
      curl -X POST https://adid.dev/api/v1/dids/did:adi:0x9a2c.../attributes \
        -H "Authorization: Bearer $ACCESS_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
          "name":"did/svc/AgentCard",
          "value":"https://my.agent/.well-known/agent.json",
          "validity":2592000
        }'
      ```
    </td>

    <td>
      ```bash
      curl -X DELETE https://adid.dev/api/v1/dids/did:adi:0x9a2c.../attributes \
        -H "Authorization: Bearer $ACCESS_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
          "name":"did/svc/AgentCard"
        }'
      ```
    </td>
  </tr>
</table>

##### Verify

Resolve the DID; the attribute is exposed via the `didDocumentMetadata.attributes` array (or whatever the resolver returns — see [§3.1.9](#did-resolver)).

##### Troubleshooting

If a value isn't appearing, the most common cause is a stale cache. Force a re-resolve with:

```bash
curl https://adid.dev/api/v1/dids/resolve/did:adi:0x9a2c...?refresh=true
```

#### 3.1.9. Universal DID Resolver Tool ##### When to use

You need to fetch the DID Document for *any* DID — yours, someone else's, or a DID from a different method entirely. The universal resolver is the public, no-auth endpoint that does this.

##### Before you begin

Nothing required. The endpoint is unauthenticated.

##### Steps

1. Open the **DID Resolver** page in the portal (`/tools/did-resolver`) — or just call the endpoint directly.
2. Paste the DID into the input field.
3. Click **Resolve**.
4. The portal calls `GET /api/v1/dids/resolve/{did}` (`did.go:29`, registered at `router.go:74`).

##### Supported methods

| Method     | How it resolves                   | Source                         |
| ---------- | --------------------------------- | ------------------------------ |
| `did:adi`  | DIDRegistry.resolveDID()          | ADI chain (cached in Postgres) |
| `did:key`  | Multibase decode of public key    | local computation              |
| `did:web`  | HTTPS GET `/.well-known/did.json` | DNS + HTTPS                    |
| `did:ethr` | ERC-1056 EthereumDIDRegistry      | Ethereum mainnet RPC           |

##### API

<table>
  <tr>
    <th>cURL</th>

    <th>TypeScript SDK</th>
  </tr>

  <tr>
    <td>
      ```bash
      curl https://adid.dev/api/v1/dids/resolve/did:adi:0x9a2c...
      ```
    </td>

    <td>
      ```ts
      // Universal resolver — works for did:adi, did:key, did:web, did:ethr.
      const { didDocument, didDocumentMetadata } =
        await client.resolveAny('did:adi:0x9a2c...');

      // Or, for did:adi only (authenticated):
      // const didDocument = await client.resolveDID('did:adi:0x9a2c...');
      ```
    </td>
  </tr>
</table>

Response shape (per [W3C DID Resolution](https://www.w3.org/TR/did-core/#did-resolution)):

```json
{
  "didDocument":         { "@context":[...], "id":"did:adi:0x9a2c...", ... },
  "didDocumentMetadata": { "created":"...", "updated":"...", "deactivated":false, "txHash":"0x..." },
  "didResolutionMetadata":{ "contentType":"application/did+ld+json" }
}
```

##### Verify

Compare the returned key fingerprint against an out-of-band channel (e.g., the issuer's website, a printed business card). DID Documents are public, but their *binding* to a real-world entity is your responsibility.

##### Troubleshooting

| Code                  | Cause                      | Fix                                         |
| --------------------- | -------------------------- | ------------------------------------------- |
| `404 DID_NOT_FOUND`   | DID not registered         | Verify spelling; check method support.      |
| `502 UPSTREAM_ERROR`  | did:web HTTPS fetch failed | Check the host's `/.well-known/did.json`.   |
| `410 DID_DEACTIVATED` | DID is deactivated         | The document is still returned but flagged. |