From 060469201081e33be916ea9fa16fbca1a56909a6 Mon Sep 17 00:00:00 2001 From: Aleksey Zgurskiy Date: Sun, 8 Mar 2020 17:42:22 +0200 Subject: [PATCH 1/2] Add keychain protocol --- keychain-kit/Sources/Keychain.swift | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/keychain-kit/Sources/Keychain.swift b/keychain-kit/Sources/Keychain.swift index 4b2038b..5df6fea 100644 --- a/keychain-kit/Sources/Keychain.swift +++ b/keychain-kit/Sources/Keychain.swift @@ -8,7 +8,21 @@ import Foundation -public struct Keychain { +public protocol KeychainProtocol { + func get(_ key: String) throws -> Data + func get(_ key: String) throws -> String + func get(_ key: String) throws -> UUID + func get(_ key: String, decoder: JSONDecoder) throws -> T where T: Decodable + + func set(_ data: Data, for key: String) throws + func set(_ value: String, for key: String) throws + func set(_ uuid: UUID, for key: String) throws + func set(_ value: T, for key: String, encoder: JSONEncoder) throws where T: Encodable + + func delete(_ key: String) throws +} + +public struct Keychain: KeychainProtocol { public enum Error: Swift.Error { case noData case unexpectedData From d9814c2cc87b935c4b30105bfef2ab3b9fe00824 Mon Sep 17 00:00:00 2001 From: Aleksey Zgurskiy Date: Sun, 8 Mar 2020 17:43:09 +0200 Subject: [PATCH 2/2] Update version --- keychain-kit.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keychain-kit.xcodeproj/project.pbxproj b/keychain-kit.xcodeproj/project.pbxproj index 9a70958..4c558d0 100644 --- a/keychain-kit.xcodeproj/project.pbxproj +++ b/keychain-kit.xcodeproj/project.pbxproj @@ -302,7 +302,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.1.1; + MARKETING_VERSION = 1.1.2; PRODUCT_BUNDLE_IDENTIFIER = "com.mr-noone.keychain-kit"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -327,7 +327,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.1.1; + MARKETING_VERSION = 1.1.2; PRODUCT_BUNDLE_IDENTIFIER = "com.mr-noone.keychain-kit"; SKIP_INSTALL = YES; SWIFT_VERSION = 5.0;