mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
#40: Add basic AuthenticationService and missing UI tests.
* Add MockAuthenticationService and ServerSelectionUITests. * Add tests covering the Authentication flow.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// AuthenticationServiceProtocol.swift
|
||||
// ElementX
|
||||
//
|
||||
// Created by Doug on 29/06/2022.
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum AuthenticationServiceError: Error {
|
||||
case invalidServer
|
||||
case invalidCredentials
|
||||
case accountDeactivated
|
||||
case failedLoggingIn
|
||||
}
|
||||
|
||||
@MainActor
|
||||
protocol AuthenticationServiceProtocol {
|
||||
var homeserver: LoginHomeserver { get }
|
||||
|
||||
/// Sets up the service for login on the specified homeserver address.
|
||||
func startLogin(for homeserverAddress: String) async -> Result<Void, AuthenticationServiceError>
|
||||
/// Performs a password login using the current homeserver.
|
||||
func login(username: String, password: String) async -> Result<UserSessionProtocol, AuthenticationServiceError>
|
||||
}
|
||||
Reference in New Issue
Block a user