pub struct MasterKey { /* private fields */ }Expand description
A wrapper around a 32-byte master key that automatically zeroes its memory when dropped.
Use this to hold the master key in memory so it cannot linger after it is no longer needed.
Implementations§
Source§impl MasterKey
impl MasterKey
Sourcepub fn as_bytes(&self) -> &[u8; 32]
pub fn as_bytes(&self) -> &[u8; 32]
Access the raw key bytes (e.g. to pass to HKDF or encryption).
Sourcepub fn derive_secret_key(&self, secret_name: &str) -> Result<[u8; 32]>
pub fn derive_secret_key(&self, secret_name: &str) -> Result<[u8; 32]>
Derive a per-secret encryption key from this master key.
Sourcepub fn derive_hmac_key(&self) -> Result<[u8; 32]>
pub fn derive_hmac_key(&self) -> Result<[u8; 32]>
Derive an HMAC key from this master key.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MasterKey
impl RefUnwindSafe for MasterKey
impl Send for MasterKey
impl Sync for MasterKey
impl Unpin for MasterKey
impl UnsafeUnpin for MasterKey
impl UnwindSafe for MasterKey
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