mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-07-01 09:43:37 +00:00
Compare commits
4 Commits
v0.0.0_tes
...
experiment
Author | SHA1 | Date | |
---|---|---|---|
1947b326a4 | |||
3df4bcef3c | |||
18ba03bf03 | |||
85a7a64bc9 |
@ -44,7 +44,7 @@ let package = Package(
|
|||||||
.target(
|
.target(
|
||||||
name: "SecureEnclaveSecretKit",
|
name: "SecureEnclaveSecretKit",
|
||||||
dependencies: ["SecretKit"],
|
dependencies: ["SecretKit"],
|
||||||
swiftSettings: [.enableExperimentalFeature("StrictConcurrency"), .unsafeFlags(["-warnings-as-errors"])]
|
swiftSettings: [.unsafeFlags(["-warnings-as-errors"])]
|
||||||
),
|
),
|
||||||
.target(
|
.target(
|
||||||
name: "SmartCardSecretKit",
|
name: "SmartCardSecretKit",
|
||||||
|
@ -17,7 +17,7 @@ public protocol Secret: Identifiable, Hashable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The type of algorithm the Secret uses. Currently, only elliptic curve algorithms are supported.
|
/// 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 ellipticCurve
|
||||||
case rsa
|
case rsa
|
||||||
|
@ -5,7 +5,7 @@ import SecretKit
|
|||||||
extension SecureEnclave {
|
extension SecureEnclave {
|
||||||
|
|
||||||
/// An implementation of Secret backed by the Secure Enclave.
|
/// 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 id: Data
|
||||||
public let name: String
|
public let name: String
|
||||||
|
@ -180,7 +180,7 @@ extension SecureEnclave {
|
|||||||
|
|
||||||
public func persistAuthentication(secret: Secret, forDuration duration: TimeInterval) throws {
|
public func persistAuthentication(secret: Secret, forDuration duration: TimeInterval) throws {
|
||||||
let newContext = LAContext()
|
let newContext = LAContext()
|
||||||
newContext.touchIDAuthenticationAllowableReuseDuration = duration
|
newContext.touchIDAuthenticationAllowableReuseDuration = max(duration, LATouchIDAuthenticationMaximumAllowableReuseDuration)
|
||||||
newContext.localizedCancelTitle = String(localized: "auth_context_request_deny_button")
|
newContext.localizedCancelTitle = String(localized: "auth_context_request_deny_button")
|
||||||
|
|
||||||
let formatter = DateComponentsFormatter()
|
let formatter = DateComponentsFormatter()
|
||||||
@ -196,6 +196,23 @@ extension SecureEnclave {
|
|||||||
guard success else { return }
|
guard success else { return }
|
||||||
let context = PersistentAuthenticationContext(secret: secret, context: newContext, duration: duration)
|
let context = PersistentAuthenticationContext(secret: secret, context: newContext, duration: duration)
|
||||||
self?.persistedAuthenticationContexts[secret] = context
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,6 +423,12 @@
|
|||||||
"value" : "déverrouiller le secret \"%1$@\" pendant %2$@"
|
"value" : "déverrouiller le secret \"%1$@\" pendant %2$@"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"it" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "sblocca il Segreto \"%1$@\" per %2$@"
|
||||||
|
}
|
||||||
|
},
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
@ -459,6 +465,12 @@
|
|||||||
"value" : "déverrouiller le secret \"%1$@\""
|
"value" : "déverrouiller le secret \"%1$@\""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"it" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "sblocca il Segreto \"%1$@\""
|
||||||
|
}
|
||||||
|
},
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
@ -495,6 +507,12 @@
|
|||||||
"value" : "déchiffrer les données en utilisant le secret \"%1$@\"."
|
"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" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
@ -531,6 +549,12 @@
|
|||||||
"value" : "Refuser"
|
"value" : "Refuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"it" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Nega"
|
||||||
|
}
|
||||||
|
},
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
@ -567,6 +591,12 @@
|
|||||||
"value" : "chiffrer les données en utilisant le secret \"%1$@\""
|
"value" : "chiffrer les données en utilisant le secret \"%1$@\""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"it" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "cifra i dati usando il Segreto \"%1$@\""
|
||||||
|
}
|
||||||
|
},
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
@ -603,6 +633,12 @@
|
|||||||
"value" : "signer une requête de \"%1$@\" en utilisant le secret \"%2$@\""
|
"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" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
@ -639,6 +675,12 @@
|
|||||||
"value" : "vérifier une signature en utilisant le secret \"%1$@\""
|
"value" : "vérifier une signature en utilisant le secret \"%1$@\""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"it" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "verifica una firma usando il segreto \"%1$@\""
|
||||||
|
}
|
||||||
|
},
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
@ -2118,6 +2160,12 @@
|
|||||||
"value" : "Enclave sécurisée"
|
"value" : "Enclave sécurisée"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"it" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Secure Enclave"
|
||||||
|
}
|
||||||
|
},
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
@ -2837,6 +2885,12 @@
|
|||||||
"value" : "Carte à puce"
|
"value" : "Carte à puce"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"it" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Smart Card"
|
||||||
|
}
|
||||||
|
},
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
@ -2872,6 +2926,12 @@
|
|||||||
"value" : "Sans nom"
|
"value" : "Sans nom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"it" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Anonimo"
|
||||||
|
}
|
||||||
|
},
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
|
Reference in New Issue
Block a user