bjosodium 0.2.0: keys are AeadKey, nonces AeadNonce, costs explicit

- The DEK of a vault, its earlier keys and the KEKs are AeadKey. Unlocked
  and the vault hold them so; copies of their bytes are wiped after a
  wrap or an unwrap.
- Nonces are AeadNonce, made with (bjosodium raw) and read back from the
  files with bytes->aead-nonce.
- The Argon2id cost of a slot is given as an Argon2idCost, from KeyCost.
- A key id comes from random-bytes.
- The file formats do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Linus Björnstam 2026-11-22 09:59:59 +01:00
parent a4b2aaf94e
commit 3e07b6be4c
6 changed files with 80 additions and 54 deletions

View file

@ -543,7 +543,7 @@
(def a0 (vault-save (fst (add-bookmark (create f (.one f)) "https://example.org/a" []))))
(def mine (own-keys f (.one f)))
;; The same vault id, another key, and another password.
(set-shared-keys! f (wrap-keys (vault-id a0) 7 (make-aead-key XChaCha20Poly1305) "not yours" #:cost cheap))
(set-shared-keys! f (wrap-keys (vault-id a0) 7 (make-aead-key) "not yours" #:cost cheap))
(def (Tuple a1 report) (sync (opened (reopen f (.one f) "hunter2"))))
(check (told? report "holds none of this device's keys"))
(check (= (urls a1) ["https://example.org/a"]))