Fixed setting LAContext (may only be set when saving item)
This commit is contained in:
parent
ab5506f7eb
commit
97b78bd8c4
|
@ -160,9 +160,8 @@ class AuthenticationService {
|
|||
.userPresence,
|
||||
nil) // Ignore any error.
|
||||
|
||||
// TODO: this does not work yet, setting LAContext results in a "unexpectedPasswordData" error
|
||||
// context = LAContext()
|
||||
// context?.touchIDAuthenticationAllowableReuseDuration = 45
|
||||
context = LAContext()
|
||||
context?.touchIDAuthenticationAllowableReuseDuration = 45
|
||||
}
|
||||
|
||||
return KeychainPasswordItem(service: Self.DefaultPasswordKeychainAccountName, account: nil, accessGroup: nil, secAccessControl: accessControl, authenticationContext: context)
|
||||
|
|
|
@ -135,7 +135,12 @@ struct KeychainPasswordItem {
|
|||
var attributesToUpdate = [String : AnyObject]()
|
||||
attributesToUpdate[kSecValueData as String] = encodedPassword as AnyObject?
|
||||
|
||||
let query = keychainQuery()
|
||||
var query = keychainQuery()
|
||||
|
||||
if let authenticationContext = authenticationContext {
|
||||
query[kSecUseAuthenticationContext as String] = authenticationContext
|
||||
}
|
||||
|
||||
let status = SecItemUpdate(query as CFDictionary, attributesToUpdate as CFDictionary)
|
||||
|
||||
// Throw an error if an unexpected status was returned.
|
||||
|
@ -198,10 +203,6 @@ struct KeychainPasswordItem {
|
|||
query[kSecAttrAccessControl as String] = accessControl as AnyObject?
|
||||
}
|
||||
|
||||
if let authenticationContext = authenticationContext {
|
||||
query[kSecUseAuthenticationContext as String] = authenticationContext
|
||||
}
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue