Skip to content

feat(kryphos): add fjall-backed vault storage with advisory locking#35

Merged
forkwright merged 1 commit intomainfrom
feat/kryphos-storage
Mar 17, 2026
Merged

feat(kryphos): add fjall-backed vault storage with advisory locking#35
forkwright merged 1 commit intomainfrom
feat/kryphos-storage

Conversation

@forkwright
Copy link
Owner

Summary

  • Implement Vault struct backed by fjall for encrypted credential CRUD
  • create/open with Argon2id key derivation and ChaCha20-Poly1305 key check verification
  • add/get/list/remove for credential management, each entry individually encrypted
  • Advisory file locking (fs2) to prevent concurrent vault access
  • 10 tests covering all acceptance criteria: round-trip, wrong passphrase rejection, duplicate detection, persistence, concurrent open detection

Test plan

  • Vault::create + Vault::open round-trip works
  • addget returns original secret
  • list returns metadata without decrypted secrets
  • remove deletes the entry
  • Wrong passphrase on open returns error (not garbage data)
  • Concurrent open fails with lock error
  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes (307 tests, 0 failures)

Observations

  • Debt: Two SALT_LEN constants exist (vault::SALT_LEN = 16, crypto::SALT_LEN = 32). The vault header used 16-byte salts; the new storage module uses 32-byte salts from crypto::generate_salt(). Should unify. (crates/kryphos/src/vault.rs:12, crates/kryphos/src/crypto.rs:14)
  • Idea: DecryptedEntry.secret is a plain Vec<u8>. Consider wrapping in zeroize::Zeroizing<Vec<u8>> so secrets are cleared on drop.

🤖 Generated with Claude Code

Implement Vault struct providing encrypted credential CRUD over fjall.
Each entry is individually encrypted with ChaCha20-Poly1305 using a key
derived from the user's passphrase via Argon2id. Advisory file locking
(fs2) prevents concurrent access.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

⚠️ Large PR detected — 6 files, 780 lines changed.

Consider splitting into smaller PRs for easier review. Not a blocker, just a signal.

@forkwright forkwright merged commit b83eb1b into main Mar 17, 2026
12 of 13 checks passed
@forkwright forkwright deleted the feat/kryphos-storage branch March 18, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant