Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update passkey registration UI (#520)
Leendert de Borste85a3cab7f58
diff --git a/apps/mobile-app/ios/Autofill/en.lproj/Localizable.strings b/apps/mobile-app/ios/Autofill/en.lproj/Localizable.stringsindex d07f74070..cba9c432b 100644Binary files a/apps/mobile-app/ios/Autofill/en.lproj/Localizable.strings and b/apps/mobile-app/ios/Autofill/en.lproj/Localizable.strings differdiff --git a/apps/mobile-app/ios/VaultUI/Views/PasskeyProviderView.swift b/apps/mobile-app/ios/VaultUI/Views/PasskeyProviderView.swiftindex 327caafd0..c1c24cfb2 100644--- a/apps/mobile-app/ios/VaultUI/Views/PasskeyProviderView.swift+++ b/apps/mobile-app/ios/VaultUI/Views/PasskeyProviderView.swift@@ -105,7 +105,7 @@ public struct PasskeyProviderView: View {// MARK: - Passkey Credential Card-struct PasskeyCredentialCard: View {+private struct PasskeyCredentialCard: View {let credential: Credentiallet rpId: String?let action: () -> Void@@ -267,3 +267,238 @@ public class PasskeyProviderViewModel: ObservableObject {showError = false}}++// MARK: - Previews+#if DEBUG+#Preview("Loading State") {+ let viewModel = PasskeyProviderViewModel(+ loader: {+ try? await Task.sleep(nanoseconds: 2_000_000_000)+ return []+ },+ selectionHandler: { _ in },+ cancelHandler: { },+ rpId: "example.com"+ )+ return PasskeyProviderView(viewModel: viewModel)+ .preferredColorScheme(.light)+}++#Preview("Light Mode - With Passkeys") {+ let mockPasskey1 = Passkey(+ id: UUID(),+ parentCredentialId: UUID(),+ rpId: "github.com",+ userHandle: Data(),+ userName: "[email protected]",+ publicKey: Data(),+ privateKey: Data(),+ prfKey: nil,+ displayName: "GitHub",+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ )++ let mockPasskey2 = Passkey(+ id: UUID(),+ parentCredentialId: UUID(),+ rpId: "google.com",+ userHandle: Data(),+ userName: "[email protected]",+ publicKey: Data(),+ privateKey: Data(),+ prfKey: nil,+ displayName: "Google",+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ )++ let mockCredentials = [+ Credential(+ id: UUID(),+ alias: Alias(+ id: UUID(),+ gender: "Not specified",+ firstName: "John",+ lastName: "Doe",+ nickName: "JD",+ birthDate: Date(),+ email: "[email protected]",+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ ),+ service: Service(+ id: UUID(),+ name: "GitHub",+ url: "https://github.com",+ logo: nil,+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ ),+ username: "johndoe",+ notes: nil,+ password: Password(+ id: UUID(),+ credentialId: UUID(),+ value: "password123",+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ ),+ passkeys: [mockPasskey1],+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ ),+ Credential(+ id: UUID(),+ alias: Alias(+ id: UUID(),+ gender: "Not specified",+ firstName: "John",+ lastName: "Doe",+ nickName: "JD",+ birthDate: Date(),+ email: "[email protected]",+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ ),+ service: Service(+ id: UUID(),+ name: "Google",+ url: "https://google.com",+ logo: nil,+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ ),+ username: nil,+ notes: nil,+ password: Password(+ id: UUID(),+ credentialId: UUID(),+ value: "password456",+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ ),+ passkeys: [mockPasskey2],+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ )+ ]++ let viewModel = PasskeyProviderViewModel(+ loader: { mockCredentials },+ selectionHandler: { _ in },+ cancelHandler: { },+ rpId: "github.com"+ )+ viewModel.credentials = mockCredentials+ viewModel.filteredCredentials = mockCredentials+ viewModel.isLoading = false++ return PasskeyProviderView(viewModel: viewModel)+ .preferredColorScheme(.light)+}++#Preview("Dark Mode - With Passkeys") {+ let mockPasskey = Passkey(+ id: UUID(),+ parentCredentialId: UUID(),+ rpId: "github.com",+ userHandle: Data(),+ userName: "[email protected]",+ publicKey: Data(),+ privateKey: Data(),+ prfKey: nil,+ displayName: "GitHub",+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ )++ let mockCredentials = [+ Credential(+ id: UUID(),+ alias: Alias(+ id: UUID(),+ gender: "Not specified",+ firstName: "John",+ lastName: "Doe",+ nickName: "JD",+ birthDate: Date(),+ email: "[email protected]",+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ ),+ service: Service(+ id: UUID(),+ name: "GitHub",+ url: "https://github.com",+ logo: nil,+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ ),+ username: "johndoe",+ notes: nil,+ password: nil,+ passkeys: [mockPasskey],+ createdAt: Date(),+ updatedAt: Date(),+ isDeleted: false+ )+ ]++ let viewModel = PasskeyProviderViewModel(+ loader: { mockCredentials },+ selectionHandler: { _ in },+ cancelHandler: { },+ rpId: "github.com"+ )+ viewModel.credentials = mockCredentials+ viewModel.filteredCredentials = mockCredentials+ viewModel.isLoading = false++ return PasskeyProviderView(viewModel: viewModel)+ .preferredColorScheme(.dark)+}++#Preview("Empty State") {+ let viewModel = PasskeyProviderViewModel(+ loader: { [] },+ selectionHandler: { _ in },+ cancelHandler: { },+ rpId: "example.com"+ )+ viewModel.credentials = []+ viewModel.filteredCredentials = []+ viewModel.isLoading = false++ return PasskeyProviderView(viewModel: viewModel)+ .preferredColorScheme(.light)+}++#Preview("Error State") {+ let viewModel = PasskeyProviderViewModel(+ loader: { [] },+ selectionHandler: { _ in },+ cancelHandler: { },+ rpId: "example.com"+ )+ viewModel.isLoading = false+ viewModel.showError = true+ viewModel.errorMessage = "Failed to load passkeys. Please open the AliasVault app to check for updates."++ return PasskeyProviderView(viewModel: viewModel)+ .preferredColorScheme(.light)+}+#endifdiff --git a/apps/mobile-app/ios/VaultUI/Views/PasskeyRegistrationView.swift b/apps/mobile-app/ios/VaultUI/Views/PasskeyRegistrationView.swiftindex 4036f6e9e..c3260739b 100644--- a/apps/mobile-app/ios/VaultUI/Views/PasskeyRegistrationView.swift+++ b/apps/mobile-app/ios/VaultUI/Views/PasskeyRegistrationView.swift@@ -58,25 +58,6 @@ public struct PasskeyRegistrationView: View {}.padding(.horizontal)- // Info box- HStack(alignment: .top, spacing: 12) {- Image(systemName: "info.circle.fill")- .foregroundColor(ColorConstants.Light.primary)- .font(.system(size: 20))-- Text(NSLocalizedString("passkey_registration_info", comment: ""))- .font(.footnote)- .foregroundColor(colorScheme == .dark ? ColorConstants.Dark.text : ColorConstants.Light.text)- .fixedSize(horizontal: false, vertical: true)- }- .padding()- .background(- (colorScheme == .dark ? ColorConstants.Dark.accentBackground : ColorConstants.Light.accentBackground)- .opacity(0.5)- )- .cornerRadius(12)- .padding(.horizontal)-Spacer()// Action buttons@@ -311,41 +292,57 @@ public class PasskeyRegistrationViewModel: ObservableObject {// MARK: - Previews#if DEBUG-private struct PasskeyRegistrationView_Previews: PreviewProvider {- static var previews: some View {- PasskeyRegistrationView(- viewModel: PasskeyRegistrationViewModel(- requestId: "12345678-1234-1234-1234-123456789012",- rpId: "example.com",- origin: "https://example.com",- userName: "[email protected]",- userDisplayName: "John Doe",- completionHandler: { success in- print("Open app completed with success: \(success)")- },- cancelHandler: {- print("Cancel tapped")- }- )+#Preview("Light Mode - With Username") {+ PasskeyRegistrationView(+ viewModel: PasskeyRegistrationViewModel(+ requestId: "12345678-1234-1234-1234-123456789012",+ rpId: "example.com",+ origin: "https://example.com",+ userName: "[email protected]",+ userDisplayName: "John Doe",+ completionHandler: { success in+ print("Open app completed with success: \(success)")+ },+ cancelHandler: {+ print("Cancel tapped")+ })- .preferredColorScheme(.light)+ )+ .preferredColorScheme(.light)+}- PasskeyRegistrationView(- viewModel: PasskeyRegistrationViewModel(- requestId: "12345678-1234-1234-1234-123456789012",- rpId: "example.com",- origin: "https://example.com",- userName: nil,- userDisplayName: nil,- completionHandler: { success in- print("Open app completed with success: \(success)")- },- cancelHandler: {- print("Cancel tapped")- }- )+#Preview("Dark Mode - No Username") {+ PasskeyRegistrationView(+ viewModel: PasskeyRegistrationViewModel(+ requestId: "12345678-1234-1234-1234-123456789012",+ rpId: "example.com",+ origin: "https://example.com",+ userName: nil,+ userDisplayName: nil,+ completionHandler: { success in+ print("Open app completed with success: \(success)")+ },+ cancelHandler: {+ print("Cancel tapped")+ })- .preferredColorScheme(.dark)- }+ )+ .preferredColorScheme(.dark)+}++#Preview("Loading State") {+ let viewModel = PasskeyRegistrationViewModel(+ requestId: "12345678-1234-1234-1234-123456789012",+ rpId: "example.com",+ origin: "https://example.com",+ userName: "[email protected]",+ userDisplayName: "John Doe",+ completionHandler: { _ in },+ cancelHandler: { }+ )+ viewModel.isLoading = true+ viewModel.loadingMessage = "Creating passkey"+ return PasskeyRegistrationView(viewModel: viewModel)+ .preferredColorScheme(.light)}#endif