edge-resolvers
Edge-compatible DID and handle resolvers for Cloudflare Workers. Extends @atproto/identity resolvers to work with the standard fetch API instead of Node.js-specific networking.
Installation
bash
npm install @atiproto/edge-resolvers
These resolvers are used as defaults inside @atiproto/edge-oauth-client. Install this package directly only if you need to customize resolver behavior or use them independently.
Quick Setup
Override the default resolvers in EdgeOAuthClient to customise timeouts, PLC directory URL, or the XRPC service:
typescript
import { EdgeDidResolver, EdgeXrpcHandleResolver } from "@atiproto/edge-resolvers";import { EdgeOAuthClient } from "@atiproto/edge-oauth-client";const client = new EdgeOAuthClient({// ...didResolver: new EdgeDidResolver({plcUrl: "https://plc.directory",timeout: 5000,}).asOAuthResolver(),handleResolver: new EdgeXrpcHandleResolver("https://public.api.bsky.app"),});
Standalone Usage
Resolve DIDs and handles directly without an OAuth client:
typescript
import { EdgeDidResolver, EdgeXrpcHandleResolver } from "@atiproto/edge-resolvers";const didResolver = new EdgeDidResolver();const doc = await didResolver.resolve("did:plc:abc123");const handleResolver = new EdgeXrpcHandleResolver();const did = await handleResolver.resolve("alice.bsky.social");
Classes
- EdgeDidResolver — Resolves did:plc and did:web documents over fetch
- EdgeDidPlcResolver — Resolves did:plc: identifiers against the PLC directory
- EdgeDidWebResolver — Resolves did:web: identifiers via /.well-known/did.json
- EdgeXrpcHandleResolver — Resolves ATProto handles to DIDs via XRPC
- timed — Wraps an async function with an AbortSignal timeout
- resolveHandles — Batch-resolves DIDs to handles with fault tolerance