Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Refactor old credential Swift references to Item (#1404)
Leendert de Borste8c5b3c56cc9
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultPasskey.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultPasskey.ktindex fc785b28f..30988da15 100644--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultPasskey.kt+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultPasskey.kt@@ -663,9 +663,9 @@ sealed class VaultPasskeyError(message: String) : Exception(message) {class PasskeyNotFound(message: String) : VaultPasskeyError(message)/**- * Error indicating credential was not found.+ * Error indicating item was not found.*/- class CredentialNotFound(message: String) : VaultPasskeyError(message)+ class ItemNotFound(message: String) : VaultPasskeyError(message)/*** Error indicating a database operation failure.diff --git a/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swift b/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swiftindex c0f7a390f..0885565b3 100644--- a/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swift+++ b/apps/mobile-app/ios/Autofill/CredentialProviderViewController+Passkey.swift@@ -369,7 +369,7 @@ extension CredentialProviderViewController: PasskeyProviderDelegate {let now = Date()let passkey = Passkey(id: passkeyId,- parentCredentialId: UUID(), // Will be set by createCredentialWithPasskey+ parentItemId: UUID(), // Will be set by createItemWithPasskeyrpId: rpId,userHandle: userId,userName: userName,@@ -396,9 +396,9 @@ extension CredentialProviderViewController: PasskeyProviderDelegate {logo: logo)} else {- // Store credential with passkey and logo in database- // Use viewModel.displayName as the title (Service.name)- _ = try vaultStore.createCredentialWithPasskey(+ // Store item with passkey and logo in database+ // Use viewModel.displayName as the title (Item.name)+ _ = try vaultStore.createItemWithPasskey(rpId: rpId,userName: userName,displayName: viewModel.displayName,diff --git a/apps/mobile-app/ios/Podfile.lock b/apps/mobile-app/ios/Podfile.lockindex b12c0faf6..20d366cc2 100644--- a/apps/mobile-app/ios/Podfile.lock+++ b/apps/mobile-app/ios/Podfile.lock@@ -2795,8 +2795,8 @@ EXTERNAL SOURCES::path: "../node_modules/react-native/ReactCommon/yoga"SPEC CHECKSUMS:- boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90- DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb+ boost: 1dca942403ed9342f98334bf4c3621f011aa7946+ DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385EXConstants: 98bcf0f22b820f9b28f9fee55ff2daededadd2f8EXJSONUtils: 1d3e4590438c3ee593684186007028a14b3686cdEXManifests: 691a779b04e4f2c96da46fb9bef4f86174fefcb5@@ -2826,8 +2826,8 @@ SPEC CHECKSUMS:EXUpdatesInterface: 7ff005b7af94ee63fa452ea7bb95d7a8ff40277afast_float: 06eeec4fe712a76acc9376682e4808b05ce978b6FBLazyVector: 07309209b7b914451b8f822544a18e2a0a85afff- fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd- glog: 5683914934d5b6e4240e497e0f4a3b42d1854183+ fmt: 01b82d4ca6470831d1cc0852a1af644be019e8f6+ glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6ahermes-engine: 44bb6fe76a6eb400d3a992e2d0b21946ae999fa9Macaw: 7af8ea57aa2cab35b4a52a45e6f85eea753ea9aeOpenSSL-Universal: 6082b0bf950e5636fe0d78def171184e2b3899c2diff --git a/apps/mobile-app/ios/VaultModels/Passkey.swift b/apps/mobile-app/ios/VaultModels/Passkey.swiftindex 38bfbc96a..a93fe694b 100644--- a/apps/mobile-app/ios/VaultModels/Passkey.swift+++ b/apps/mobile-app/ios/VaultModels/Passkey.swift@@ -2,11 +2,11 @@ import Foundation/*** Passkey model representing a WebAuthn credential- * Linked to a parent Credential for UI display (service name, logo, etc.)+ * Linked to a parent Item for UI display (service name, logo, etc.)*/public struct Passkey: Codable, Hashable, Equatable {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 parentItemId: UUID // Parent Item 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,- parentCredentialId: UUID,+ parentItemId: UUID,rpId: String,userHandle: Data?,userName: String?,@@ -33,7 +33,7 @@ public struct Passkey: Codable, Hashable, Equatable {isDeleted: Bool) {self.id = id- self.parentCredentialId = parentCredentialId+ self.parentItemId = parentItemIdself.rpId = rpIdself.userHandle = userHandleself.userName = userNamediff --git a/apps/mobile-app/ios/VaultStoreKit/Database/Mappers/PasskeyMapper.swift b/apps/mobile-app/ios/VaultStoreKit/Database/Mappers/PasskeyMapper.swiftindex 6a207576c..c6394b247 100644--- a/apps/mobile-app/ios/VaultStoreKit/Database/Mappers/PasskeyMapper.swift+++ b/apps/mobile-app/ios/VaultStoreKit/Database/Mappers/PasskeyMapper.swift@@ -94,7 +94,7 @@ public struct PasskeyMapper {public static func mapRow(_ row: PasskeyRow) -> Passkey? {// Parse UUIDsguard let id = UUID(uuidString: row.id),- let parentCredentialId = UUID(uuidString: row.itemId) else {+ let parentItemId = UUID(uuidString: row.itemId) else {print("PasskeyMapper: Invalid UUID - id=\(row.id), itemId=\(row.itemId)")return nil}@@ -115,7 +115,7 @@ public struct PasskeyMapper {return Passkey(id: id,- parentCredentialId: parentCredentialId,+ parentItemId: parentItemId,rpId: row.rpId,userHandle: row.userHandle,userName: nil, // userName not stored in DB, derived from parent credentialdiff --git a/apps/mobile-app/ios/VaultStoreKit/Database/Repositories/PasskeyRepository.swift b/apps/mobile-app/ios/VaultStoreKit/Database/Repositories/PasskeyRepository.swiftindex e796ae407..c1c77fa54 100644--- a/apps/mobile-app/ios/VaultStoreKit/Database/Repositories/PasskeyRepository.swift+++ b/apps/mobile-app/ios/VaultStoreKit/Database/Repositories/PasskeyRepository.swift@@ -81,7 +81,7 @@ public class PasskeyRepository: BaseRepository {try client.executeUpdate(PasskeyQueries.insert, params: [passkeyId,- passkey.parentCredentialId.uuidString.uppercased(),+ passkey.parentItemId.uuidString.uppercased(),passkey.rpId,userHandleParam,publicKeyString,@@ -149,7 +149,7 @@ public class PasskeyRepository: BaseRepository {try client.executeUpdate(PasskeyQueries.insert, params: [newPasskeyId,- newPasskey.parentCredentialId.uuidString.uppercased(),+ newPasskey.parentItemId.uuidString.uppercased(),newPasskey.rpId,userHandleParam,publicKeyString,@@ -185,7 +185,7 @@ public class PasskeyRepository: BaseRepository {logo: Data? = nil) throws -> String {return try withTransaction {- let itemId = passkey.parentCredentialId.uuidString.uppercased()+ let itemId = passkey.parentItemId.uuidString.uppercased()let now = self.now()// Create logo if provideddiff --git a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Passkey.swift b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Passkey.swiftindex 8cd0e53c5..e6bb72de4 100644--- a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Passkey.swift+++ b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Passkey.swift@@ -61,7 +61,7 @@ extension VaultStore {* This creates an Item record with field values and links the passkey to it*/@discardableResult- public func createCredentialWithPasskey(+ public func createItemWithPasskey(rpId: String,userName: String?,displayName: String,@@ -101,7 +101,7 @@ extension VaultStore {throw VaultStoreError.passkeyNotFound}- let itemId = oldPasskey.parentCredentialId+ let itemId = oldPasskey.parentItemId// Update logo if providedif let logo = logo {@@ -115,7 +115,7 @@ extension VaultStore {// Create the new passkey with the same item IDlet updatedPasskey = Passkey(id: newPasskey.id,- parentCredentialId: itemId, // Use the old item ID+ parentItemId: itemId, // Use the old item IDrpId: newPasskey.rpId,userHandle: newPasskey.userHandle,userName: newPasskey.userName,@@ -142,6 +142,6 @@ extension VaultStore {public enum VaultStoreError: Error {case vaultNotUnlockedcase passkeyNotFound- case credentialNotFound+ case itemNotFoundcase databaseError(String)}diff --git a/apps/mobile-app/ios/VaultUI/Selection/PasskeyProviderView.swift b/apps/mobile-app/ios/VaultUI/Selection/PasskeyProviderView.swiftindex d990616a3..52099001a 100644--- a/apps/mobile-app/ios/VaultUI/Selection/PasskeyProviderView.swift+++ b/apps/mobile-app/ios/VaultUI/Selection/PasskeyProviderView.swift@@ -306,7 +306,7 @@ public class PasskeyProviderViewModel: ObservableObject {#Preview("Light Mode - With Passkeys") {let mockPasskey1 = Passkey(id: UUID(),- parentCredentialId: UUID(),+ parentItemId: UUID(),rpId: "github.com",userHandle: Data(),userName: "[email protected]",@@ -321,7 +321,7 @@ public class PasskeyProviderViewModel: ObservableObject {let mockPasskey2 = Passkey(id: UUID(),- parentCredentialId: UUID(),+ parentItemId: UUID(),rpId: "google.com",userHandle: Data(),userName: "[email protected]",@@ -380,7 +380,7 @@ public class PasskeyProviderViewModel: ObservableObject {#Preview("Dark Mode - With Passkeys") {let mockPasskey = Passkey(id: UUID(),- parentCredentialId: UUID(),+ parentItemId: UUID(),rpId: "github.com",userHandle: Data(),userName: "[email protected]",