> 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 Document Schema

The DID Document is the core data structure in the `did:adi` method. It describes the subject of the DID, including its public keys, authentication methods, service endpoints, and capabilities.

## JSON-LD Context

Every `did:adi` DID Document uses the following JSON-LD contexts:

```json
{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/suites/ed25519-2020/v1",
    "https://w3id.org/security/suites/secp256k1-2019/v1",
    "https://w3id.org/security/suites/x25519-2020/v1",
    "https://w3id.org/security/bbs/v1",
    "https://ida.infinia.io/ns/did/v1"
  ]
}
```

The IDA-specific context (`https://ida.infinia.io/ns/did/v1`) adds:

* Agent-specific properties (operator, model, capabilities)
* ADI blockchain metadata
* IBCT capability invocation extensions

## Full DID Document Schema

### Person / Organization DID Document

```json
{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/suites/ed25519-2020/v1",
    "https://w3id.org/security/suites/x25519-2020/v1",
    "https://w3id.org/security/bbs/v1",
    "https://ida.infinia.io/ns/did/v1"
  ],
  "id": "did:adi:3f7a9b2e1c4d5f6a8b0c2d4e6f8a0b2c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f",
  "controller": "did:adi:3f7a9b2e1c4d5f6a8b0c2d4e6f8a0b2c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f",

  "verificationMethod": [
    {
      "id": "did:adi:3f7a...#key-1",
      "type": "Ed25519VerificationKey2020",
      "controller": "did:adi:3f7a...",
      "publicKeyMultibase": "z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP"
    },
    {
      "id": "did:adi:3f7a...#key-2",
      "type": "EcdsaSecp256k1VerificationKey2019",
      "controller": "did:adi:3f7a...",
      "publicKeyMultibase": "zQ3shokFTS3brHcDQrn82RUDfCZtME..."
    },
    {
      "id": "did:adi:3f7a...#key-agreement-1",
      "type": "X25519KeyAgreementKey2020",
      "controller": "did:adi:3f7a...",
      "publicKeyMultibase": "z6LShs9GGnqk85JBBenbnvGGnm1V8..."
    },
    {
      "id": "did:adi:3f7a...#bbs-key-1",
      "type": "Bls12381G2Key2020",
      "controller": "did:adi:3f7a...",
      "publicKeyBase58": "25EEStQgp9xE3gqAZqYejcNB..."
    }
  ],

  "authentication": [
    "did:adi:3f7a...#key-1",
    "did:adi:3f7a...#key-2"
  ],

  "assertionMethod": [
    "did:adi:3f7a...#key-1",
    "did:adi:3f7a...#bbs-key-1"
  ],

  "keyAgreement": [
    "did:adi:3f7a...#key-agreement-1"
  ],

  "capabilityInvocation": [
    "did:adi:3f7a...#key-1"
  ],

  "capabilityDelegation": [
    "did:adi:3f7a...#key-1"
  ],

  "service": [
    {
      "id": "did:adi:3f7a...#didcomm",
      "type": "DIDCommMessaging",
      "serviceEndpoint": {
        "uri": "https://agent.example.com/didcomm",
        "accept": ["didcomm/v2"],
        "routingKeys": ["did:adi:mediator1#key-1"]
      }
    },
    {
      "id": "did:adi:3f7a...#linked-domain",
      "type": "LinkedDomains",
      "serviceEndpoint": "https://example.com"
    }
  ],

  "created": "2026-03-28T10:00:00Z",
  "updated": "2026-03-28T10:00:00Z",
  "versionId": 1,
  "deactivated": false
}
```

### Agent DID Document

Agent DID Documents extend the base schema with agent-specific properties:

```json
{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/suites/ed25519-2020/v1",
    "https://ida.infinia.io/ns/did/v1",
    "https://ida.infinia.io/ns/agent/v1"
  ],
  "id": "did:adi:agent:7f3a9b2e1c4d5f6a8b0c2d4e6f8a0b2c...",
  "controller": "did:adi:3f7a9b2e1c4d...",

  "verificationMethod": [
    {
      "id": "did:adi:agent:7f3a...#key-1",
      "type": "Ed25519VerificationKey2020",
      "controller": "did:adi:agent:7f3a...",
      "publicKeyMultibase": "z6Mkw6QUbN4PqGmPVjR..."
    }
  ],

  "authentication": ["did:adi:agent:7f3a...#key-1"],
  "assertionMethod": ["did:adi:agent:7f3a...#key-1"],
  "capabilityInvocation": ["did:adi:agent:7f3a...#key-1"],

  "service": [
    {
      "id": "did:adi:agent:7f3a...#a2a",
      "type": "AgentToAgent",
      "serviceEndpoint": "https://agent.example.com/a2a"
    },
    {
      "id": "did:adi:agent:7f3a...#agent-card",
      "type": "AgentCard",
      "serviceEndpoint": "https://agent.example.com/.well-known/agent.json"
    }
  ],

  "agent": {
    "operator": "did:adi:3f7a9b2e1c4d...",
    "model": {
      "provider": "OpenAI",
      "name": "gpt-4o",
      "version": "2026-03-01"
    },
    "capabilities": ["shopping", "price-comparison", "order-placement"],
    "autonomyLevel": "Junior",
    "state": "active",
    "registeredAt": "2026-03-28T10:00:00Z"
  },

  "created": "2026-03-28T10:00:00Z",
  "updated": "2026-03-28T10:00:00Z",
  "versionId": 1,
  "deactivated": false
}
```

## Property Reference

### Core Properties

| Property               | Type         | Required | Description                       |
| ---------------------- | ------------ | -------- | --------------------------------- |
| `@context`             | array        | Yes      | JSON-LD contexts                  |
| `id`                   | string       | Yes      | The DID string                    |
| `controller`           | string/array | Yes      | DID(s) authorized to make changes |
| `verificationMethod`   | array        | Yes      | Public keys and their types       |
| `authentication`       | array        | Yes      | Keys for DID Auth                 |
| `assertionMethod`      | array        | No       | Keys for signing VCs              |
| `keyAgreement`         | array        | No       | Keys for encryption               |
| `capabilityInvocation` | array        | No       | Keys for invoking capabilities    |
| `capabilityDelegation` | array        | No       | Keys for delegating capabilities  |
| `service`              | array        | No       | Service endpoints                 |

### Agent Extension Properties

| Property               | Type   | Required | Description                                   |
| ---------------------- | ------ | -------- | --------------------------------------------- |
| `agent.operator`       | string | Yes      | DID of the human/org operator                 |
| `agent.model.provider` | string | Yes      | AI model provider                             |
| `agent.model.name`     | string | Yes      | Model identifier                              |
| `agent.model.version`  | string | No       | Model version                                 |
| `agent.capabilities`   | array  | Yes      | List of capability tags                       |
| `agent.autonomyLevel`  | string | Yes      | Intern, Junior, Senior, Principal             |
| `agent.state`          | string | Yes      | registered, active, suspended, decommissioned |
| `agent.registeredAt`   | string | Yes      | ISO 8601 registration timestamp               |

### Service Endpoint Types

| Type                 | Description           | Example                  |
| -------------------- | --------------------- | ------------------------ |
| `DIDCommMessaging`   | DIDComm v2 messaging  | Agent messaging endpoint |
| `LinkedDomains`      | Domain ownership      | Website verification     |
| `AgentToAgent`       | A2A protocol endpoint | Agent task handling      |
| `AgentCard`          | Agent metadata        | `.well-known/agent.json` |
| `CredentialRegistry` | Credential status     | StatusList2021 endpoint  |

## Verification Method Types

### Ed25519VerificationKey2020

```json
{
  "id": "did:adi:3f7a...#key-1",
  "type": "Ed25519VerificationKey2020",
  "controller": "did:adi:3f7a...",
  "publicKeyMultibase": "z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP"
}
```

* **Encoding**: Multibase (base58-btc, prefix `z`)
* **Key size**: 32 bytes (256 bits)
* **Usage**: Authentication, assertion, capability invocation/delegation

### EcdsaSecp256k1VerificationKey2019

```json
{
  "id": "did:adi:3f7a...#key-2",
  "type": "EcdsaSecp256k1VerificationKey2019",
  "controller": "did:adi:3f7a...",
  "publicKeyMultibase": "zQ3shokFTS3brHcDQrn82RUDfCZtME..."
}
```

* **Encoding**: Multibase (base58-btc, prefix `z`)
* **Key size**: 33 bytes (compressed, 264 bits)
* **Usage**: Authentication, blockchain-native operations

### X25519KeyAgreementKey2020

```json
{
  "id": "did:adi:3f7a...#key-agreement-1",
  "type": "X25519KeyAgreementKey2020",
  "controller": "did:adi:3f7a...",
  "publicKeyMultibase": "z6LShs9GGnqk85JBBenbnvGGnm1V8..."
}
```

* **Encoding**: Multibase (base58-btc, prefix `z`)
* **Usage**: Diffie-Hellman key agreement for DIDComm encryption

### Bls12381G2Key2020

```json
{
  "id": "did:adi:3f7a...#bbs-key-1",
  "type": "Bls12381G2Key2020",
  "controller": "did:adi:3f7a...",
  "publicKeyBase58": "25EEStQgp9xE3gqAZqYejcNB..."
}
```

* **Encoding**: Base58
* **Usage**: BBS+ signatures for selective disclosure

## Validation Rules

A `did:adi` DID Document is valid if and only if:

1. `@context` includes `"https://www.w3.org/ns/did/v1"` as the first entry
2. `id` is a valid `did:adi` identifier per the ABNF grammar
3. At least one `verificationMethod` exists
4. At least one `authentication` relationship references a valid verification method
5. All referenced verification method IDs resolve to entries in `verificationMethod`
6. `controller` is a valid DID (same or different from `id`)
7. For agent DIDs: `agent` object is present with all required fields
8. For agent DIDs: `agent.operator` references a valid non-agent DID
9. `created` and `updated` are valid ISO 8601 timestamps
10. `versionId` is a positive integer