atproto-identity 0.7.0

AT Protocol identity management - DID resolution, handle resolution, and cryptographic operations
Documentation

atproto-identity

Comprehensive Rust library for AT Protocol identity management with DID resolution, handle resolution, and cryptographic key operations.

Overview

atproto-identity provides full functionality for DID resolution, handle resolution, and identity document management across multiple DID methods. This library supports complete AT Protocol identity workflows including DNS/HTTP resolution, DID document caching, cryptographic operations, and structured error handling.

Features

  • Multi-method DID resolution: Support for did:plc and did:web methods
  • Handle resolution: DNS TXT record and HTTP .well-known endpoint resolution
  • Cryptographic operations: P-256, P-384, and K-256 elliptic curve support
  • Identity validation: Input validation for handles and DIDs
  • Document storage: LRU cache-based DID document storage
  • Configuration management: Environment variable and DNS configuration
  • CLI tools: Command-line utilities for identity operations (requires clap feature)

Binaries

All CLI tools require the clap feature and use consistent command-line argument processing:

  • atproto-identity-resolve: Resolve AT Protocol handles and DIDs to canonical identifiers
  • atproto-identity-key: Generate and manage cryptographic keys (P-256, P-384, K-256)
  • atproto-identity-sign: Create cryptographic signatures of JSON data
  • atproto-identity-validate: Validate cryptographic signatures

Library Usage

Handle Resolution

use atproto_identity::resolve::{resolve_subject, create_resolver};

let http_client = reqwest::Client::new();
let dns_resolver = create_resolver(&[]);

let did = resolve_subject(&http_client, &dns_resolver, "alice.bsky.social").await?;

Key Operations

use atproto_identity::key::{identify_key, generate_key, validate, KeyType};

// Generate a new key
let private_key = generate_key(KeyType::P256Private)?;

// Identify existing key
let key_data = identify_key("did:key:zQ3sh...")?;

// Validate signature
validate(&key_data, &signature, content)?;

Command Line Usage

All CLI tools require the clap feature:

# Build with CLI support
cargo build --features clap --bins

# Resolve a handle to DID
cargo run --features clap --bin atproto-identity-resolve -- alice.bsky.social

# Generate a new P-256 key
cargo run --features clap --bin atproto-identity-key -- generate p256

# Sign JSON data
cargo run --features clap --bin atproto-identity-sign -- did:key:zQ3sh... data.json

# Verify a signature
cargo run --features clap --bin atproto-identity-validate -- did:key:zQ3sh... data.json signature

License

MIT License