metatext-app-ios-iphone-ipad/Services/Sources/ServiceMocks/MockKeychainService.swift

43 lines
1.1 KiB
Swift
Raw Normal View History

2020-08-09 03:29:05 +02:00
// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
2020-08-31 12:21:01 +02:00
import Services
2020-08-09 03:29:05 +02:00
2020-08-12 09:24:39 +02:00
struct MockKeychainService {}
extension MockKeychainService {
static func reset() {
items = [String: Data]()
}
2020-08-09 03:29:05 +02:00
}
2020-08-12 11:01:21 +02:00
extension MockKeychainService: KeychainService {
2020-08-12 09:24:39 +02:00
static func setGenericPassword(data: Data, forAccount key: String, service: String) throws {
2020-08-09 03:29:05 +02:00
items[key] = data
}
2020-08-12 09:24:39 +02:00
static func deleteGenericPassword(account: String, service: String) throws {
items[account] = nil
}
static func getGenericPassword(account: String, service: String) throws -> Data? {
items[account]
2020-08-09 03:29:05 +02:00
}
static func generateKeyAndReturnPublicKey(applicationTag: String, attributes: [String: Any]) throws -> Data {
2020-08-12 09:24:39 +02:00
fatalError("not implemented")
2020-08-09 03:29:05 +02:00
}
2020-08-12 09:24:39 +02:00
static func getPrivateKey(applicationTag: String, attributes: [String: Any]) throws -> Data? {
2020-08-12 09:24:39 +02:00
fatalError("not implemented")
}
2020-08-14 03:59:17 +02:00
static func deleteKey(applicationTag: String) throws {
fatalError("not implemented")
}
2020-08-12 09:24:39 +02:00
}
private extension MockKeychainService {
static var items = [String: Data]()
2020-08-09 03:29:05 +02:00
}