resolveHandles
@atiproto/edge-resolvers
Batch-resolves an array of DIDs to their corresponding ATProto handles using Promise.allSettled for fault tolerance. Failures for individual DIDs fall back to the DID string itself, so the result map always contains an entry for every input.
Signature
typescript
function resolveHandles(dids: string[],resolver?: EdgeDidResolver): Promise<Map<string, string>>
| Parameter | Type | Description |
|---|---|---|
| dids | string[] | Array of DID strings to resolve. |
| resolver | EdgeDidResolver? | Optional EdgeDidResolver instance. A default instance is created if not provided. |
Return Value
A Map<string, string> keyed by DID. The value is the resolved ATProto handle (e.g. "alice.bsky.social") on success, or the original DID string on failure. The map always has the same number of entries as the input array.
Example
typescript
import { resolveHandles, EdgeDidResolver } from "@atiproto/edge-resolvers";const resolver = new EdgeDidResolver();const handles = await resolveHandles(["did:plc:abc123", "did:plc:def456"],resolver);// { "did:plc:abc123" => "alice.bsky.social", "did:plc:def456" => "bob.bsky.social" }console.log(handles);