Flows
Summary: what each flow sends, who can read each item, and what the server checks: requests, signup, login, devices, machines in CI, projects, sharing, secrets, removal, revocation and recovery.
Key terms: DPoP, envelope, device grant, user code, wrap, record, rotation, rotation required, recovery hold, integrity error.
Related: Data · Concepts · Spec §7 · Spec §9
Every request carries an access token and a DPoP proof made with the client’s private key, and auth-chad checks both
before a route runs. Account flows (signup, login, device approval, recovery) are auth-chad’s routes at /v1/auth,
with this application’s rules in its hooks. Project flows send signed log entries, wraps and records that the client
built; the server validates them and stores them in one transaction. Clients verify everything they read before they
use it, and stop with an integrity error if a check fails.
Each flow below lists what travels. Readable items the server can read. Sealed items pass through the server, which cannot open them. Local items never leave the client.
Every request
The picture as text
sequenceDiagram
participant C as Client
participant A as auth-chad layer
participant R as Route
participant DB as Database
C->>A: access token + DPoP proof (method, URL, time, server nonce, token hash)
A->>DB: token hash, device not revoked, user not disabled, proof not reused
alt valid
A->>R: Caller (user or device, address)
R->>DB: role in the project (from the verified log)
R-->>C: answer, with a fresh DPoP-Nonce
else invalid
A-->>C: 401 with {"error": code}
end
- The access token is 32 random bytes, valid 15 minutes; the server stores its hash. It is useless without the private key that signs the proofs.
- There are no refresh tokens. A device signs a JWT assertion with its device key to get a new token (RFC 7523).
- A project the caller cannot see answers
404, so its existence does not leak.
Signup
An instance admin creates an invite; the server keeps only its hash and shows the link once. The new user creates every key in their own browser.
The picture as text
sequenceDiagram
participant B as Browser
participant S as Server
B->>S: signup/start (invite token, handle, display name)
S-->>B: challenge (5 minutes)
Note over B,S: browser creates passkey, identity key, recovery key
B->>S: signup/finish: public keys, recovery verifier, two envelopes
S->>S: commit_signup: one transaction
S-->>B: session
| Item | Readable | Sealed | Local |
|---|---|---|---|
| Invite token | As a hash | ||
| Handle, display name, public keys | Yes | ||
| Identity private key | In two envelopes | In the browser | |
| PRF output of the passkey, recovery key | Yes |
Login in the browser
One passkey prompt signs the challenge and returns the PRF output that opens the identity key.
The picture as text
sequenceDiagram
participant B as Browser
participant S as Server
S-->>B: challenge
Note over B,S: passkey signs, gives PRF output
B->>S: assertion + proof of the session key
S-->>B: access token bound to the session key, identity key sealed by this passkey
Note over B,S: browser opens the identity key
The browser keeps the identity key, the session key and the token in IndexedDB, encrypted with a non-extractable WebCrypto key, until logout: at most 1 hour idle and 12 hours in total.
Device login (user device)
secrets-chad login. The laptop can then do what its user can.
The picture as text
sequenceDiagram
participant D as CLI
participant S as Server
participant B as Person's browser
Note over D,S: CLI creates device keys (file, 0600)
D->>S: device_authorization (name, public keys, client info, DPoP proof)
S-->>D: user code, device code
D->>B: link + user code + device fingerprint
B->>S: approve after a fresh passkey prompt, with the identity key sealed to the device
D->>S: token (device code, DPoP proof)
S-->>D: access token, sealed identity key
Note over D,B: person types the identity fingerprint
- The approval page shows the device name, fingerprint, requested scope, IP address and client. The person compares the fingerprint with the terminal.
- The sealed identity key is not authenticated, so the CLI makes the person type the identity fingerprint from the browser before it stores anything. No flag skips this.
Machine device
secrets-chad machine create NAME. The machine can open the chosen environments and nothing else.
- The CLI creates device keys and requests approval, with environments (
env:<project>/<env>:read) or without (machine). - An owner opens the link, chooses the project, environments and access if the request names none, and approves after a fresh passkey prompt.
- The owner’s browser signs one
device_grantentry per environment and wraps each current environment key to the machine. The server stores the entries, the wraps, the device and the approval in one transaction. - The machine collects its token and wraps. It receives no identity key.
A machine in a GitHub Actions job
The picture as text
sequenceDiagram
participant L as Your laptop
participant G as GitHub
participant R as Runner
participant S as Server
L->>S: machine create deploy -e shop/prod --github
Note over L,S: you approve in the browser
L->>G: gh secret set SECRETS_DEVICE (credential on stdin, no file)
G->>R: SECRETS_DEVICE for the deploy step
R->>S: JWT assertion signed with the device key
S-->>R: token, shop/prod key sealed to the machine, encrypted records
Note over R,S: runner decrypts, starts deploy.sh
An owner ends it with secrets-chad machine revoke deploy or on the Machines page. The environment rotates, and the
next job fails.
Create a project
The creator’s client generates the genesis, env_create and rotate entries and environment key epoch 1, and wraps
the key to the creator. The project ID is a hash of the creator’s user ID, identity fingerprint and a random nonce, so
the server cannot invent a log for an ID that a client got from a trusted source.
Share a project
The picture as text
sequenceDiagram
participant A as Owner A
participant S as Server
participant B as User B
A->>S: GET /v1/users/{handle}
S-->>A: B's public keys and fingerprint
Note over A,B: A and B compare the fingerprint by another channel
A->>S: signed member_add (B, fingerprint, role) + every current key wrapped to B
B->>S: on the next visit: log, wraps, records
Note over S,B: B verifies the log and every record
The first fingerprint comparison is the only protection against a server that substitutes B’s key. Clients pin the fingerprint and warn when it changes. B can read versions from the current epoch on; history from before B joined stays unreadable to B.
Write and read a secret
- The writer’s client derives the subkeys of the current epoch, encrypts the name and the value, and signs the record with the log head it verified.
- The server checks the signature, the writer’s role, the version (latest + 1) and the name lookup hash, and writes an audit row.
- A reader’s client checks the signature, the writer’s role at
log_seq, the chain hash and the version, then decrypts and compares the name lookup hash.
use secrets_core::keys::PublicKeys;
use secrets_core::log::{replay, Head, SignedEntry};
fn verified_head(entries: &[SignedEntry], keys: &[PublicKeys], cached: Option<&Head>) -> Result<Head, secrets_core::Error> {
let state = replay(entries, keys)?; // every signature, role and rule from genesis
if let Some(head) = cached {
state.check_checkpoint(head)?; // the log still contains what this client saw before
}
Ok(state.head())
}
Remove a member
Owner A removes B. Everything is one request.
The picture as text
flowchart LR
A["A's client: new key per environment,<br/>re-encrypt every latest record"] --> M["A chooses machines to end<br/>(those B approved are preselected)"]
M --> E["Signed member_remove with rotations<br/>+ rotate entries + new wraps + records"]
E --> S[["Server: one transaction"]]
S --> G["B sees 404 for the project"]
The client lists the secrets B could read, so A can change them at their source (for example, roll an API key at the provider). Encryption cannot take back what B already read.
| After the removal | Result |
|---|---|
| B’s browser and CLI | The project answers 404. B’s identity key opens no new wrap |
| B’s other projects | No change |
| Secrets B wrote | Stay valid |
| Machines B approved as an owner | Preselected, so they end in the same request; A can keep some |
| Machines A approved that B operates | Keep working unless A ends them in the removal |
| Values B copied | B still has them; change them at the source |
| Old environment keys B kept | Open only old ciphertext, which B would also need to obtain |
| B leaves without an owner | Writes stop until an owner rotates; machines keep working, and the Machines page marks those B approved |
Revoke a device
| Case | What happens |
|---|---|
| A user revokes a user device | The server ends its tokens, deletes its identity envelope, and marks every environment of the user’s projects rotation_required. Reads continue; writes wait for an owner’s rotation |
| An owner revokes a machine | One request removes the grant and rotates that environment |
| A laptop is stolen | It held the identity key, so the user also replaces the identity key with a passkey. This re-keys every project log and ends all other passkeys, sessions and user devices |
Recover an account
When all passkeys are lost and the recovery key is not:
- The browser asks by handle. The server returns a challenge and the recovery envelope; for an unknown handle it returns a decoy of the same shape.
- The browser opens the envelope with the recovery key, signs the challenge with the recovery key’s signer, and registers a new passkey with its own envelope.
- The account is on hold for 72 hours: an older passkey can undo the recovery, and the identity key cannot be replaced.
Recovery by email or by an owner is refused, because it cannot restore the identity key.
Known gaps
None of these lets the server read a secret.
- The removal dialog in the web app asks “Remove and rotate?” and does not yet list the values to change at their source, which the spec requires.
- The invite token is in the query string (
?invite=), so the web host can see it in a request log. - An instance admin cannot yet disable a user or start a reset; both are in the spec.
Where the details are
- Authentication, DPoP and device approval: spec §7.
- Sharing, removal, rotation and account reset: spec §9.
- Every route and code: spec §10.
- auth-chad’s account flows: auth-chad’s flows page.