[keys] Key pairs and API keys: custos-keys (Ed25519, ECDSA P-256, RSA), secret_key, api_key; threat model; v0.4.0

This commit is contained in:
2026-11-02 15:49:07 +01:00
parent 12783c9b92
commit 3f3cd26590
8 changed files with 914 additions and 48 deletions
+8 -4
View File
@@ -7,12 +7,15 @@ The Windows app lives in the private `Custos` repo and depends on this one by gi
## Layout
```
crates/custos-vault file format, Argon2id + XChaCha20-Poly1305, atomic save, item model, SecretString
crates/custos-gen memorable password, nickname, random, PIN, strict-site generators + wordlists
crates/custos-gen memorable password, nickname, random, PIN, strict-site, secret-key and API-key generators
crates/custos-keys key pairs (Ed25519, ECDSA P-256, RSA) as OpenSSH and PKCS#8 PEM
crates/custos-totp TOTP / HOTP (RFC 6238 / 4226 vectors are tests), otpauth:// parsing
crates/custos-qr QR payload strings (Wi-Fi escaping); rendering is the app's job
crates/custos-share private share links: XChaCha20-Poly1305 blob, key in the URL fragment, optional password
crates/custos-wasm the browser build (web vault + share page): JSON `call` ABI, no wasm-bindgen; js/custos.mjs
docs/FORMAT.md the vault file format (versioned; change it before the code)
docs/FORMAT.md the vault file format, version 1 (versioned; change it before the code)
docs/FACTORS.md version 2: any two factors open the vault; the machine store
docs/KEYS.md secret keys, API keys and key pairs
docs/SHARE.md the share blob and link format (versioned like FORMAT.md)
docs/THREAT_MODEL.md what is and is not protected
```
@@ -33,8 +36,9 @@ On the dev machine set `CARGO_HOME=F:\C-Drive-Migration\future-caches\cargo` (C:
- Commits: `[<crate>] <Feature>: <description>`, e.g. `[vault] Format: authenticate slot parameters`.
- **No AI attribution in commits or PRs, ever**: no `Co-Authored-By`, no session links, no "Generated with".
- No binaries in git.
- **No custom crypto.** Only RustCrypto / rust-random crates (`argon2`, `chacha20poly1305`, `zeroize`,
`rand` with `SysRng`). Randomness from the OS CSPRNG only.
- **No custom crypto.** Only RustCrypto / rust-random crates (`argon2`, `chacha20poly1305`, `hkdf`, `zeroize`,
`rand` with `SysRng`; for key pairs `ssh-key`, `p256`, `rsa` and `ed25519-dalek`, RustCrypto's Ed25519
backend). Randomness from the OS CSPRNG only.
- **Secrets never in logs, panics, error messages, `Debug`/`Display` output or test snapshots.**
Secret-holding types print `[redacted]`; there is a test for each one.
- Tests here are mandatory (it is public and holds the crypto). A format change updates `docs/FORMAT.md`