metatext/Development Assets/MockKeychainService.swift

42 lines
1.1 KiB
Swift
Raw Normal View History

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