EdgeDidResolver
@atiproto/edge-resolvers
Extends DidResolver from @atproto/identity using fetch-based sub-resolvers for both did:plc and did:web, making it compatible with Cloudflare Workers and any fetch-capable runtime.
Constructor
typescript
new EdgeDidResolver(opts?: DidResolverOpts)
| Option | Type | Default | Description |
|---|---|---|---|
| plcUrl | string | "https://plc.directory" | Base URL for the PLC directory used to resolve did:plc identifiers. |
| timeout | number | 3000 | Milliseconds before a resolution request is aborted. |
Methods
| Method | Returns | Description |
|---|---|---|
| resolve(did) | Promise<DidDocument> | Resolves a DID to its DID document. Dispatches to the PLC or Web sub-resolver based on the DID method. |
| resolveHandle(did) | Promise<string | undefined> | Extracts the handle from the alsoKnownAs field of the resolved DID document. |
| asOAuthResolver() | OAuthResolver | Returns an adapter compatible with the didResolver option of EdgeOAuthClient. |
Example
typescript
import { EdgeDidResolver } from "@atiproto/edge-resolvers";// Standalone resolutionconst resolver = new EdgeDidResolver({ timeout: 5000 });const doc = await resolver.resolve("did:plc:abc123");// As an OAuth-compatible resolverconst oauthResolver = resolver.asOAuthResolver();