Cotton code
50 lines · 2.3 KB · RustRaw
//! The vault — device-bound envelope encryption over a person's passwords.//!//! The ladder's own account of the rung this landed on is//! Cotton note "The Rust core — the file format, and how a change to it lands" § "Version 6 — the vault"; the operating//! guide (Cotton note "The vault — the honest sentence") lands with the rail that needs it.//!//! Three keys and one wrap primitive, the shape Apple Passwords and 1Password//! both take://!//! | key | what it is | where the private half lives |//! |---|---|---|//! | **vault key** | an X25519 pair per DEVICE, minted by that device | the device's Keychain, never this file |//! | **vault master key (VMK)** | 32 random bytes per workspace, versioned | nowhere raw — [`wrap`](wrap::wrap)ped once per device key, held in memory while a process is unlocked |//! | **recovery key** | the age X25519 identity the backup already mints | the person, off the Mac |//!//! Every secret's payload is sealed under the VMK ([`seal`]), and the VMK is//! wrapped under each device's public half ([`wrap`]). Adding a device wraps//! once; adding a secret wraps nothing; revoking a device is one rotation.//!//! **This module is PURE.** No file, no clock, no database — only bytes in and//! bytes out, so every answer here is reproducible and every test is a vector.//! The one exception is the OS random source, which is named at each call site//! that reaches for it and has a `*_with` sibling taking the bytes instead, so//! nothing under test depends on an entropy pool.//!//! What is deliberately NOT here: any function that reads a secret out of a//! database and any function that returns one over MCP. There is no//! `get_secret` and there will not be one; the reveal is the phone's own//! screen, against its own replica, with its own key.pub mod approval;pub mod chain;pub mod code_tokens;pub mod identity;pub mod columns;pub mod keys;pub mod payload;pub mod placement;pub mod recovery;pub mod recovery_code;pub mod seal;pub mod tokens;pub mod wrap;pub use code_tokens::{CodeClaims, CodeSelector, Scope};pub use keys::{ProviderKey, PROVIDER_KEYS};pub use payload::{hint_of, SecretKind, SecretPayload, SECRET_KINDS};pub use seal::{is_legacy, open, seal, Vmk};pub use tokens::{TokenClaims, TokenKind, TokenSelector};pub use wrap::{unwrap, wrap};