Fix for SecretAgent acting as if it has no keys after updating macOS (#427)

* Allow reload pre-op

* Fix tests

* Make sure standin keys get rewritten on force update

* Stub store
This commit is contained in:
Max Goedjen
2022-12-17 23:16:56 -08:00
committed by GitHub
parent 382913cb99
commit 3b254d33a5
7 changed files with 70 additions and 31 deletions

View File

@@ -89,6 +89,19 @@ extension SmartCard {
public func persistAuthentication(secret: SmartCard.Secret, forDuration: TimeInterval) throws {
}
/// Reloads all secrets from the store.
public func reloadSecrets() {
DispatchQueue.main.async {
self.isAvailable = self.tokenID != nil
let before = self.secrets
self.secrets.removeAll()
self.loadSecrets()
if self.secrets != before {
NotificationCenter.default.post(name: .secretStoreReloaded, object: self)
}
}
}
}
}
@@ -102,15 +115,6 @@ extension SmartCard.Store {
reloadSecrets()
}
/// Reloads all secrets from the store.
private func reloadSecrets() {
DispatchQueue.main.async {
self.isAvailable = self.tokenID != nil
self.secrets.removeAll()
self.loadSecrets()
}
}
/// Loads all secrets from the store.
private func loadSecrets() {
guard let tokenID = tokenID else { return }