pub struct VaultReader { /* private fields */ }Expand description
A validated v2 vault image supporting selective decryption and no-read
splicing (spec §5). Holds the raw bytes; values stay ciphertext until
Self::decrypt_one is called for a specific name.
Implementations§
Source§impl VaultReader
impl VaultReader
Sourcepub fn open(data: Vec<u8>, master: &MasterSecret) -> Result<Self, VaultError>
pub fn open(data: Vec<u8>, master: &MasterSecret) -> Result<Self, VaultError>
Full structural validation + manifest MAC verification (spec §4, normative order: bounds before any length-driven allocation, exact tiling, sorted unique valid names, then MAC).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn contains(&self, name: &str) -> bool
Sourcepub fn decrypt_one(
&self,
master: &MasterSecret,
name: &str,
) -> Result<Zeroizing<Vec<u8>>, VaultError>
pub fn decrypt_one( &self, master: &MasterSecret, name: &str, ) -> Result<Zeroizing<Vec<u8>>, VaultError>
Decrypt exactly one record (G1). Every other entry stays ciphertext. Returns the true-length value bytes.
Sourcepub fn decrypt_all(&self, master: &MasterSecret) -> Result<Vault, VaultError>
pub fn decrypt_all(&self, master: &MasterSecret) -> Result<Vault, VaultError>
Decrypt every entry — for the inherently whole-vault operations
(list, env, export, migration). Discouraged elsewhere.
Sourcepub fn splice(
&self,
master: &MasterSecret,
upserts: &[(String, Zeroizing<Vec<u8>>)],
deletes: &[String],
) -> Result<Vec<u8>, VaultError>
pub fn splice( &self, master: &MasterSecret, upserts: &[(String, Zeroizing<Vec<u8>>)], deletes: &[String], ) -> Result<Vec<u8>, VaultError>
Rebuild the file with upserts applied and deletes removed — WITHOUT
decrypting any untouched entry (spec §5.2): their record bytes are
re-emitted verbatim; only the manifest MAC is recomputed.