auth-chad
Summary: what auth-chad is, what it is for, what it is not for, and where to start.
Key terms: passkey, device key, first-party, connected app, authentication, authorization.
Related: Concepts · Map · Recipes
auth-chad is a Rust authentication library that runs inside your application and stores its data in your database. People sign in with passkeys, which are bound to the site and resist phishing. Programs such as CLIs, servers and build jobs sign in with device keys that a person approves once. Other companies’ apps get short, scoped tokens through OAuth after the user consents.
auth-chad establishes who made a request and how recently they proved it. Your application decides what that person may do.
The picture as text
flowchart LR
P[Person with a passkey] --> A
M[Program with a device key] --> A
O[Another company's app, with consent] --> A
A[Your application<br/>with auth-chad inside] --> D[(Your database:<br/>users and your data)]
What it is for
| You want | auth-chad gives |
|---|---|
| Accounts with passkeys | Signup, login, more passkeys, logout, and a fresh passkey check before a risky action |
| Only invited people | Invite-only signup, with your own data on the invite |
| A CLI or a server that acts for a person, or as itself | Device login (approved in the browser) and machine keys |
| Other apps (for example an AI assistant) that read data for a user | OAuth with consent, short tokens, limited scopes |
| A way back after a lost phone | A recovery key, recovery by tenant owners, or email (unavailable with end-to-end encryption) |
| Organizations with members | Tenants and memberships, with your own columns such as a role |
| Data that the server must not read | End-to-end encryption keys that only a passkey or the recovery key can open |
| Growth from one machine to many | The same program on one process or many; see Scaling |
What it is not for
| Not for | Reason and alternative |
|---|---|
| Password logins, SMS codes, authenticator-app codes | They can be phished or copied. A password can be checked once, to move an old account to a passkey |
| Login links sent by email | Whoever controls the mailbox controls the account |
| “Log in with another company” as the only proof | That company would control the account. auth-chad accepts it as extra proof of identity only |
| Roles, permissions, sharing rules | These are authorization. Your application decides them with its own data |
| A hosted login service | auth-chad runs inside your program, on your database |
| SAML, old OAuth grants, a choice of algorithms | Each adds attack surface or allows downgrade attacks. There is one strict profile |
| Servers in many regions that cannot reach the users’ database | Unsupported; see Scaling |
Where to start
| You are | Read |
|---|---|
| New to the project | Concepts: the model and the vocabulary |
| Adding auth-chad to an application | Recipes, starting with start |
| Changing auth-chad | Map, Data, Flows, Interfaces, then the spec |
| A coding agent | INDEX.md, then one recipe or page |
| Reviewing the security | Threats and the spec |
| Planning hosting | Scaling |
Getting started
cd rust && cargo run -p example-minimal # a whole application with passkeys, on http://localhost:3000
[dependencies]
auth-chad = { git = "https://github.com/audiochad/auth-chad", rev = "<commit>", features = ["axum", "sqlite"] }
- Status: before a first release. The Rust crates work and are tested. No external security review has happened yet; values marked † in the spec need that review.
- The core rule: login is proof of a key. Anything that can be copied must be short-lived, single-use or limited.
- Exact rules: the spec is the contract. Where this wiki and the spec differ, the spec is correct.
- Decisions and their reasons: decisions.
- MIT license.