Make sure standin keys get rewritten on force update

This commit is contained in:
Max Goedjen 2022-12-17 22:13:19 -08:00
parent 632e33aa4f
commit f7df712980
No known key found for this signature in database
2 changed files with 11 additions and 4 deletions

View File

@ -164,7 +164,7 @@ extension SecureEnclave {
} }
public func reloadSecrets() { public func reloadSecrets() {
reloadSecretsInternal() reloadSecretsInternal(notifyAgent: false)
} }
} }
@ -176,11 +176,14 @@ extension SecureEnclave.Store {
/// Reloads all secrets from the store. /// Reloads all secrets from the store.
/// - Parameter notifyAgent: A boolean indicating whether a distributed notification should be posted, notifying other processes (ie, the SecretAgent) to reload their stores as well. /// - Parameter notifyAgent: A boolean indicating whether a distributed notification should be posted, notifying other processes (ie, the SecretAgent) to reload their stores as well.
private func reloadSecretsInternal(notifyAgent: Bool = true) { private func reloadSecretsInternal(notifyAgent: Bool = true) {
let before = secrets
secrets.removeAll() secrets.removeAll()
loadSecrets() loadSecrets()
NotificationCenter.default.post(name: .secretStoreReloaded, object: self) if secrets != before {
if notifyAgent { NotificationCenter.default.post(name: .secretStoreReloaded, object: self)
DistributedNotificationCenter.default().postNotificationName(.secretStoreUpdated, object: nil, deliverImmediately: true) if notifyAgent {
DistributedNotificationCenter.default().postNotificationName(.secretStoreUpdated, object: nil, deliverImmediately: true)
}
} }
} }

View File

@ -93,8 +93,12 @@ extension SmartCard {
public func reloadSecrets() { public func reloadSecrets() {
DispatchQueue.main.async { DispatchQueue.main.async {
self.isAvailable = self.tokenID != nil self.isAvailable = self.tokenID != nil
let before = self.secrets
self.secrets.removeAll() self.secrets.removeAll()
self.loadSecrets() self.loadSecrets()
if self.secrets != before {
NotificationCenter.default.post(name: .secretStoreReloaded, object: self)
}
} }
} }