secretive/SecretAgent/AppDelegate.swift

33 lines
892 B
Swift
Raw Normal View History

2020-03-04 07:14:38 +00:00
import Cocoa
import SecretKit
import OSLog
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
2020-03-07 02:47:19 +00:00
let store = SecureEnclave.Store()
2020-03-04 07:14:38 +00:00
let notifier = Notifier()
lazy var agent: Agent = {
Agent(store: store, notifier: notifier)
}()
lazy var socketController: SocketController = {
let path = (NSHomeDirectory() as NSString).appendingPathComponent("socket.ssh") as String
return SocketController(path: path)
}()
func applicationDidFinishLaunching(_ aNotification: Notification) {
os_log(.debug, "SecretAgent finished launching")
DispatchQueue.main.async {
self.socketController.handler = self.agent.handle(fileHandle:)
}
notifier.prompt()
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
}