mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-04-09 18:57:22 +02:00
Compare commits
7 Commits
de8d18f9e9
...
experiment
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1947b326a4 | ||
|
|
3df4bcef3c | ||
|
|
18ba03bf03 | ||
|
|
85a7a64bc9 | ||
|
|
409efa5f9f | ||
|
|
bb63ae8469 | ||
|
|
30c1d36974 |
4
.github/workflows/nightly.yml
vendored
4
.github/workflows/nightly.yml
vendored
@@ -5,8 +5,8 @@ on:
|
||||
- cron: "0 8 * * *"
|
||||
jobs:
|
||||
build:
|
||||
# runs-on: macOS-latest
|
||||
runs-on: macos-13
|
||||
# runs-on: macOS-latest-xlarge
|
||||
runs-on: macos-13-xlarge
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -6,8 +6,8 @@ on:
|
||||
- '*'
|
||||
jobs:
|
||||
test:
|
||||
# runs-on: macOS-latest
|
||||
runs-on: macos-13
|
||||
# runs-on: macOS-latest-xlarge
|
||||
runs-on: macos-13-xlarge
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -3,8 +3,8 @@ name: Test
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
test:
|
||||
# runs-on: macOS-latest
|
||||
runs-on: macos-13
|
||||
# runs-on: macOS-latest-xlarge
|
||||
runs-on: macos-13-xlarge
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
{
|
||||
"sourceLanguage" : "en",
|
||||
"strings" : {
|
||||
"\n" : {
|
||||
|
||||
},
|
||||
"\n\n" : {
|
||||
|
||||
},
|
||||
"agent_not_running_notice_title" : {
|
||||
"localizations" : {
|
||||
"de" : {
|
||||
@@ -429,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",
|
||||
@@ -465,6 +465,12 @@
|
||||
"value" : "déverrouiller le secret \"%1$@\""
|
||||
}
|
||||
},
|
||||
"it" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "sblocca il Segreto \"%1$@\""
|
||||
}
|
||||
},
|
||||
"pt-BR" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
@@ -501,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",
|
||||
@@ -537,6 +549,12 @@
|
||||
"value" : "Refuser"
|
||||
}
|
||||
},
|
||||
"it" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Nega"
|
||||
}
|
||||
},
|
||||
"pt-BR" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
@@ -573,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",
|
||||
@@ -609,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",
|
||||
@@ -645,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",
|
||||
@@ -2124,6 +2160,12 @@
|
||||
"value" : "Enclave sécurisée"
|
||||
}
|
||||
},
|
||||
"it" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Secure Enclave"
|
||||
}
|
||||
},
|
||||
"pt-BR" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
@@ -2843,6 +2885,12 @@
|
||||
"value" : "Carte à puce"
|
||||
}
|
||||
},
|
||||
"it" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Smart Card"
|
||||
}
|
||||
},
|
||||
"pt-BR" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
@@ -2878,6 +2926,12 @@
|
||||
"value" : "Sans nom"
|
||||
}
|
||||
},
|
||||
"it" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Anonimo"
|
||||
}
|
||||
},
|
||||
"pt-BR" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
@@ -3368,6 +3422,12 @@
|
||||
"value" : "Secretive %1$@"
|
||||
}
|
||||
},
|
||||
"pt-BR" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Secretive %1$@"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
|
||||
@@ -26,7 +26,7 @@ struct SetupView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(idealWidth: 500, idealHeight: 500)
|
||||
.frame(minWidth: 500, idealWidth: 500, minHeight: 500, idealHeight: 500)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,16 +42,16 @@ struct UpdateDetailView<UpdaterType: Updater>: View {
|
||||
if let prefix = split.first {
|
||||
switch prefix {
|
||||
case "#":
|
||||
attributed = Text(unprefixed).font(.title) + Text("\n")
|
||||
attributed = Text(unprefixed).font(.title) + Text(verbatim: "\n")
|
||||
case "##":
|
||||
attributed = Text(unprefixed).font(.title2) + Text("\n")
|
||||
attributed = Text(unprefixed).font(.title2) + Text(verbatim: "\n")
|
||||
case "###":
|
||||
attributed = Text(unprefixed).font(.title3) + Text("\n")
|
||||
attributed = Text(unprefixed).font(.title3) + Text(verbatim: "\n")
|
||||
default:
|
||||
attributed = Text(line) + Text("\n\n")
|
||||
attributed = Text(line) + Text(verbatim: "\n\n")
|
||||
}
|
||||
} else {
|
||||
attributed = Text(line) + Text("\n\n")
|
||||
attributed = Text(line) + Text(verbatim: "\n\n")
|
||||
}
|
||||
text = text + attributed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user