A library for ATProtocol identities.
1//! AT Protocol lexicon resolution and validation library.
2//!
3//! This library provides functionality for resolving and validating AT Protocol lexicons,
4//! which define the schema and structure of AT Protocol data.
5//!
6//! ## Overview
7//!
8//! Lexicons in AT Protocol serve as schema definitions that describe the structure
9//! and types of data that can be stored and transmitted. This library implements
10//! the full lexicon resolution chain as specified by the AT Protocol:
11//!
12//! 1. Convert NSID to DNS name with `_lexicon` prefix
13//! 2. Perform DNS TXT lookup to get the authoritative DID
14//! 3. Resolve the DID to get the DID document
15//! 4. Extract PDS endpoint from the DID document
16//! 5. Make XRPC call to fetch the lexicon schema
17//!
18//! ## Modules
19//!
20//! - [`errors`]: Structured error types for all lexicon operations
21//! - [`resolve`]: Core lexicon resolution implementation
22//! - [`resolve_recursive`]: Recursive resolution with dependency tracking
23//! - [`validation`]: NSID validation, parsing, and helper functions
24//!
25//! ## Example Usage
26//!
27//! ```no_run
28//! # use anyhow::Result;
29//! # #[tokio::main]
30//! # async fn main() -> Result<()> {
31//! use atproto_lexicon::resolve::{DefaultLexiconResolver, LexiconResolver};
32//! use atproto_identity::resolve::HickoryDnsResolver;
33//!
34//! let http_client = reqwest::Client::new();
35//! let dns_resolver = HickoryDnsResolver::create_resolver(&[]);
36//! let resolver = DefaultLexiconResolver::new(http_client, dns_resolver);
37//!
38//! // Resolve a lexicon
39//! let lexicon = resolver.resolve("app.bsky.feed.post").await?;
40//! # Ok(())
41//! # }
42//! ```
43
44#![forbid(unsafe_code)]
45#![warn(missing_docs)]
46
47pub mod errors;
48pub mod resolve;
49pub mod resolve_recursive;
50pub mod validation;