mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 08:10:59 +00:00
Renaming
This commit is contained in:
parent
7631b92afb
commit
b6704c1099
8 changed files with 18 additions and 18 deletions
|
@ -53,7 +53,7 @@ extension AppEnvironment {
|
|||
extension IdentitiesService {
|
||||
static func fresh(
|
||||
identityDatabase: IdentityDatabase = .fresh(),
|
||||
keychainService: KeychainServiceType = MockKeychainService(),
|
||||
keychainService: KeychainService = MockKeychainService(),
|
||||
environment: AppEnvironment = .development) -> IdentitiesService {
|
||||
IdentitiesService(
|
||||
identityDatabase: identityDatabase,
|
||||
|
|
|
@ -10,7 +10,7 @@ extension MockKeychainService {
|
|||
}
|
||||
}
|
||||
|
||||
extension MockKeychainService: KeychainServiceType {
|
||||
extension MockKeychainService: KeychainService {
|
||||
static func setGenericPassword(data: Data, forAccount key: String, service: String) throws {
|
||||
items[key] = data
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
class MockWebAuthSession: WebAuthSessionType {
|
||||
class MockWebAuthSession: WebAuthSession {
|
||||
let completionHandler: WebAuthSessionCompletionHandler
|
||||
let url: URL
|
||||
let callbackURLScheme: String?
|
||||
|
|
|
@ -4,14 +4,14 @@ import Foundation
|
|||
|
||||
struct AppEnvironment {
|
||||
let session: Session
|
||||
let webAuthSessionType: WebAuthSessionType.Type
|
||||
let keychainServiceType: KeychainServiceType.Type
|
||||
let webAuthSessionType: WebAuthSession.Type
|
||||
let keychainServiceType: KeychainService.Type
|
||||
let userDefaults: UserDefaults = .standard
|
||||
}
|
||||
|
||||
extension AppEnvironment {
|
||||
static let live: Self = Self(
|
||||
session: Session(configuration: .default),
|
||||
webAuthSessionType: WebAuthSession.self,
|
||||
keychainServiceType: KeychainService.self)
|
||||
webAuthSessionType: LiveWebAuthSession.self,
|
||||
keychainServiceType: LiveKeychainService.self)
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import Foundation
|
|||
import AuthenticationServices
|
||||
import Combine
|
||||
|
||||
protocol WebAuthSessionType: AnyObject {
|
||||
protocol WebAuthSession: AnyObject {
|
||||
init(url URL: URL,
|
||||
callbackURLScheme: String?,
|
||||
completionHandler: @escaping WebAuthSessionCompletionHandler)
|
||||
|
@ -12,7 +12,7 @@ protocol WebAuthSessionType: AnyObject {
|
|||
@discardableResult func start() -> Bool
|
||||
}
|
||||
|
||||
extension WebAuthSessionType {
|
||||
extension WebAuthSession {
|
||||
static func publisher(
|
||||
url: URL,
|
||||
callbackURLScheme: String?,
|
||||
|
@ -44,6 +44,6 @@ class WebAuthSessionContextProvider: NSObject, ASWebAuthenticationPresentationCo
|
|||
typealias WebAuthSessionCompletionHandler = ASWebAuthenticationSession.CompletionHandler
|
||||
typealias WebAuthSessionError = ASWebAuthenticationSessionError
|
||||
typealias WebAuthPresentationContextProviding = ASWebAuthenticationPresentationContextProviding
|
||||
typealias WebAuthSession = ASWebAuthenticationSession
|
||||
typealias LiveWebAuthSession = ASWebAuthenticationSession
|
||||
|
||||
extension WebAuthSession: WebAuthSessionType {}
|
||||
extension LiveWebAuthSession: WebAuthSession {}
|
||||
|
|
|
@ -5,7 +5,7 @@ import Combine
|
|||
|
||||
struct AuthenticationService {
|
||||
private let networkClient: MastodonClient
|
||||
private let webAuthSessionType: WebAuthSessionType.Type
|
||||
private let webAuthSessionType: WebAuthSession.Type
|
||||
private let webAuthSessionContextProvider = WebAuthSessionContextProvider()
|
||||
|
||||
init(environment: AppEnvironment) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
protocol KeychainServiceType {
|
||||
protocol KeychainService {
|
||||
static func setGenericPassword(data: Data, forAccount key: String, service: String) throws
|
||||
static func deleteGenericPassword(account: String, service: String) throws
|
||||
static func getGenericPassword(account: String, service: String) throws -> Data?
|
||||
|
@ -10,9 +10,9 @@ protocol KeychainServiceType {
|
|||
static func getPrivateKey(applicationTag: String) throws -> Data?
|
||||
}
|
||||
|
||||
struct KeychainService {}
|
||||
struct LiveKeychainService {}
|
||||
|
||||
extension KeychainService: KeychainServiceType {
|
||||
extension LiveKeychainService: KeychainService {
|
||||
static func setGenericPassword(data: Data, forAccount account: String, service: String) throws {
|
||||
var query = genericPasswordQueryDictionary(account: account, service: service)
|
||||
|
||||
|
@ -84,7 +84,7 @@ extension KeychainService: KeychainServiceType {
|
|||
}
|
||||
}
|
||||
|
||||
private extension KeychainService {
|
||||
private extension LiveKeychainService {
|
||||
static let keySizeInBits = 256
|
||||
|
||||
static func genericPasswordQueryDictionary(account: String, service: String) -> [String: Any] {
|
||||
|
|
|
@ -13,9 +13,9 @@ enum SecretsStorableError: Error {
|
|||
|
||||
struct SecretsService {
|
||||
let identityID: UUID
|
||||
private let keychainServiceType: KeychainServiceType.Type
|
||||
private let keychainServiceType: KeychainService.Type
|
||||
|
||||
init(identityID: UUID, keychainServiceType: KeychainServiceType.Type) {
|
||||
init(identityID: UUID, keychainServiceType: KeychainService.Type) {
|
||||
self.identityID = identityID
|
||||
self.keychainServiceType = keychainServiceType
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue