mirror of
https://github.com/bitwarden/ios.git
synced 2025-12-12 07:43:01 -06:00
24 lines
696 B
Swift
24 lines
696 B
Swift
import AuthenticatorBridgeKit
|
|
import Foundation
|
|
|
|
public class MockSharedKeychainStorage: SharedKeychainStorage {
|
|
public var storage = [SharedKeychainItem: any Codable]()
|
|
|
|
public init() {}
|
|
|
|
public func deleteValue(for item: SharedKeychainItem) async throws {
|
|
storage[item] = nil
|
|
}
|
|
|
|
public func getValue<T>(for item: SharedKeychainItem) async throws -> T where T: Codable {
|
|
guard let stored = storage[item] as? T else {
|
|
throw SharedKeychainServiceError.keyNotFound(item)
|
|
}
|
|
return stored
|
|
}
|
|
|
|
public func setValue<T>(_ value: T, for item: SharedKeychainItem) async throws where T: Codable {
|
|
storage[item] = value
|
|
}
|
|
}
|