mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-03-05 09:24:49 +01:00
Request Attribution (#59)
This commit is contained in:
@@ -14,7 +14,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}()
|
||||
let notifier = Notifier()
|
||||
lazy var agent: Agent = {
|
||||
Agent(storeList: storeList/*, notifier: notifier*/)
|
||||
Agent(storeList: storeList, witness: notifier)
|
||||
}()
|
||||
lazy var socketController: SocketController = {
|
||||
let path = (NSHomeDirectory() as NSString).appendingPathComponent("socket.ssh") as String
|
||||
|
||||
@@ -11,11 +11,11 @@ class Notifier {
|
||||
}
|
||||
}
|
||||
|
||||
func notify(accessTo secret: AnySecret) {
|
||||
func notify(accessTo secret: AnySecret, by provenance: SigningRequestProvenance) {
|
||||
let notificationCenter = UNUserNotificationCenter.current()
|
||||
let notificationContent = UNMutableNotificationContent()
|
||||
notificationContent.title = "Signed Request"
|
||||
notificationContent.body = "\(secret.name) was used to sign a request."
|
||||
notificationContent.body = "\(secret.name) was used to sign a request from \(provenance.origin.name)."
|
||||
let request = UNNotificationRequest(identifier: UUID().uuidString, content: notificationContent, trigger: nil)
|
||||
notificationCenter.add(request, withCompletionHandler: nil)
|
||||
}
|
||||
@@ -24,8 +24,8 @@ class Notifier {
|
||||
|
||||
extension Notifier: SigningWitness {
|
||||
|
||||
func witness(accessTo secret: AnySecret) throws {
|
||||
notify(accessTo: secret)
|
||||
func witness(accessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws {
|
||||
notify(accessTo: secret, by: provenance)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user