atproto-oauth
OAuth 2.0 implementation for AT Protocol.
Overview
Comprehensive OAuth support with DPoP, PKCE, JWT operations, and secure storage abstractions for AT Protocol authentication.
Features
- JWT operations: Token minting, verification, and validation with ES256/ES384/ES256K support
- JWK management: JSON Web Key generation and conversion for P-256, P-384, and K-256 curves
- PKCE implementation: RFC 7636 compliant Proof Key for Code Exchange for secure authorization flows
- DPoP support: RFC 9449 compliant Demonstration of Proof-of-Possession with automatic retry middleware
- OAuth discovery: Resource discovery and validation using RFC 8414 well-known endpoints
- Storage abstractions: Pluggable storage with LRU cache implementation for OAuth requests
- Base64 encoding: URL-safe base64 encoding/decoding utilities for JWT operations
CLI Tools
The following command-line tool is available when built with the clap
feature:
atproto-oauth-service-token
: OAuth service token management tool for AT Protocol authentication workflows
Usage
JWT Operations
use ;
use identify_key;
let key_data = identify_key?;
let header = Header ;
let claims = new;
let token = mint?;
verify.await?;
PKCE Flow
use pkce;
let = generate;
// Use code_challenge in authorization URL
// Later use code_verifier for token exchange
DPoP Proofs
use ;
let = auth_dpop?;
OAuth Discovery
use ;
let protected_resource = discover_protected_resource.await?;
let auth_server = discover_authorization_server.await?;
License
MIT License