|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
|
|
|
|
|
public struct LokiDeviceLink {
|
|
|
|
|
public struct LokiDeviceLink : Hashable {
|
|
|
|
|
public let master: Device
|
|
|
|
|
public let slave: Device
|
|
|
|
|
|
|
|
|
|
public var isAuthorized: Bool { return master.signature != nil }
|
|
|
|
|
|
|
|
|
|
// MARK: Types
|
|
|
|
|
public struct Device {
|
|
|
|
|
public struct Device : Hashable {
|
|
|
|
|
public let hexEncodedPublicKey: String
|
|
|
|
|
public let signature: Data?
|
|
|
|
|
|
|
|
|
@ -14,6 +14,11 @@ public struct LokiDeviceLink {
|
|
|
|
|
self.hexEncodedPublicKey = hexEncodedPublicKey
|
|
|
|
|
self.signature = signature
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
|
|
|
hexEncodedPublicKey.hash(into: &hasher)
|
|
|
|
|
signature?.hash(into: &hasher)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: Lifecycle
|
|
|
|
@ -21,4 +26,10 @@ public struct LokiDeviceLink {
|
|
|
|
|
self.master = master
|
|
|
|
|
self.slave = slave
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: Hashing
|
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
|
|
|
master.hash(into: &hasher)
|
|
|
|
|
slave.hash(into: &hasher)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|