Concepts
Summary: the model behind secrets in seven ideas, what the server can and cannot see, and the vocabulary of the code and the spec.
Key terms: project, environment, member, machine device, project log, environment key, epoch, wrap, record, fingerprint, rotation.
Related: Data · Flows · Spec §2
A project holds environments (for example dev and prod), and each environment holds named secrets.
Each environment has a symmetric environment key, and clients encrypt every secret name and value with keys derived
from it. The environment key reaches each reader as a wrap: a copy encrypted to that reader’s public key. Who may
read is defined by the project log, a hash chain of entries that owners sign with their identity keys. Clients
verify the whole log before they trust a key, a member or a secret.
The picture as text
flowchart TB
L[Project log: signed by owners] -->|defines| R[Members, machine grants, environments, epochs]
R -->|one wrap per reader| K[Environment key, per epoch]
K -->|derives| V[Value key, name key, name lookup key]
V -->|encrypt| S[Secret records: signed by the writer]
The seven ideas
1. Clients encrypt, the server stores
All cryptography is in secrets-core, which the CLI, the web app and the server share. The server never holds a
private key of a user, device or environment, and it has no secret configuration. It stores ciphertext and public keys,
checks signatures and log rules, and refuses what the rules forbid.
2. Owners sign access
Adding a member, granting a machine and rotating a key are log entries signed by an owner. The server validates every entry, and so does every client. A server that inserts an entry of its own cannot produce a valid signature, so clients reject the log with an integrity error (exit code 6).
3. One key per environment and epoch
An environment key is 32 random bytes. A rotation creates the next epoch with a new key, re-encrypts the latest
version of every secret, and wraps the new key to every remaining reader. Each rotate entry carries a
key commitment, so a client can check that a wrapped key is the one the owner signed.
4. Removal forces rotation
Removing a member, revoking a machine grant or revoking a user device removes a reader. The same request must rotate
every environment that reader could open. When no owner is present (a member leaves, a user revokes a device), the
server marks the environments rotation_required and refuses writes to them until an owner rotates. A rotation does
not change the values themselves: a removed reader may have copied them.
5. Writers sign records
Each version of a secret is a record signed by its writer, with the hash of the previous version and the log head the writer verified. A reader checks the signature, the writer’s role at that log head, the chain and the version before it decrypts. The server cannot forge or swap a value.
6. People have identity keys, devices have device keys
A person’s identity key signs log entries and opens wraps. The server stores it only in encrypted envelopes, one per passkey (opened with the passkey’s PRF output), one for the recovery key, and one per approved user device. A device key stays on its device: a user device acts as its user, and a machine device has grants on specific environments only.
7. Clients remember what they verified
A client caches the highest log head and secret versions it has verified. If the server later returns a shorter log, a different history or an older version, the client stops. A client with no cached state cannot detect a server that hides the newest entries.
What the server sees
A copy of the database shows the same as the server.
| Readable by the server | Not readable by the server |
|---|---|
| User handles and display names | Secret names |
| Project and environment names | Secret values |
| Members and their roles; machine devices and their grants | Environment keys |
| Device names, public keys, IP addresses, times | Identity keys, device keys, recovery keys |
| Number of secrets, their sizes and versions | Passkey private keys and PRF output |
| The audit log |
Whoever controls the web app’s files can steal keys from people who use the web app during that time. For this reason the web app should be served from a host other than the API server; see Operation.
Where the details are
- The threat model, adversary by adversary: spec §3.
- The formats and the cryptography: spec §5 and
docs/test-vectors/. - The log entries and their validation: spec §6,
crates/core/src/log.rs. - Accounts, passkeys and sessions: auth-chad’s concepts.
Fingerprints in code
A fingerprint is the first 20 bytes of a SHA-256 hash of a public key pair, shown as 8 groups of 4 characters. People compare fingerprints to detect a server that substitutes a key.
use secrets_core::fingerprint::Fingerprint;
fn same_person(sig_pub: &[u8; 32], enc_pub: &[u8; 32], shown_elsewhere: &str) -> bool {
Fingerprint::of(sig_pub, enc_pub).matches_text(shown_elsewhere) // "7KQ2-M9XA-…", case and dashes ignored
}
Glossary
| Term | Meaning | In the code |
|---|---|---|
| Instance | One deployment of the server, with its own users | secrets-server |
| User | A person with an account; logs in with passkeys | Id<User>, usr_… |
| Instance admin | A flag on a user account that allows invites. It gives no project rights | Profile::admin |
| Project | A named container of environments, owned by one or more users | Id<Project>, prj_… |
| Environment | A named set of secrets in a project, with its own key | Id<Env>, env_… |
| Secret | A named UTF-8 value in an environment, with a version history | Id<Secret>, sec_… |
| Member | A user with a role in a project: owner, writer or reader | Member, Role |
| User device | A CLI login that acts as its user and holds the user’s identity key | DeviceOwner::User |
| Machine device | A device with grants on specific environments only, for servers, CI and agents | DeviceOwner::Machine |
| Grant | Permission for a machine device to read or read-write one environment | device_grant, Access |
| Project log | The hash-chained, owner-signed entries that define a project’s access | SignedEntry, ProjectState |
| Log head | The sequence number and hash of the newest verified entry | Head |
| Identity key | A user’s long-term Ed25519 and X25519 key pair | PublicKeys |
| Envelope | The identity private key, encrypted for one passkey, the recovery key or one user device | auth-chad’s Envelope (passkey, recovery key); Sealed<64> (user device) |
| Device key | A device’s Ed25519 and X25519 key pair. It also signs DPoP proofs | KeyPair |
| Device credential | A device key and its server in one string, sdc1_…, for SECRETS_DEVICE | DeviceCredential |
| Environment key | The 32-byte key of one environment and epoch | EnvKey |
| Epoch | The version number of an environment key | epoch |
| Wrap | An environment key encrypted to one member or machine with HPKE | Wrap, Sealed<32> |
| Key commitment | A hash of the environment key in the signed rotate entry | key_commitment |
| Record | One signed version of one secret: encrypted name and value, chain hash, log head | Record |
| Name lookup hash | An HMAC of the secret name, so the server can find a name it cannot read | name_hmac |
| Rotation | A new epoch for an environment, with every latest record re-encrypted | rotate entry |
| Rotation required | A mark on an environment after a removal without an owner; writes stop until rotation | rotation_required |
| Fingerprint | A short hash of a public key pair, for comparison by people | Fingerprint |
| Pin | A fingerprint that a client stored at first use and compares later | Pins |
| Recovery key | A 32-byte key the person stores, which opens the recovery envelope | auth-chad’s e2ee recovery |
| Workspace | A verified project with the environment keys the caller can open | Workspace |