secretive/Sources/Packages/Sources/SecretKit/Types/SigningRequestProvenance.swift

54 lines
1.2 KiB
Swift
Raw Normal View History

2020-03-17 07:56:55 +00:00
import Foundation
import AppKit
2020-03-24 06:22:22 +00:00
public struct SigningRequestProvenance: Equatable {
2020-03-17 07:56:55 +00:00
public var chain: [Process]
public init(root: Process) {
self.chain = [root]
}
}
extension SigningRequestProvenance {
public var origin: Process {
chain.last!
}
2020-03-18 06:28:51 +00:00
public var intact: Bool {
chain.allSatisfy { $0.validSignature }
2020-03-18 06:28:51 +00:00
}
2020-03-17 07:56:55 +00:00
}
extension SigningRequestProvenance {
2020-03-24 06:22:22 +00:00
public struct Process: Equatable {
2020-03-17 07:56:55 +00:00
public let pid: Int32
public let processName: String
public let appName: String?
public let iconURL: URL?
2020-03-17 07:56:55 +00:00
public let path: String
2020-03-18 05:59:03 +00:00
public let validSignature: Bool
public let parentPID: Int32?
2020-03-17 07:56:55 +00:00
public init(pid: Int32, processName: String, appName: String?, iconURL: URL?, path: String, validSignature: Bool, parentPID: Int32?) {
2020-03-17 07:56:55 +00:00
self.pid = pid
self.processName = processName
self.appName = appName
self.iconURL = iconURL
2020-03-17 07:56:55 +00:00
self.path = path
2020-03-18 06:28:51 +00:00
self.validSignature = validSignature
2020-03-17 07:56:55 +00:00
self.parentPID = parentPID
}
public var displayName: String {
appName ?? processName
}
2020-03-17 07:56:55 +00:00
}
}