pub struct MasterSecret { /* private fields */ }Expand description
The vault-level KDF output. Derive ONCE per open (the expensive step), then zeroize the passphrase — every other key HKDF-derives from this (spec §4.3). Carries the salt it was derived under so entry/mac/registry keys need no extra context.
Implementations§
Source§impl MasterSecret
impl MasterSecret
Sourcepub fn derive(passphrase: &str, salt: &[u8; 16]) -> Self
pub fn derive(passphrase: &str, salt: &[u8; 16]) -> Self
PBKDF2-HMAC-SHA256 @ 600k over the passphrase. The caller should drop (zeroize) the passphrase immediately after this returns.
Sourcepub fn from_raw_key(key: &[u8; 32], salt: &[u8; 16]) -> Self
pub fn from_raw_key(key: &[u8; 32], salt: &[u8; 16]) -> Self
Wrap an already-random 32-byte key as the master secret (the lease path, LEASE_DESIGN.md §4). A full-entropy key needs no stretching, so PBKDF2 is skipped; every HKDF derivation downstream (entry keys, manifest MAC) is identical to the passphrase path, and the container format is byte-for-byte the same QVLT v2.
pub fn salt(&self) -> &[u8; 16]
Sourcepub fn registry_key(&self) -> Zeroizing<[u8; 32]>
pub fn registry_key(&self) -> Zeroizing<[u8; 32]>
Key for the raw-key registry container (spec §6.2).
Auto Trait Implementations§
impl Freeze for MasterSecret
impl RefUnwindSafe for MasterSecret
impl Send for MasterSecret
impl Sync for MasterSecret
impl Unpin for MasterSecret
impl UnsafeUnpin for MasterSecret
impl UnwindSafe for MasterSecret
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more