Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 wantauth-chad gives
Accounts with passkeysSignup, login, more passkeys, logout, and a fresh passkey check before a risky action
Only invited peopleInvite-only signup, with your own data on the invite
A CLI or a server that acts for a person, or as itselfDevice login (approved in the browser) and machine keys
Other apps (for example an AI assistant) that read data for a userOAuth with consent, short tokens, limited scopes
A way back after a lost phoneA recovery key, recovery by tenant owners, or email (unavailable with end-to-end encryption)
Organizations with membersTenants and memberships, with your own columns such as a role
Data that the server must not readEnd-to-end encryption keys that only a passkey or the recovery key can open
Growth from one machine to manyThe same program on one process or many; see Scaling

What it is not for

Not forReason and alternative
Password logins, SMS codes, authenticator-app codesThey can be phished or copied. A password can be checked once, to move an old account to a passkey
Login links sent by emailWhoever controls the mailbox controls the account
“Log in with another company” as the only proofThat company would control the account. auth-chad accepts it as extra proof of identity only
Roles, permissions, sharing rulesThese are authorization. Your application decides them with its own data
A hosted login serviceauth-chad runs inside your program, on your database
SAML, old OAuth grants, a choice of algorithmsEach adds attack surface or allows downgrade attacks. There is one strict profile
Servers in many regions that cannot reach the users’ databaseUnsupported; see Scaling

Where to start

You areRead
New to the projectConcepts: the model and the vocabulary
Adding auth-chad to an applicationRecipes, starting with start
Changing auth-chadMap, Data, Flows, Interfaces, then the spec
A coding agentINDEX.md, then one recipe or page
Reviewing the securityThreats and the spec
Planning hostingScaling

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.