๐ skyauth
Pure Safe Rust (
#![forbid(unsafe_code)]), Zero-Panic AT Protocol OAuth 2.1 Client with RFC 9449 DPoP, RFC 9126 PAR, RFC 7636 PKCE, & Formal Mathematical Verification
๐ Highlights
- 100% Pure Safe Rust:
#![forbid(unsafe_code)]enforced crate-wide with 0unsafeblocks and zero production panics. - RFC 9449 DPoP: Ephemeral ECDSA P-256 key generation, RFC 7517 JWK formatting, RFC 7638 JWK Thumbprints (
jkt), signeddpop+jwtproof tokens, access token hash (ath), and transparent auto-nonce retry negotiation. - RFC 9126 PAR (Pushed Authorization Requests): Direct back-channel pushing of authorization parameters with signed DPoP headers.
- RFC 7636 PKCE: High-entropy 43-character Base64URL verifier generation, SHA-256 S256 challenge derivation, and constant-time verification.
- Decentralized Identity Discovery: Handle normalization, DNS TXT resolution (
_atproto.<handle>), HTTPS fallback (/.well-known/atproto-did), DID resolution (did:plc,did:web), and bidirectionalalsoKnownAsverification. - RFC 8414 & RFC 9728 Discovery: Protected Resource Metadata and Authorization Server Metadata discovery with automatic OIDC fallback.
- Strict SSRF & DNS Rebinding Security: Full IP boundary filtering blocking RFC 1918 private IPs, loopback, link-local, cloud metadata (
169.254.169.254), IPv6 ULA, and DNS socket pinning. - 64-Shard Partitioned State Store: Lock-free scaling state storage across 64 independent
RwLockshards with atomic single-use state consumption ([OAuthStore::take_state]) and drift-free background TTL pruning. - Web Framework Integrations: Ready-to-use extractors, response generators, and middleware for Axum 0.7, Actix-Web 4, and Tower.
- Formal Mathematical Verification: Verified using Verus (deductive contracts) and Kani (bounded model checking with 36 mandatory anti-vacuity reachability checks).
- Dynamic Schema Invariants: Bundled official ATProto Lexicons and RFC schemas with continuous automated upstream drift detection.
๐ Quick Start
Add atproto-oauth to your Cargo.toml:
[]
= "0.1"
1. DPoP Proof Generation & Verification
use ;
use PkcePair;
2. Full OAuth Client Lifecycle
use ;
use OAuthStateStore;
use Arc;
async
๐ก๏ธ Formal Verification & Mathematical Invariants
skyauth incorporates a multi-layered formal verification hierarchy to eliminate security vulnerabilities:
- Verus Deductive Contracts (
verus!): Mathematical proofs for session state transitions, constant-time comparisons, and PKCE deterministic bounds. - Kani Bounded Model Checking (
kani::proof): 5 exhaustive verification harnesses checking all symbolic byte inputs. - Anti-Vacuity Coverage (
kani::cover!): 36 mandatory reachability checks ensuring harnesses actually exercise functional code paths.
๐งช Running Tests & Formal Proofs
# Run unit, integration, and RFC vector test suites (730+ tests)
# Verify strict clippy compliance (0 warnings)
# Verify specification drift against official ATProto Lexicons & RFC schemas
๐ License
Dual-licensed under either:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)