Splitting out auth context stuff in preparation for batch

This commit is contained in:
Max Goedjen
2026-04-09 20:43:18 -07:00
parent 4033a5b947
commit b68c82ae69
15 changed files with 82 additions and 189 deletions

View File

@@ -22,9 +22,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}()
private let updater = Updater(checkOnLaunch: true)
private let notifier = Notifier()
private let authenticationHandler = AuthenticationHandler()
private let publicKeyFileStoreController = PublicKeyFileStoreController(directory: URL.publicKeyDirectory)
private lazy var agent: Agent = {
Agent(storeList: storeList, witness: notifier)
Agent(storeList: storeList, authenticationHandler: authenticationHandler, witness: notifier)
}()
private lazy var socketController: SocketController = {
let path = URL.socketPath as String
@@ -50,6 +51,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}
}
Task { [notifier, authenticationHandler] in
await notifier.registerPersistenceHandler {
try await authenticationHandler.persistAuthentication(secret: $0, forDuration: $1)
}
}
Task {
for await _ in NotificationCenter.default.notifications(named: .secretStoreReloaded) {
try? publicKeyFileStoreController.generatePublicKeys(for: storeList.allSecrets, clear: true)