Skip to main content

Class: DIDResolver

Defined in: src/auth/did/did-resolver.ts:211

DID resolver using official @atproto/identity library.

Remarks​

Uses the official ATProto identity library for proper DID/handle resolution. Caches results in Redis for performance.

Example​

const resolver = new DIDResolver({
redis,
logger,
config: { cacheTtlSeconds: 600 },
});

const doc = await resolver.resolveDID(did);
if (doc) {
const pdsUrl = await resolver.getPDSEndpoint(did);
}

Implements​

Constructors​

new DIDResolver()​

new DIDResolver(options): DIDResolver

Defined in: src/auth/did/did-resolver.ts:222

Creates a new DIDResolver using @atproto/identity.

Parameters​

options​

DIDResolverOptions

Resolver options

Returns​

DIDResolver

Methods​

clearCache()​

clearCache(did): Promise<void>

Defined in: src/auth/did/did-resolver.ts:390

Clears cache for a specific DID.

Parameters​

did​

DID

DID to clear cache for

Returns​

Promise<void>


clearHandleCache()​

clearHandleCache(handle): Promise<void>

Defined in: src/auth/did/did-resolver.ts:400

Clears handle cache.

Parameters​

handle​

string

Handle to clear cache for

Returns​

Promise<void>


getAtprotoData()​

getAtprotoData(did): Promise<null | { did: string; handle: string; pds: string; signingKey: string; }>

Defined in: src/auth/did/did-resolver.ts:341

Gets ATProto data for a DID (includes handle, PDS, signing key).

Parameters​

did​

DID

DID

Returns​

Promise<null | { did: string; handle: string; pds: string; signingKey: string; }>

ATProto data or null if not found


getPDSEndpoint()​

getPDSEndpoint(did): Promise<null | string>

Defined in: src/auth/did/did-resolver.ts:321

Gets PDS endpoint URL for a DID.

Parameters​

did​

DID

DID

Returns​

Promise<null | string>

PDS URL or null if not found

Implementation of​

IIdentityResolver.getPDSEndpoint


resolveDID()​

resolveDID(did): Promise<null | DIDDocument>

Defined in: src/auth/did/did-resolver.ts:244

Resolves a DID to its DID document.

Parameters​

did​

DID

DID to resolve

Returns​

Promise<null | DIDDocument>

DID document or null if not found

Implementation of​

IIdentityResolver.resolveDID


resolveHandle()​

resolveHandle(handle): Promise<null | DID>

Defined in: src/auth/did/did-resolver.ts:284

Resolves a handle to its DID.

Parameters​

handle​

string

Handle to resolve (e.g., "alice.bsky.social")

Returns​

Promise<null | DID>

DID or null if not found

Implementation of​

IIdentityResolver.resolveHandle