createFetchRecordResolver
@atiproto/record-resolver
Returns a RecordResolver that calls com.atproto.repo.getRecord on a configurable relay (or any PDS that mirrors the record). Plain fetch only. No auth or XRPC client dependency.
Signature
typescript
function createFetchRecordResolver(options?: FetchRecordResolverOptions,): RecordResolver
| Option | Type | Default | Description |
|---|---|---|---|
| relay | string | "https://bsky.network" | Base URL hosting /xrpc/com.atproto.repo.getRecord. Use any relay or the issuer's PDS directly. |
| timeout | number | 3000 | Milliseconds before the fetch is aborted. |
| fetch | typeof fetch | globalThis.fetch | Override the global fetch (tests, custom transports). |
Behavior
Parses at://{repo}/{collection}/{rkey}, issues a single getRecord call, and returns the value field of the response. Throws on non-2xx or missing value.
Example
typescript
import { verify } from "@atiproto/atproto-attestation";import { createFetchRecordResolver } from "@atiproto/record-resolver";const recordResolver = createFetchRecordResolver({relay: "https://bsky.network",});const result = await verify({record,repository: "did:plc:recipient",fields: ["items", "currency", "status"],recordResolver,});
For repeated verifications, prefer createCachedRecordResolver. Proof records are content-addressed: once resolved, they never change.