Skip to main content

VaultReader

Struct VaultReader 

Source
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

Source

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).

Source

pub fn names(&self) -> impl Iterator<Item = &str>

Entry names, sorted. No decryption.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn contains(&self, name: &str) -> bool

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.