Skip to main content

Module private_store

Module private_store 

Source
Expand description

Encrypted per-session history store.

§Wire format (per session file)

nonce(12B, OsRng) || AES-256-GCM(plaintext=serde_json(entries), aad=session_uuid.as_bytes())
  • Nonce: 12 fresh random bytes from OsRng on every write. Never reused.
  • AAD: the 16-byte session UUID binds the ciphertext to its filename, preventing file-swap attacks.
  • Key: Zeroizing<[u8; 32]> derived by the caller (native: from signing key seed via derive_key; browser: session-scoped Web Crypto key).
  • Writes: atomic — {uuid}.enc.tmp → fs::rename → {uuid}.enc.

Structs§

ConversationMeta
Metadata for a single private conversation (stored in the manifest).
FsBackend
Filesystem backend.
MemoryBackend
In-memory backend for tests and ephemeral sessions.
PrivateStore
Encrypted per-session history store.

Traits§

StorageBackend
Backend abstraction for raw byte reads and atomic writes.

Type Aliases§

StorageKey
32-byte AES-256 key, zeroed on drop.