2018-08-01 17:28:52 +02:00
|
|
|
//
|
|
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
// WARNING: This code is generated. Only edit within the markers.
|
|
|
|
|
|
|
|
public enum FingerprintProtoError: Error {
|
|
|
|
case invalidProtobuf(description: String)
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: - FingerprintProtoLogicalFingerprint
|
|
|
|
|
|
|
|
@objc public class FingerprintProtoLogicalFingerprint: NSObject {
|
|
|
|
|
2018-08-02 20:28:13 +02:00
|
|
|
// MARK: - FingerprintProtoLogicalFingerprintBuilder
|
2018-08-01 17:28:52 +02:00
|
|
|
|
2018-08-02 20:28:13 +02:00
|
|
|
@objc public class FingerprintProtoLogicalFingerprintBuilder: NSObject {
|
|
|
|
|
|
|
|
private var proto = FingerprintProtos_LogicalFingerprint()
|
|
|
|
|
|
|
|
@objc public override init() {}
|
|
|
|
|
|
|
|
@objc public func setIdentityData(_ valueParam: Data) {
|
|
|
|
proto.identityData = valueParam
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc public func build() throws -> FingerprintProtoLogicalFingerprint {
|
|
|
|
let wrapper = try FingerprintProtoLogicalFingerprint.parseProto(proto)
|
|
|
|
return wrapper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fileprivate let proto: FingerprintProtos_LogicalFingerprint
|
|
|
|
|
2018-08-03 20:03:02 +02:00
|
|
|
@objc public let identityData: Data
|
2018-08-02 20:28:13 +02:00
|
|
|
|
2018-08-03 20:03:02 +02:00
|
|
|
private init(proto: FingerprintProtos_LogicalFingerprint,
|
|
|
|
identityData: Data) {
|
2018-08-02 20:28:13 +02:00
|
|
|
self.proto = proto
|
2018-08-03 20:03:02 +02:00
|
|
|
self.identityData = identityData
|
2018-08-01 17:44:29 +02:00
|
|
|
}
|
2018-08-01 17:28:52 +02:00
|
|
|
|
2018-08-01 17:44:29 +02:00
|
|
|
@objc
|
|
|
|
public func serializedData() throws -> Data {
|
2018-08-02 20:28:13 +02:00
|
|
|
return try self.proto.serializedData()
|
2018-08-01 17:44:29 +02:00
|
|
|
}
|
2018-08-01 17:28:52 +02:00
|
|
|
|
2018-08-01 17:44:29 +02:00
|
|
|
@objc public class func parseData(_ serializedData: Data) throws -> FingerprintProtoLogicalFingerprint {
|
|
|
|
let proto = try FingerprintProtos_LogicalFingerprint(serializedData: serializedData)
|
|
|
|
return try parseProto(proto)
|
|
|
|
}
|
2018-08-01 17:28:52 +02:00
|
|
|
|
2018-08-01 17:44:29 +02:00
|
|
|
fileprivate class func parseProto(_ proto: FingerprintProtos_LogicalFingerprint) throws -> FingerprintProtoLogicalFingerprint {
|
2018-08-03 20:03:02 +02:00
|
|
|
guard proto.hasIdentityData else {
|
|
|
|
throw FingerprintProtoError.invalidProtobuf(description: "\(logTag) missing required field: identityData")
|
|
|
|
}
|
|
|
|
let identityData = proto.identityData
|
|
|
|
|
2018-08-01 17:44:29 +02:00
|
|
|
// MARK: - Begin Validation Logic for FingerprintProtoLogicalFingerprint -
|
2018-08-01 17:28:52 +02:00
|
|
|
|
2018-08-01 17:44:29 +02:00
|
|
|
// MARK: - End Validation Logic for FingerprintProtoLogicalFingerprint -
|
2018-08-01 17:28:52 +02:00
|
|
|
|
2018-08-03 20:03:02 +02:00
|
|
|
let result = FingerprintProtoLogicalFingerprint(proto: proto,
|
|
|
|
identityData: identityData)
|
2018-08-01 17:44:29 +02:00
|
|
|
return result
|
|
|
|
}
|
2018-08-01 17:28:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: - FingerprintProtoLogicalFingerprints
|
|
|
|
|
|
|
|
@objc public class FingerprintProtoLogicalFingerprints: NSObject {
|
|
|
|
|
2018-08-02 20:28:13 +02:00
|
|
|
// MARK: - FingerprintProtoLogicalFingerprintsBuilder
|
|
|
|
|
|
|
|
@objc public class FingerprintProtoLogicalFingerprintsBuilder: NSObject {
|
|
|
|
|
|
|
|
private var proto = FingerprintProtos_LogicalFingerprints()
|
|
|
|
|
|
|
|
@objc public override init() {}
|
|
|
|
|
|
|
|
@objc public func setVersion(_ valueParam: UInt32) {
|
|
|
|
proto.version = valueParam
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc public func setLocalFingerprint(_ valueParam: FingerprintProtoLogicalFingerprint) {
|
|
|
|
proto.localFingerprint = valueParam.proto
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc public func setRemoteFingerprint(_ valueParam: FingerprintProtoLogicalFingerprint) {
|
|
|
|
proto.remoteFingerprint = valueParam.proto
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc public func build() throws -> FingerprintProtoLogicalFingerprints {
|
|
|
|
let wrapper = try FingerprintProtoLogicalFingerprints.parseProto(proto)
|
|
|
|
return wrapper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fileprivate let proto: FingerprintProtos_LogicalFingerprints
|
|
|
|
|
2018-08-03 20:03:02 +02:00
|
|
|
@objc public let version: UInt32
|
|
|
|
@objc public let localFingerprint: FingerprintProtoLogicalFingerprint
|
|
|
|
@objc public let remoteFingerprint: FingerprintProtoLogicalFingerprint
|
2018-08-02 20:28:13 +02:00
|
|
|
|
|
|
|
private init(proto: FingerprintProtos_LogicalFingerprints,
|
2018-08-03 20:03:02 +02:00
|
|
|
version: UInt32,
|
|
|
|
localFingerprint: FingerprintProtoLogicalFingerprint,
|
|
|
|
remoteFingerprint: FingerprintProtoLogicalFingerprint) {
|
2018-08-02 20:28:13 +02:00
|
|
|
self.proto = proto
|
2018-08-03 20:03:02 +02:00
|
|
|
self.version = version
|
2018-08-01 17:44:29 +02:00
|
|
|
self.localFingerprint = localFingerprint
|
|
|
|
self.remoteFingerprint = remoteFingerprint
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc
|
|
|
|
public func serializedData() throws -> Data {
|
2018-08-02 20:28:13 +02:00
|
|
|
return try self.proto.serializedData()
|
2018-08-01 17:44:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@objc public class func parseData(_ serializedData: Data) throws -> FingerprintProtoLogicalFingerprints {
|
|
|
|
let proto = try FingerprintProtos_LogicalFingerprints(serializedData: serializedData)
|
|
|
|
return try parseProto(proto)
|
|
|
|
}
|
|
|
|
|
|
|
|
fileprivate class func parseProto(_ proto: FingerprintProtos_LogicalFingerprints) throws -> FingerprintProtoLogicalFingerprints {
|
2018-08-03 20:03:02 +02:00
|
|
|
guard proto.hasVersion else {
|
|
|
|
throw FingerprintProtoError.invalidProtobuf(description: "\(logTag) missing required field: version")
|
|
|
|
}
|
|
|
|
let version = proto.version
|
|
|
|
|
|
|
|
guard proto.hasLocalFingerprint else {
|
|
|
|
throw FingerprintProtoError.invalidProtobuf(description: "\(logTag) missing required field: localFingerprint")
|
2018-08-01 17:44:29 +02:00
|
|
|
}
|
2018-08-03 20:03:02 +02:00
|
|
|
let localFingerprint = try FingerprintProtoLogicalFingerprint.parseProto(proto.localFingerprint)
|
2018-08-01 17:44:29 +02:00
|
|
|
|
2018-08-03 20:03:02 +02:00
|
|
|
guard proto.hasRemoteFingerprint else {
|
|
|
|
throw FingerprintProtoError.invalidProtobuf(description: "\(logTag) missing required field: remoteFingerprint")
|
2018-08-01 17:44:29 +02:00
|
|
|
}
|
2018-08-03 20:03:02 +02:00
|
|
|
let remoteFingerprint = try FingerprintProtoLogicalFingerprint.parseProto(proto.remoteFingerprint)
|
2018-08-01 17:44:29 +02:00
|
|
|
|
|
|
|
// MARK: - Begin Validation Logic for FingerprintProtoLogicalFingerprints -
|
|
|
|
|
|
|
|
// MARK: - End Validation Logic for FingerprintProtoLogicalFingerprints -
|
|
|
|
|
2018-08-02 20:28:13 +02:00
|
|
|
let result = FingerprintProtoLogicalFingerprints(proto: proto,
|
2018-08-03 20:03:02 +02:00
|
|
|
version: version,
|
2018-08-01 17:44:29 +02:00
|
|
|
localFingerprint: localFingerprint,
|
|
|
|
remoteFingerprint: remoteFingerprint)
|
|
|
|
return result
|
|
|
|
}
|
2018-08-01 17:28:52 +02:00
|
|
|
}
|