pub struct PasswordBackend { /* private fields */ }Expand description
Password-based vault authentication.
Uses Argon2id to derive a KEK from password bytes, then wraps/unwraps
the master key via AES-256-GCM in a .password-wrap blob.
Password bytes must be injected via with_password() before calling
unlock() or enroll().
Implementations§
Source§impl PasswordBackend
impl PasswordBackend
pub fn new() -> Self
Sourcepub fn with_password(self, password: SecureVec) -> Self
pub fn with_password(self, password: SecureVec) -> Self
Inject password bytes for the next unlock/enroll operation.
The password is stored in a SecureVec (mlock’d, zeroize-on-drop).
Sourcepub fn set_password(&mut self, password: SecureVec)
pub fn set_password(&mut self, password: SecureVec)
Set password bytes on an existing instance.
Trait Implementations§
Source§impl Default for PasswordBackend
impl Default for PasswordBackend
Source§impl VaultAuthBackend for PasswordBackend
impl VaultAuthBackend for PasswordBackend
Source§fn backend_id(&self) -> &str
fn backend_id(&self) -> &str
Short identifier for IPC messages and config.
Source§fn is_enrolled(&self, profile: &TrustProfileName, config_dir: &Path) -> bool
fn is_enrolled(&self, profile: &TrustProfileName, config_dir: &Path) -> bool
Check whether this backend has a valid enrollment for the profile.
Source§fn can_unlock<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
profile: &'life1 TrustProfileName,
config_dir: &'life2 Path,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn can_unlock<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
profile: &'life1 TrustProfileName,
config_dir: &'life2 Path,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check whether this backend can currently perform an unlock.
Must be fast (< 100ms).
Source§fn requires_interaction(&self) -> AuthInteraction
fn requires_interaction(&self) -> AuthInteraction
What kind of user interaction this backend requires.
Source§fn unlock<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
profile: &'life1 TrustProfileName,
config_dir: &'life2 Path,
salt: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<UnlockOutcome, AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn unlock<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
profile: &'life1 TrustProfileName,
config_dir: &'life2 Path,
salt: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<UnlockOutcome, AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Attempt to derive/unwrap the master key for a profile.
Source§fn enroll<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
profile: &'life1 TrustProfileName,
master_key: &'life2 SecureBytes,
config_dir: &'life3 Path,
salt: &'life4 [u8],
_selected_key_index: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn enroll<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
profile: &'life1 TrustProfileName,
master_key: &'life2 SecureBytes,
config_dir: &'life3 Path,
salt: &'life4 [u8],
_selected_key_index: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Enroll this backend for a profile. Requires the master key. Read more
Source§fn revoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
profile: &'life1 TrustProfileName,
config_dir: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn revoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
profile: &'life1 TrustProfileName,
config_dir: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove enrollment for this backend.
Auto Trait Implementations§
impl Freeze for PasswordBackend
impl RefUnwindSafe for PasswordBackend
impl Send for PasswordBackend
impl Sync for PasswordBackend
impl Unpin for PasswordBackend
impl UnwindSafe for PasswordBackend
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