> 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.

# SDK — DID Operations

Source: `packages/sdk/src/did.ts`.

#### Method matrix

| SDK method                                   | Endpoint                               | Notes                                      |
| -------------------------------------------- | -------------------------------------- | ------------------------------------------ |
| `createDID(options?)`                        | `POST /api/v1/dids`                    | Auto-maps `keyType: 'ed25519'` → `Ed25519` |
| `resolveDID(did)`                            | `GET /api/v1/dids/{did}`               | Auth required                              |
| `resolveAny(did)`                            | `GET /api/v1/dids/resolve/{did}`       | Public, multi-method                       |
| `updateDID(did, document)`                   | `PUT /api/v1/dids/{did}`               | Partial document                           |
| `deactivateDID(did)`                         | `DELETE /api/v1/dids/{did}`            | Irreversible                               |
| `rotateKey(did, keyType?, currentKeyProof?)` | `POST /api/v1/dids/{did}/rotate-key`   | `keyType` defaults `Ed25519`               |
| `addDelegate(did, params)`                   | `POST /api/v1/dids/{did}/delegates`    | ERC-1056 inspired                          |
| `listDelegates(did)`                         | `GET /api/v1/dids/{did}/delegates`     |                                            |
| `revokeDelegate(did, params)`                | `DELETE /api/v1/dids/{did}/delegates`  | Body in DELETE                             |
| `setAttribute(did, params)`                  | `POST /api/v1/dids/{did}/attributes`   |                                            |
| `revokeAttribute(did, params)`               | `DELETE /api/v1/dids/{did}/attributes` |                                            |

#### Example: create + resolve + rotate

```ts
import { IDAClient } from '@infinia/ida-sdk';

const client = new IDAClient({ apiUrl: 'https://adid.dev', apiKey: jwt });

// Create
const created = await client.createDID({
  keyType: 'ed25519',
  services: [{
    id: '#didcomm-1',
    type: 'DIDCommMessaging',
    serviceEndpoint: 'https://adid.dev/api/v1/didcomm/receive',
  }],
});
console.log('Created:', created.did);

// Resolve (chain-cached)
const doc = await client.resolveDID(created.did);
console.log('Doc:', JSON.stringify(doc, null, 2));

// Universal resolve (works for did:key, did:web, did:ethr too)
const { didDocument } = await client.resolveAny(created.did);

// Rotate key (proof must be a base64url signature over server-issued nonce)
await client.rotateKey(created.did, 'Ed25519', currentKeyProofBase64);
```

#### Example: delegate management

```ts
const delegate = await client.addDelegate(created.did, {
  delegateType: 'sigAuth',
  delegate: '0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1',
  validity: 86_400,  // 24 h in seconds
});

const list = await client.listDelegates(created.did);

await client.revokeDelegate(created.did, {
  delegateType: 'sigAuth',
  delegate: '0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1',
});
```