Summary: how the repository and the Rust crates are laid out, which crate may depend on which, and where to make a change.Key terms: formats, flows, adapters, crate, feature, no_std, dependency rule.Related: Interfaces · Data · AGENTS.md
The Rust code has three layers. Formats parse and verify signatures, keys and tokens. Flows apply the
authentication rules to the rows they read and return decisions; they do no I/O. Adapters connect the flows to a
database, a web framework and the system clock. Dependencies point downward only, so every rule can be tested without a
database or a network.
Formats: parse and check Flows: decisions, no I/O Adapters: all I/O axum: HTTP API sqlite postgres sea-orm signup passkey session device recovery tenant, place, provider, oidc, e2ee, api-key core webauthn dpop jose keys
Formats: parse and check Flows: decisions, no I/O Adapters: all I/O axum: HTTP API sqlite postgres sea-orm signup passkey session device recovery tenant, place, provider, oidc, e2ee, api-key core webauthn dpop jose keys
The picture as text
flowchart TB
subgraph adapters [Adapters: all I/O]
axum[axum: HTTP API]
sqlite[sqlite]
postgres[postgres]
seaorm[sea-orm]
end
subgraph flows [Flows: decisions, no I/O]
signup
passkey
session
device
recovery
more[tenant, place, provider, oidc, e2ee, api-key]
end
subgraph formats [Formats: parse and check]
core
webauthn
dpop
jose
keys
end
adapters --> flows --> formats
adapters --> formats
Folder Contents
spec/The exact rules. Change it in the same commit as the behavior
schema/Reference SQL for SQLite and PostgreSQL: the core tables and each optional feature
docs/wiki/This wiki
docs/recipes/One page per task. Their Rust code compiles
docs/decisions/Decisions and their reasons
skills/Instructions for coding agents that add auth-chad to an application
rust/The Rust workspace
rust/loco/A separate workspace: the Loco adapter and an example
Crate Layer Job
auth-chad-coreformat Shared types: IDs, rows and tables, writes and decisions, Authenticated, policies, errors, shared state (single-use marks, limits, leases), SQL text
auth-chad-keysformat ES256, Ed25519 and RS256 keys, JWK, thumbprints
auth-chad-webauthnformat Verifies passkey registrations and assertions
auth-chad-joseformat A strict subset of JWS, JWK and JWT
auth-chad-dpopformat DPoP proofs and nonces
auth-chad-signupflow Open, invite-only and external signup
auth-chad-passkeyflow Register, log in, add and remove passkeys
auth-chad-sessionflow Cookie or key-bound sessions, renewal, fresh login, logout, entering a tenant
auth-chad-tenantflow Tenants and memberships
auth-chad-placeflow The location of a tenant’s or user’s data
auth-chad-recoveryflow Recovery key, tenant owners, email
auth-chad-deviceflow Device login (RFC 8628) and machine keys
auth-chad-api-keyflow API keys (optional, discouraged)
auth-chad-oidcflow Identity proof from another provider
auth-chad-providerflow OAuth for first-party and connected apps
auth-chad-e2eeflow End-to-end encryption: identity secrets, envelopes, recovery
auth-chad-sqliteadapter Store on SQLite
auth-chad-postgresadapter Store on PostgreSQL
auth-chad-sea-ormadapter Store on the application’s SeaORM connection
auth-chad-axumadapter The HTTP API, extractors, hooks, the worker, the browser script
auth-chadfacade Re-exports the crates by feature. Applications depend on this crate
auth-chad-clientclient The account API from a CLI, or from wasm in a browser (feature browser)
auth-chad-clitool The auth-chad command: schema, features, memberships, after-restore, doctor, docs
auth-chad-testingtest A memory store, a fake clock, fake random bytes, a software authenticator, storage tests
auth-chad-flow-teststest All flows together
auth-chad-recipestest Compiles the Rust code in the recipes and in this wiki
example-minimalexample A whole application with passkeys
auth-chad-locoadapter Loco integration (in rust/loco/)
example-locoexample A Loco application with auth-chad (in rust/loco/)
formats depend on formats only. flows depend on formats. Adapters depend on both.
A flow depends on no other flow, with these exceptions: signup and recovery use passkey; recovery and
tenant use session to end sessions. Shared types are in core.
formats and flows are no_std with alloc: no async runtime, clock, randomness or environment.
Only adapters name a database, a web framework or an async runtime.
No crate knows an application’s domain.
auth-chad = { git = "https://github.com/audiochad/auth-chad", rev = "<commit>", features = ["axum", "postgres"] }
Feature Adds
passkey, session, signupThe default
tenant, place, recovery, device, provider, oidc, api-key, e2eeOne flow each
sqlite, postgres, sea-ormA store
axumThe HTTP API, with every flow it needs
clientThe Rust client
rs256-signRS256 ID tokens for the provider
Change Place
A table or column rust/formats/core/src/rows.rs, then AUTH_CHAD_BLESS=1 cargo test -p auth-chad-sqlite -p auth-chad-postgres
A limit or a policy rust/formats/core/src/{config,policy}.rs
A login, session or OAuth rule rust/flows/*
An HTTP route, extractor or hook rust/adapters/axum/src
A refusal code rust/formats/core/src/error.rs and rust/adapters/axum/src/error.rs
A task page docs/recipes/, and add it to rust/recipes/src/lib.rs
Pure functions. Side effects go behind traits, used through generics instead of dyn.
Borrow before owning: &str before String.
No logging, no unsafe, no unwrap outside tests, no comments that repeat the code.
Tests run in parallel and need no network.
A new dependency needs a reason in the pull request. Never write cryptography.
Test Covers
Official vectors, Wycheproof formats
Unit and property tests with a fake clock Every flow
Storage conformance (auth-chad-testing::conformance) Every store
HTTP tests (rust/adapters/axum/tests) Every route
Browser tests with a virtual authenticator example-minimal, the Loco example
Compiled recipes and wiki auth-chad-recipes
All crates share one version and release together. Before 1.0, an application pins a commit.