[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:
+4
-3
@@ -67,7 +67,7 @@ with "unsupported KDF parameters", before any work:
|
||||
| Parameter | Allowed | Default written by Custos |
|
||||
|:--|:--|:--|
|
||||
| m_cost | 8·p ..= 2 097 152 KiB (2 GiB) | 65 536 KiB (64 MiB) |
|
||||
| t_cost | 1 ..= 64 | 3 (measured ≈ 0.5–1 s on the dev machine, see `custos-vault` `KdfParams::DEFAULT`) |
|
||||
| t_cost | 1 ..= 64 | 20 (≈ 0.75 s per unlock on the dev machine; `examples/kdf_timing.rs` measures it) |
|
||||
| p_cost | 1 ..= 16 | 1 |
|
||||
|
||||
The parameters are stored per file, so a later version can raise the defaults; a vault keeps its
|
||||
@@ -169,8 +169,9 @@ become *protected* strings.
|
||||
1. The new bytes go to `<name>.custos.tmp` in the same folder; the file is flushed with `fsync`.
|
||||
2. If `<name>.custos` exists, it is copied to `<name>.custos.bak.tmp`, flushed, and renamed over
|
||||
`<name>.custos.bak`.
|
||||
3. `<name>.custos.tmp` is renamed over `<name>.custos` (`MoveFileEx` with `REPLACE_EXISTING` on Windows,
|
||||
`rename` on Unix, then the folder is flushed on Unix).
|
||||
3. `<name>.custos.tmp` is renamed over `<name>.custos` (`std::fs::rename`, which replaces the target; on
|
||||
Unix the folder is flushed afterwards). A rename refused because a sync client or virus scanner holds
|
||||
the file open is retried for about two seconds.
|
||||
|
||||
A crash in step 1 or 2 leaves the old vault untouched; a crash between 2 and 3 leaves both the old vault
|
||||
and an identical `.bak`. Leftover `.tmp` files are ignored and overwritten by the next save.
|
||||
|
||||
Reference in New Issue
Block a user