Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Refactor (#1347)
Leendert de Borst76b829eb3d9a
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.ktindex 2f2791750..a21e3b792 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStore.kt@@ -624,24 +624,16 @@ class VaultStore(/*** Authenticate the user using biometric authentication only.- * Note: This method only handles biometric authentication. If PIN is enabled,- * this will return false and the caller should use showPinUnlock instead.+ * Note: This method only handles biometric authentication.* Returns true if authentication succeeded, false otherwise.** @param title The title for authentication. Optional, defaults to "Unlock Vault".- * @param subtitle The subtitle for authentication. Optional, defaults to title or "Unlock Vault".- * @return True if biometric authentication succeeded, false if PIN is enabled or authentication failed.+ * @return True if biometric authentication succeeded, false if authentication failed.*/- suspend fun authenticateUser(title: String?, subtitle: String?): Boolean {+ suspend fun issueBiometricAuthentication(title: String?): Boolean {// Use title if provided, otherwise defaultval authReason = title?.takeIf { it.isNotEmpty() } ?: "Unlock Vault"- // Check if PIN is enabled - if so, return false (caller should use PIN UI)- if (isPinEnabled()) {- Log.d("VaultStore", "PIN authentication is enabled, returning false")- return false- }-// Check if biometric authentication is enabledval authMethods = auth.getAuthMethods()val isBiometricEnabled = authMethods.contains("faceid")diff --git a/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift b/apps/mobile-app/ios/NativeVaultManager/VaultManager.swiftindex 621963e3a..1b4e6699f 100644--- a/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift+++ b/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift@@ -975,7 +975,7 @@ public class VaultManager: NSObject {}} else {// Use biometric authentication- let authenticated = vaultStore.authenticateUser(title: title, subtitle: subtitle)+ let authenticated = vaultStore.issueBiometricAuthentication(title: title)resolve(authenticated)}}diff --git a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Auth.swift b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Auth.swiftindex 10c5ef2db..775fb397b 100644--- a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Auth.swift+++ b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Auth.swift@@ -43,21 +43,13 @@ extension VaultStore {}/// Authenticate the user using biometric authentication only- /// Note: This method only handles biometric authentication. If PIN is enabled,- /// this will return false and the caller should use showPinUnlock instead.+ /// Note: This method only handles biometric authentication./// Returns true if authentication succeeded, false otherwise/// - Parameter title: The title for authentication. Optional, defaults to "Unlock Vault" context.- /// - Parameter subtitle: The subtitle for authentication. Optional, defaults to title or "Unlock Vault" context.- public func authenticateUser(title: String?, subtitle: String?) -> Bool {+ public func issueBiometricAuthentication(title: String?) -> Bool {// Use title if provided, otherwise defaultlet authReason = (title?.isEmpty == false) ? title! : "Unlock Vault"- // Check if PIN is enabled - if so, return false (caller should use PIN UI)- if isPinEnabled() {- print("PIN authentication is enabled, returning false")- return false- }-// Check if biometric authentication is enabledguard self.enabledAuthMethods.contains(.faceID) else {print("No authentication method enabled")diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Admin/PasswordLockoutTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Admin/PasswordLockoutTests.csindex 918c5ddef..39fe5c27c 100644--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Admin/PasswordLockoutTests.cs+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Admin/PasswordLockoutTests.cs@@ -32,7 +32,7 @@ public class PasswordLockoutTests : AdminPlaywrightTest{await Page.Locator("input[id='username']").FillAsync(TestUserUsername);await Page.Locator("input[id='password']").FillAsync("wrongpassword");- var submitButton = Page.Locator("#login-button");+ var submitButton = Page.GetByRole(AriaRole.Button, new() { Name = "Login" });await submitButton.ClickAsync();// Wait for the text "Error: Invalid login attempt." to appear if we expect not to be locked out yet..diff --git a/apps/server/Tests/AliasVault.E2ETests/Tests/Admin/TwoFactorAuthLockoutTests.cs b/apps/server/Tests/AliasVault.E2ETests/Tests/Admin/TwoFactorAuthLockoutTests.csindex 82dbb6709..fc26d6272 100644--- a/apps/server/Tests/AliasVault.E2ETests/Tests/Admin/TwoFactorAuthLockoutTests.cs+++ b/apps/server/Tests/AliasVault.E2ETests/Tests/Admin/TwoFactorAuthLockoutTests.cs@@ -62,7 +62,7 @@ public class TwoFactorAuthLockoutTests : AdminPlaywrightTest{ "password", TestUserPassword },});- submitButton = Page.Locator("#login-button");+ submitButton = Page.GetByRole(AriaRole.Button, new() { Name = "Login" });await submitButton.ClickAsync();// Wait for 2FA page.