Skip to content

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

Tweak if available iOS flags (#520)

Leendert de Borstefaa7962cb55
diff --git a/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift b/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift
index 3051bfd7f..64e29f9e7 100644
--- a/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift
+++ b/apps/mobile-app/ios/NativeVaultManager/VaultManager.swift
@@ -444,18 +444,16 @@ public class VaultManager: NSObject {
// Get all credentials from the vault
let credentials = try vaultStore.getAllCredentials()
- // Register credential identities using the same logic as the autofill extension
if #available(iOS 26.0, *) {
// iOS 26+: Register both passwords and passkeys for QuickType and manual selection
try await CredentialIdentityStore.shared.saveCredentialIdentities(credentials)
} else {
- // iOS 17-25: Only register passkeys (skip passwords for QuickType to avoid biometric issues)
- // But passkeys MUST be registered so iOS knows to offer this extension for passkey authentication
+ // iOS 17 and 18: Only register passkeys (skip passwords for QuickType as biometric unlock is buggy on these versions)
let passkeyOnlyCredentials = credentials.filter { credential in
guard let passkeys = credential.passkeys else { return false }
return !passkeys.isEmpty
}
- try await CredentialIdentityStore.shared.saveCredentialIdentities(passkeyOnlyCredentials, passkeyOnly: true)
+ try await CredentialIdentityStore.shared.saveCredentialIdentities(passkeyOnlyCredentials)
}
await MainActor.run {
diff --git a/apps/mobile-app/ios/VaultStoreKit/CredentialIdentityStore.swift b/apps/mobile-app/ios/VaultStoreKit/CredentialIdentityStore.swift
index 91b14b9ab..3cf2b4852 100644
--- a/apps/mobile-app/ios/VaultStoreKit/CredentialIdentityStore.swift
+++ b/apps/mobile-app/ios/VaultStoreKit/CredentialIdentityStore.swift
@@ -18,8 +18,7 @@ public class CredentialIdentityStore {
/// Save credentials into the native iOS credential store.
/// - Parameters:
/// - credentials: The credentials to register
- /// - passkeyOnly: If true, only register passkey identities (skip passwords). Default is false.
- public func saveCredentialIdentities(_ credentials: [Credential], passkeyOnly: Bool = false) async throws {
+ public func saveCredentialIdentities(_ credentials: [Credential]) async throws {
var allIdentities: [ASCredentialIdentity] = []
let state = await storeState()
@@ -27,15 +26,11 @@ public class CredentialIdentityStore {
return
}
- // Only save passwords into autofill store on iOS 26+, as it works buggy on older iOS versions.
- if #available(iOS 26.0, *) {
- if !passkeyOnly {
- let passwordIdentities = createPasswordIdentities(from: credentials)
- allIdentities.append(contentsOf: passwordIdentities)
- }
- }
+ // Save passwords into autofill store
+ let passwordIdentities = createPasswordIdentities(from: credentials)
+ allIdentities.append(contentsOf: passwordIdentities)
- // Create passkey identities
+ // Save passkeys into autofill store
let passkeyIdentities = createPasskeyIdentities(from: credentials)
allIdentities.append(contentsOf: passkeyIdentities)
@@ -60,30 +55,6 @@ public class CredentialIdentityStore {
try await store.removeAllCredentialIdentities()
}
- /// Remove one or more specific credentials from iOS credential store.
- public func removeCredentialIdentities(_ credentials: [Credential]) async throws {
- let identities = credentials.compactMap { credential -> ASPasswordCredentialIdentity? in
- let serviceIdentifier = ASCredentialServiceIdentifier(
- identifier: credential.service.name ?? "",
- type: .domain
- )
-
- // Use the same logic as the UI for determining the identifier
- let identifier = CredentialHelpers.usernameOrEmail(credential: credential)
- guard !identifier.isEmpty else {
- return nil // Skip credentials with no identifier
- }
-
- return ASPasswordCredentialIdentity(
- serviceIdentifier: serviceIdentifier,
- user: identifier,
- recordIdentifier: credential.id.uuidString
- )
- }
-
- try await store.removeCredentialIdentities(identities)
- }
-
private func storeState() async -> ASCredentialIdentityStoreState {
await withCheckedContinuation { continuation in
store.getState { state in
@@ -101,22 +72,27 @@ public class CredentialIdentityStore {
/// Create password credential identities from credentials
private func createPasswordIdentities(from credentials: [Credential]) -> [ASPasswordCredentialIdentity] {
return credentials.compactMap { credential in
+ guard credential.passkeys?.isEmpty == true else {
+ // Skip if this record is a passkey as it will be saved in the createPasskeyIdentities method
+ return nil
+ }
+
+ guard let password = credential.password, !password.value.isEmpty else {
+ // Skip credentials with no password (e.g. applies when this record is a passkey)
+ return nil
+ }
+
guard let urlString = credential.service.url,
let url = URL(string: urlString),
let host = url.host else {
return nil
}
- // Use the same logic as the UI for determining the identifier
let identifier = CredentialHelpers.usernameOrEmail(credential: credential)
guard !identifier.isEmpty else {
return nil // Skip credentials with no identifier
}
- guard let password = credential.password, !password.value.isEmpty else {
- return nil // Skip credentials with no password (e.g. applies when this record is a passkey)
- }
-
let effectiveDomain = Self.effectiveDomain(from: host)
return ASPasswordCredentialIdentity(