Compare commits

..

4 Commits

Author SHA1 Message Date
1947b326a4 Scheudle timer on mian 2024-01-20 19:47:55 -08:00
3df4bcef3c . 2024-01-20 19:08:20 -08:00
18ba03bf03 . 2024-01-20 19:07:00 -08:00
85a7a64bc9 Updated Italian localization strings (#520)
* 🇮🇹 Initial proposal for Italian localization

* 🇮🇹 Updated Italian localization

---------

Co-authored-by: Max Goedjen <max.goedjen@gmail.com>
2024-01-18 17:35:36 +00:00
5 changed files with 81 additions and 4 deletions

View File

@ -44,7 +44,7 @@ let package = Package(
.target(
name: "SecureEnclaveSecretKit",
dependencies: ["SecretKit"],
swiftSettings: [.enableExperimentalFeature("StrictConcurrency"), .unsafeFlags(["-warnings-as-errors"])]
swiftSettings: [.unsafeFlags(["-warnings-as-errors"])]
),
.target(
name: "SmartCardSecretKit",

View File

@ -17,7 +17,7 @@ public protocol Secret: Identifiable, Hashable {
}
/// The type of algorithm the Secret uses. Currently, only elliptic curve algorithms are supported.
public enum Algorithm: Hashable {
public enum Algorithm: Hashable, Sendable {
case ellipticCurve
case rsa

View File

@ -5,7 +5,7 @@ import SecretKit
extension SecureEnclave {
/// An implementation of Secret backed by the Secure Enclave.
public struct Secret: SecretKit.Secret {
public struct Secret: SecretKit.Secret, Sendable {
public let id: Data
public let name: String

View File

@ -180,7 +180,7 @@ extension SecureEnclave {
public func persistAuthentication(secret: Secret, forDuration duration: TimeInterval) throws {
let newContext = LAContext()
newContext.touchIDAuthenticationAllowableReuseDuration = duration
newContext.touchIDAuthenticationAllowableReuseDuration = max(duration, LATouchIDAuthenticationMaximumAllowableReuseDuration)
newContext.localizedCancelTitle = String(localized: "auth_context_request_deny_button")
let formatter = DateComponentsFormatter()
@ -196,6 +196,23 @@ extension SecureEnclave {
guard success else { return }
let context = PersistentAuthenticationContext(secret: secret, context: newContext, duration: duration)
self?.persistedAuthenticationContexts[secret] = context
// Contexts will expire within LATouchIDAuthenticationMaximumAllowableReuseDuration unless we periodically refresh them
if duration > LATouchIDAuthenticationMaximumAllowableReuseDuration {
DispatchQueue.main.async {
Timer.scheduledTimer(withTimeInterval: LATouchIDAuthenticationMaximumAllowableReuseDuration - 10, repeats: true) { [weak self] timer in
print("Refreshing context")
guard let refreshContext = self?.persistedAuthenticationContexts[secret] else { return }
guard refreshContext.valid else {
timer.invalidate()
return
}
refreshContext.context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Refresh") { success, _ in
guard success else { return }
print("Refreshed")
}
}
}
}
}
}

View File

@ -423,6 +423,12 @@
"value" : "déverrouiller le secret \"%1$@\" pendant %2$@"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "sblocca il Segreto \"%1$@\" per %2$@"
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
@ -459,6 +465,12 @@
"value" : "déverrouiller le secret \"%1$@\""
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "sblocca il Segreto \"%1$@\""
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
@ -495,6 +507,12 @@
"value" : "déchiffrer les données en utilisant le secret \"%1$@\"."
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "decifra i dati usando il Segreto \"%1$@\""
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
@ -531,6 +549,12 @@
"value" : "Refuser"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Nega"
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
@ -567,6 +591,12 @@
"value" : "chiffrer les données en utilisant le secret \"%1$@\""
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "cifra i dati usando il Segreto \"%1$@\""
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
@ -603,6 +633,12 @@
"value" : "signer une requête de \"%1$@\" en utilisant le secret \"%2$@\""
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "firma la richiesta di \"%1$@\" usando il Segreto \"%2$@\""
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
@ -639,6 +675,12 @@
"value" : "vérifier une signature en utilisant le secret \"%1$@\""
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "verifica una firma usando il segreto \"%1$@\""
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
@ -2118,6 +2160,12 @@
"value" : "Enclave sécurisée"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Secure Enclave"
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
@ -2837,6 +2885,12 @@
"value" : "Carte à puce"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Smart Card"
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
@ -2872,6 +2926,12 @@
"value" : "Sans nom"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Anonimo"
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",