pub struct MasterKey { /* private fields */ }Expand description
Master key derived from user password
Implementations§
Source§impl MasterKey
impl MasterKey
Sourcepub fn derive_from_password(password: &str, salt: &[u8]) -> CryptoResult<Self>
pub fn derive_from_password(password: &str, salt: &[u8]) -> CryptoResult<Self>
Derive master key from password using Argon2id
Uses secure defaults: 256MB memory, 4 iterations, 4 parallelism
Sourcepub fn generate() -> CryptoResult<Self>
pub fn generate() -> CryptoResult<Self>
Generate a random master key (for testing or key escrow)
Sourcepub fn generate_salt() -> [u8; 16]
pub fn generate_salt() -> [u8; 16]
Generate a random salt for password derivation
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 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