mirror of
https://github.com/insidegui/VirtualBuddy.git
synced 2026-12-02 00:39:46 +08:00
23 lines
913 B
Swift
23 lines
913 B
Swift
import Foundation
|
|
import CryptoKit
|
|
|
|
/// Represents an app/process that's attempting to open a deep link in the app.
|
|
public struct DeepLinkClient: Identifiable {
|
|
/// The client ID is a SHA256 hash of its designated CS requirement.
|
|
public var id: String
|
|
/// The bundle URL for the app or executable URL for the process.
|
|
public var url: URL
|
|
/// The designated code signing requirement for the client.
|
|
/// This is hashed and used as a key to store the user's decision,
|
|
/// and it's also used in order to verify that the client's code signature is valid.
|
|
public var designatedRequirement: String
|
|
|
|
public init(url: URL, designatedRequirement: String) {
|
|
self.url = url
|
|
self.designatedRequirement = designatedRequirement
|
|
self.id = SHA256.hash(data: Data(designatedRequirement.utf8))
|
|
.map { String(format: "%02X", $0) }
|
|
.joined()
|
|
}
|
|
}
|