This commit is contained in:
Max Goedjen 2024-01-20 19:08:20 -08:00
parent 18ba03bf03
commit 3df4bcef3c
No known key found for this signature in database
1 changed files with 3 additions and 0 deletions

View File

@ -199,12 +199,15 @@ extension SecureEnclave {
// Contexts will expire within LATouchIDAuthenticationMaximumAllowableReuseDuration unless we periodically refresh them // Contexts will expire within LATouchIDAuthenticationMaximumAllowableReuseDuration unless we periodically refresh them
if duration > LATouchIDAuthenticationMaximumAllowableReuseDuration { if duration > LATouchIDAuthenticationMaximumAllowableReuseDuration {
Timer.scheduledTimer(withTimeInterval: LATouchIDAuthenticationMaximumAllowableReuseDuration - 10, repeats: true) { [weak self] timer in Timer.scheduledTimer(withTimeInterval: LATouchIDAuthenticationMaximumAllowableReuseDuration - 10, repeats: true) { [weak self] timer in
print("Refreshing context")
guard let refreshContext = self?.persistedAuthenticationContexts[secret] else { return } guard let refreshContext = self?.persistedAuthenticationContexts[secret] else { return }
guard refreshContext.valid else { guard refreshContext.valid else {
timer.invalidate() timer.invalidate()
return return
} }
refreshContext.context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Refresh") { success, _ in refreshContext.context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Refresh") { success, _ in
guard success else { return }
print("Refreshed")
} }
} }
} }