import { A as AttestationDetail, R as RegistryListFilters, a as RegistryPage, I as IssuerDetail, S as SegmentDetail, b as SthListResponse, C as ConsistencyProofResponse, c as StreamEvent } from '../api-CGCo5O7M.js'; /** * `@deepidv/chain/client` — typed wrapper around the public registry * API at `api.proof.deepidv.com/v1`. * * The client is a thin GET-only fetcher: every operation is a read. * Mint and revoke are tenant-authenticated operations that don't * belong on this SDK in v1 — they live behind tenant-API-key auth on * a different surface (see runbook §0.E for credential hygiene). * * Pluggable `fetch` lets consumers wire in: * - `node-fetch` polyfills (Node <20 — discouraged but supported) * - request signing wrappers * - Cloudflare Workers / Bun / Deno's native fetch * * SSE streaming is exposed as `streamAttestations()`, which returns * an `AsyncIterable` with built-in reconnect. * * Bundle download returns an `ArrayBuffer` ready to be unzipped by * the verify module. */ type FetchLike = typeof fetch; interface ClientOptions { /** * Base URL of the registry API. Default: * `https://staging-api.proof.deepidv.com`. * * Production hosts the same surface at * `https://api.proof.deepidv.com`. Override at construction time. * No trailing slash; the client adds `/v1/...` paths. */ apiUrl?: string; /** * Custom fetch implementation. Defaults to `globalThis.fetch`. * Pass a wrapped fetch to inject headers, telemetry, or retries. */ fetch?: FetchLike; /** * Optional default `User-Agent`. The registry doesn't require one * but identifying SDK versions makes operator triage easier. */ userAgent?: string; /** * Default per-request timeout in milliseconds. Default `15_000`. * `0` disables. Plumbed via `AbortSignal.timeout(...)`. */ timeoutMs?: number; } interface RequestOptions { signal?: AbortSignal; /** Per-request override of the client's default timeout. */ timeoutMs?: number; } declare class DeepidvChainClient { readonly apiUrl: string; private readonly fetchImpl; private readonly userAgent; private readonly defaultTimeoutMs; constructor(opts?: ClientOptions); getAttestation(id: string, opts?: RequestOptions): Promise; listRegistry(filters?: RegistryListFilters & { page?: number; cursor?: string; }, opts?: RequestOptions): Promise; getIssuer(id: string, opts?: RequestOptions): Promise; getSegment(n: number, opts?: RequestOptions): Promise; listSths(segment: number, opts?: RequestOptions): Promise; getConsistencyProof(fromTreeSize: number, toTreeSize: number, segment: number, opts?: RequestOptions): Promise; /** * The transparency log viewer endpoint — returns the latest * checkpoint for every open segment plus the current head's STH. * Shape is the same as `getSegment` for each entry. */ getLog(opts?: RequestOptions): Promise<{ segments: SegmentDetail[]; }>; /** * Download a `.dpiv-bundle` zip as raw bytes. The caller unzips * and feeds the result to `verifyBundle()` from * `@deepidv/chain/verify`. */ downloadBundle(id: string, opts?: RequestOptions): Promise; /** * Subscribe to live attestation events. * * Returns an `AsyncIterable`. The iterator manages * reconnection internally (exponential backoff, jittered, capped * at 30s). Pass `signal` to stop iterating cleanly. * * const ctrl = new AbortController(); * for await (const ev of client.streamAttestations({ signal: ctrl.signal })) { * if (ev.type === "attestation.minted") { * console.log(ev.payload.id); * } * } */ streamAttestations(opts?: { signal?: AbortSignal | undefined; }): AsyncIterable; private requestJson; private rawRequest; } /** * Convenience constructor — many consumers prefer * `createClient({...})` over `new DeepidvChainClient({...})`. */ declare function createClient(opts?: ClientOptions): DeepidvChainClient; export { type ClientOptions, DeepidvChainClient, type FetchLike, type RequestOptions, createClient };