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

# IDAClient

#### Constructor

```ts
class IDAClient {
  constructor(config: IDAClientConfig);
}

interface IDAClientConfig {
  apiUrl: string;        // Base URL, e.g. "https://adid.dev"
  apiKey?: string;       // JWT or API key (sent as `Authorization: Bearer …`)
  timeout?: number;      // Request timeout in ms; default 30 000
}
```

Source: `packages/sdk/src/index.ts:65-82`, `packages/sdk/src/types.ts:412-416`.

#### Example

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

const client = new IDAClient({
  apiUrl: 'https://adid.dev',
  apiKey: process.env.IDA_API_KEY!,    // or a JWT obtained via /auth/verify-otp
  timeout: 15_000,
});
```

The `apiUrl` is normalised — trailing slashes are stripped (`index.ts:76`). All operations are routed through one of four sub-modules:

```ts
client.didOps         // private
client.credentialOps  // private
client.agentOps       // private
client.zkpOps         // private
```

…but the public surface is the flat method list on `IDAClient` itself (see following sections). You may prefer the sub-module style for tree-shaking; the SDK exposes them via type-level aliases (see §10.7 below for direct module imports).

#### Switching auth at runtime

The SDK does not currently support per-call header overrides; instantiate a second client if you need to switch identities mid-process:

```ts
const adminClient = new IDAClient({ apiUrl, apiKey: ADMIN_KEY });
const userClient  = new IDAClient({ apiUrl, apiKey: jwtFromOtp });
```

#### Error handling

All failed HTTP calls throw `IDAHTTPError` (re-exported from `http.ts`):

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

try {
  await client.resolveDID('did:adi:does-not-exist');
} catch (err) {
  if (err instanceof Error && err.name === 'IDAHTTPError') {
    // err.status, err.code (string), err.message
  }
}
```

The error wraps `{ status, code, message }`. Wrapped error envelope unwrapping is automatic (`http.ts:48-62`).