pub struct AuthService { /* private fields */ }Expand description
Unified authentication service for all UI frontends
Implementations§
Source§impl AuthService
impl AuthService
Sourcepub fn new(storage_manager: EncryptedStorageManager) -> Self
pub fn new(storage_manager: EncryptedStorageManager) -> Self
Create new auth service with storage manager
Sourcepub fn storage_manager(&self) -> &EncryptedStorageManager
pub fn storage_manager(&self) -> &EncryptedStorageManager
Get reference to storage manager
Sourcepub fn storage_manager_mut(&mut self) -> &mut EncryptedStorageManager
pub fn storage_manager_mut(&mut self) -> &mut EncryptedStorageManager
Get mutable reference to storage manager
Sourcepub async fn create_vault(
&mut self,
four_words: &str,
password: &str,
display_name: &str,
) -> Result<String>
pub async fn create_vault( &mut self, four_words: &str, password: &str, display_name: &str, ) -> Result<String>
Create a new vault for a four-word identity
This creates an encrypted vault with PBKDF2 key derivation (100,000 iterations) and ChaCha20-Poly1305 encryption.
Sourcepub async fn login(
&mut self,
four_words: &str,
password: &str,
_device_name: Option<&str>,
) -> Result<SessionInfo>
pub async fn login( &mut self, four_words: &str, password: &str, _device_name: Option<&str>, ) -> Result<SessionInfo>
Login with four-word identity and password
On success, stores session and optionally saves password to keyring for auto-login.
Sourcepub fn get_current_session(&self) -> Option<SessionInfo>
pub fn get_current_session(&self) -> Option<SessionInfo>
Get current active session
Sourcepub fn is_logged_in(&self) -> bool
pub fn is_logged_in(&self) -> bool
Check if user is currently logged in
Sourcepub async fn list_vaults(&self) -> Result<Vec<VaultInfo>>
pub async fn list_vaults(&self) -> Result<Vec<VaultInfo>>
List all available vaults
Sourcepub async fn get_recent_identities(&self) -> Result<Vec<RecentIdentity>>
pub async fn get_recent_identities(&self) -> Result<Vec<RecentIdentity>>
Get recent identities (sorted by last used, max 10)
Sourcepub async fn remove_recent_identity(&mut self, four_words: &str) -> Result<()>
pub async fn remove_recent_identity(&mut self, four_words: &str) -> Result<()>
Remove a recent identity from the list (does not delete the vault)
Sourcepub async fn vault_exists(&self, four_words: &str) -> Result<bool>
pub async fn vault_exists(&self, four_words: &str) -> Result<bool>
Check if vault exists for four-word identity
Sourcepub async fn delete_vault(
&mut self,
four_words: &str,
password: &str,
) -> Result<()>
pub async fn delete_vault( &mut self, four_words: &str, password: &str, ) -> Result<()>
Delete a vault (requires password confirmation)
Sourcepub async fn passkey_register(
&mut self,
four_words: &str,
device_name: &str,
) -> Result<PasskeyInfo>
pub async fn passkey_register( &mut self, four_words: &str, device_name: &str, ) -> Result<PasskeyInfo>
Register a passkey for biometric authentication (legacy - without WebAuthn)
This enables Touch ID, Face ID, or Windows Hello for the identity. The password is stored in the platform keyring for secure retrieval.
Sourcepub async fn passkey_register_webauthn(
&mut self,
four_words: &str,
device_name: &str,
credential: WebAuthnCredential,
) -> Result<PasskeyInfo>
pub async fn passkey_register_webauthn( &mut self, four_words: &str, device_name: &str, credential: WebAuthnCredential, ) -> Result<PasskeyInfo>
Register a passkey with WebAuthn credential
This stores the WebAuthn credential for true biometric authentication.
Sourcepub async fn passkey_authenticate(
&mut self,
four_words: &str,
) -> Result<SessionInfo>
pub async fn passkey_authenticate( &mut self, four_words: &str, ) -> Result<SessionInfo>
Authenticate using passkey/biometric
This retrieves the password from keyring and performs standard vault login.
Sourcepub async fn passkey_has_passkey(&self, four_words: &str) -> Result<bool>
pub async fn passkey_has_passkey(&self, four_words: &str) -> Result<bool>
Check if identity has a registered passkey
Sourcepub async fn passkey_get_info(&self, four_words: &str) -> Result<PasskeyInfo>
pub async fn passkey_get_info(&self, four_words: &str) -> Result<PasskeyInfo>
Get passkey information for an identity
Sourcepub async fn passkey_delete(&mut self, four_words: &str) -> Result<()>
pub async fn passkey_delete(&mut self, four_words: &str) -> Result<()>
Delete passkey for an identity
Sourcepub async fn try_auto_login(&mut self) -> Result<Option<SessionInfo>>
pub async fn try_auto_login(&mut self) -> Result<Option<SessionInfo>>
Attempt auto-login using last-used identity
Returns session info if successful, None if no auto-login available.
Sourcepub async fn enable_auto_login(&mut self, password: &str) -> Result<()>
pub async fn enable_auto_login(&mut self, password: &str) -> Result<()>
Enable auto-login for current session
Stores password in keyring so passkey authentication can work.
Sourcepub async fn disable_auto_login(&mut self, four_words: &str) -> Result<()>
pub async fn disable_auto_login(&mut self, four_words: &str) -> Result<()>
Disable auto-login for an identity
Sourcepub async fn switch_identity(&mut self, four_words: &str) -> Result<SessionInfo>
pub async fn switch_identity(&mut self, four_words: &str) -> Result<SessionInfo>
Switch to another identity (logout current, login new)