Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Make webauthn quick fill suggestion work (#520)
Leendert de Borstbd78cfe77810
diff --git a/apps/mobile-app/ios/Autofill/CredentialIdentityStore.swift b/apps/mobile-app/ios/Autofill/CredentialIdentityStore.swiftindex 12c959974..5a42eb769 100644--- a/apps/mobile-app/ios/Autofill/CredentialIdentityStore.swift+++ b/apps/mobile-app/ios/Autofill/CredentialIdentityStore.swift@@ -1,5 +1,6 @@import AuthenticationServicesimport VaultModels+import VaultStoreKitimport VaultUI/**@@ -63,19 +64,16 @@ public class CredentialIdentityStore {// Get the userName for display in iOS AutoFill UI// Passkeys don't store userName in the database, so we use the credential's username or emaillet userName = passkey.userName ?? usernameOrEmail(credential: credential)-- // iOS requires a non-empty userName to display the passkey in AutoFill- if userName.isEmpty {- print("CredentialIdentityStore: Skipping passkey \(passkey.id) - userName is empty")- return nil- }++ // Convert passkey.Id to bytes for credentialID+ let credentialId = try? PasskeyHelper.guidToBytes(passkey.id.uuidString)// For passkeys, we use the rpId from the passkey itself, not the service URL// This is because passkeys are tied to the RP ID, which may differ from the service URLreturn ASPasskeyCredentialIdentity(relyingPartyIdentifier: passkey.rpId,userName: userName,- credentialID: passkey.credentialId,+ credentialID: credentialId ?? Data(), // WebAuthn credential ID (16-byte GUID)userHandle: passkey.userHandle ?? Data(),recordIdentifier: passkey.id.uuidString)diff --git a/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swift b/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swiftindex e1e1ca416..a86abe295 100644--- a/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swift+++ b/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swift@@ -312,8 +312,10 @@ extension CredentialProviderViewController {*/private func authenticateWithPasskey(_ passkey: Passkey, clientDataHash: Data, rpId: String) throws {// Generate assertion using PasskeyAuthenticator+ let credentialId = try? PasskeyHelper.guidToBytes(passkey.id.uuidString)+let assertion = try PasskeyAuthenticator.getAssertion(- credentialId: passkey.credentialId,+ credentialId: credentialId ?? Data(),clientDataHash: clientDataHash,rpId: rpId,privateKeyJWK: passkey.privateKey,diff --git a/apps/mobile-app/ios/Autofill/CredentialProviderViewController.swift b/apps/mobile-app/ios/Autofill/CredentialProviderViewController.swiftindex e3743c04d..f6b54b402 100644--- a/apps/mobile-app/ios/Autofill/CredentialProviderViewController.swift+++ b/apps/mobile-app/ios/Autofill/CredentialProviderViewController.swift@@ -265,10 +265,11 @@ public class CredentialProviderViewController: ASCredentialProviderViewControlle))return}-+// Generate assertion+ let credentialId = try? PasskeyHelper.guidToBytes(passkey.id.uuidString)let assertion = try PasskeyAuthenticator.getAssertion(- credentialId: passkey.credentialId,+ credentialId: credentialId ?? Data(),clientDataHash: clientDataHash,rpId: rpId,privateKeyJWK: passkey.privateKey,diff --git a/apps/mobile-app/ios/VaultModels/Passkey.swift b/apps/mobile-app/ios/VaultModels/Passkey.swiftindex 54e438b4d..38bfbc96a 100644--- a/apps/mobile-app/ios/VaultModels/Passkey.swift+++ b/apps/mobile-app/ios/VaultModels/Passkey.swift@@ -5,8 +5,8 @@ import Foundation* Linked to a parent Credential for UI display (service name, logo, etc.)*/public struct Passkey: Codable, Hashable, Equatable {- public let id: UUID- public let credentialId: Data // Credential ID as supplied originally by the RP+ public let id: UUID // Passkey record ID which is also the webauthn credential ID+ public let parentCredentialId: UUID // Parent Credential UUID (AliasVault internal ID)public let rpId: String // Relying party identifier (domain)public let userHandle: Data? // User ID/handle from RP (optional)public let userName: String? // User-visible identifier (typically email)@@ -20,7 +20,7 @@ public struct Passkey: Codable, Hashable, Equatable {public init(id: UUID,- credentialId: Data,+ parentCredentialId: UUID,rpId: String,userHandle: Data?,userName: String?,@@ -33,7 +33,7 @@ public struct Passkey: Codable, Hashable, Equatable {isDeleted: Bool) {self.id = id- self.credentialId = credentialId+ self.parentCredentialId = parentCredentialIdself.rpId = rpIdself.userHandle = userHandleself.userName = userNamediff --git a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Passkey.swift b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Passkey.swiftindex 43a63afe9..496f75826 100644--- a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Passkey.swift+++ b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Passkey.swift@@ -349,24 +349,9 @@ extension VaultStore {let isDeleted = isDeletedInt64 == 1- // Parse WebAuthn credential ID from AdditionalData (stored as blob containing 16-byte GUID)- // This is the actual passkey credential ID that iOS expects for matching- let webauthnCredentialId: Data- if let additionalDataBlob = try? row.get(Self.colAdditionalData) {- webauthnCredentialId = Data(additionalDataBlob.bytes)- } else {- // Fallback: use the passkey record ID as a GUID and convert to bytes- do {- webauthnCredentialId = try PasskeyHelper.guidToBytes(idString)- } catch {- print("VaultStore+Passkey: Failed to convert passkey ID to bytes: \(error)")- webauthnCredentialId = Data()- }- }-return Passkey(id: id,- credentialId: webauthnCredentialId,+ parentCredentialId: parentCredentialId, // Parent Credential UUIDrpId: rpId,userHandle: userId,userName: nil, // userName not stored in DB, derived from parent credential