resolve-lexicon

Resolve AT Lexicons over the network

npm install resolve-lexicon

Usage

import { resolveLexicon } from 'resolve-lexicon';

const json = await resolveLexicon('com.atproto.repo.getRecord');
console.log(json);

Try it out

Examples: · ·

How it works

Following the AT Lexicon Publication and Resolution spec:

  1. Parse NSID into authority domain and name
  2. Query DNS TXT record for _lexicon.<authority> (via Cloudflare DNS)
  3. Extract DID from TXT record (format: did=did:plc:...)
  4. Resolve DID to PDS endpoint via plc.directory
  5. Fetch lexicon record from PDS using com.atproto.repo.getRecord

Note: This library is very minimal, isn't configurable, and doesn't perform any verification of the fetched record. Check out @atproto/lexicon-resolver and @atcute/lexicon-resolver for possible alternatives.