Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Make autofill work in simulator and fix password get (#771)

Leendert de Borst1c3627d98502
diff --git a/mobile-app/ios/Autofill/CredentialProviderView.swift b/mobile-app/ios/Autofill/CredentialProviderView.swift
index 7ed627d58..25b6f0512 100644
--- a/mobile-app/ios/Autofill/CredentialProviderView.swift
+++ b/mobile-app/ios/Autofill/CredentialProviderView.swift
@@ -329,7 +329,7 @@ class CredentialProviderViewModel: ObservableObject {
// Note: We need to get the password from the Password model
// This will need to be updated once we have access to the Password model
- let passwordCredential = ASPasswordCredential(user: username, password: "")
+ let passwordCredential = ASPasswordCredential(user: username, password: credential.password?.value ?? "")
extensionContext?.completeRequest(withSelectedCredential: passwordCredential,
completionHandler: nil)
}
@@ -346,10 +346,10 @@ class CredentialProviderViewModel: ObservableObject {
updatedAt: Date(),
isDeleted: false
)
-
+
let password = Password(
id: UUID(),
- credentialId: UUID(),
+ credentialId: UUID(),
value: newPassword,
createdAt: Date(),
updatedAt: Date(),
diff --git a/mobile-app/ios/VaultStore/VaultStore.swift b/mobile-app/ios/VaultStore/VaultStore.swift
index f01cf1efd..cb819df74 100644
--- a/mobile-app/ios/VaultStore/VaultStore.swift
+++ b/mobile-app/ios/VaultStore/VaultStore.swift
@@ -151,9 +151,14 @@ public class VaultStore {
let context = LAContext()
var error: NSError?
- guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
- throw NSError(domain: "VaultStore", code: 2, userInfo: [NSLocalizedDescriptionKey: "Face ID not available: \(error?.localizedDescription ?? "Unknown error")"])
- }
+ #if targetEnvironment(simulator)
+ print("Simulator detected, skipping biometric policy evaluation check and continuing with key retrieval from keychain")
+ #else
+ guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
+ throw NSError(domain: "VaultStore", code: 2, userInfo: [NSLocalizedDescriptionKey: "Face ID not available: \(error?.localizedDescription ?? "Unknown error")"])
+ }
+ #endif
+
// Get the encryption key from keychain
print("Attempting to get encryption key from keychain as Face ID is enabled as an option")
@@ -578,28 +583,6 @@ public class VaultStore {
return db.changes
}
- // MARK: - Biometric Authentication
-
- func authenticateWithBiometrics() async throws -> Bool {
- let context = LAContext()
- var error: NSError?
-
- guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
- throw error ?? NSError(domain: "VaultStore", code: 5, userInfo: [NSLocalizedDescriptionKey: "Biometrics not available"])
- }
-
- return try await withCheckedThrowingContinuation { continuation in
- context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics,
- localizedReason: "Authenticate to access your credentials") { success, error in
- if let error = error {
- continuation.resume(throwing: error)
- } else {
- continuation.resume(returning: success)
- }
- }
- }
- }
-
// MARK: - Auto Lock Timeout Management
func setAutoLockTimeout(_ timeout: Int) {
print("Setting auto-lock timeout to \(timeout) seconds")
@@ -614,7 +597,7 @@ public class VaultStore {
private func parseDateString(_ dateString: String) -> Date? {
// Date formatter for parsing SQLite datetime strings
- var dateFormatter: DateFormatter = {
+ let dateFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS"
formatter.locale = Locale(identifier: "en_US_POSIX")