|
@@ -389,6 +389,12 @@ public final class Keychain {
|
|
|
return options.authenticationPrompt
|
|
|
}
|
|
|
|
|
|
+ @available(iOS 9.0, OSX 10.11, *)
|
|
|
+ @available(watchOS, unavailable)
|
|
|
+ public var authenticationContext: Any? {
|
|
|
+ return options.authenticationContext
|
|
|
+ }
|
|
|
+
|
|
|
fileprivate let options: Options
|
|
|
|
|
|
// MARK:
|
|
@@ -489,6 +495,14 @@ public final class Keychain {
|
|
|
return Keychain(options)
|
|
|
}
|
|
|
|
|
|
+ @available(iOS 9.0, OSX 10.11, *)
|
|
|
+ @available(watchOS, unavailable)
|
|
|
+ public func authenticationContext(_ authenticationContext: Any) -> Keychain {
|
|
|
+ var options = self.options
|
|
|
+ options.authenticationContext = authenticationContext
|
|
|
+ return Keychain(options)
|
|
|
+ }
|
|
|
+
|
|
|
// MARK:
|
|
|
|
|
|
public func get(_ key: String) throws -> String? {
|
|
@@ -1050,6 +1064,7 @@ struct Options {
|
|
|
var comment: String?
|
|
|
|
|
|
var authenticationPrompt: String?
|
|
|
+ var authenticationContext: Any?
|
|
|
|
|
|
var attributes = [String: Any]()
|
|
|
}
|
|
@@ -1186,6 +1201,14 @@ extension Options {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ #if os(iOS) || os(macOS)
|
|
|
+ if #available(iOS 9.0, OSX 10.11, *) {
|
|
|
+ if authenticationContext != nil {
|
|
|
+ query[UseAuthenticationContext] = authenticationContext
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endif
|
|
|
+
|
|
|
return query
|
|
|
}
|
|
|
|