[core] Vault and generators: Argon2id key slot + XChaCha20-Poly1305 file, atomic save, item templates, memorable/nickname/random/PIN/strict generators

This commit is contained in:
2026-10-31 10:12:57 +01:00
parent 42ddcf0287
commit eb710c3135
21 changed files with 9710 additions and 4 deletions
@@ -0,0 +1,19 @@
//! How long one unlock takes with given Argon2id parameters (default: `KdfParams::DEFAULT`):
//! `cargo run --release -p custos-vault --example kdf_timing [m_cost_kib t_cost]`
use custos_vault::{KdfParams, SecretString, Vault};
use std::time::Instant;
fn main() {
let args: Vec<u32> = std::env::args().skip(1).filter_map(|a| a.parse().ok()).collect();
let kdf = match args[..] {
[m, t] => KdfParams { m_cost_kib: m, t_cost: t, p_cost: 1 },
_ => KdfParams::DEFAULT,
};
let pw = SecretString::from("timing only");
let bytes = Vault::create(&pw, kdf).unwrap().to_bytes().unwrap();
for _ in 0..3 {
let t = Instant::now();
Vault::open(&bytes, &pw).unwrap();
println!("{kdf:?}: unlock in {:?}", t.elapsed());
}
}