diff --git a/ui/BankingiOSApp/BankingiOSApp/Security/AuthenticationService.swift b/ui/BankingiOSApp/BankingiOSApp/Security/AuthenticationService.swift index 2881701e..916feef7 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Security/AuthenticationService.swift +++ b/ui/BankingiOSApp/BankingiOSApp/Security/AuthenticationService.swift @@ -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) diff --git a/ui/BankingiOSApp/BankingiOSApp/Security/KeychainPasswordItem.swift b/ui/BankingiOSApp/BankingiOSApp/Security/KeychainPasswordItem.swift index 696a80fd..8356a697 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Security/KeychainPasswordItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/Security/KeychainPasswordItem.swift @@ -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 }