// DO NOT EDIT. // swift-format-ignore-file // // Generated by the Swift generator plugin for the protocol buffer compiler. // Source: device_to_device_messages.proto // // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ // Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. import Foundation import SwiftProtobuf // If the compiler emits an error on this type, it is because this file // was generated by a version of the `protoc` Swift plug-in that is // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } /// Type of curve enum Securegcm_Curve: SwiftProtobuf.Enum { typealias RawValue = Int case ed25519 // = 1 init() { self = .ed25519 } init?(rawValue: Int) { switch rawValue { case 1: self = .ed25519 default: return nil } } var rawValue: Int { switch self { case .ed25519: return 1 } } } #if swift(>=4.2) extension Securegcm_Curve: CaseIterable { // Support synthesized by the compiler. } #endif // swift(>=4.2) /// Used by protocols between devices struct Securegcm_DeviceToDeviceMessage { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// the payload of the message var message: Data { get {return _message ?? Data()} set {_message = newValue} } /// Returns true if `message` has been explicitly set. var hasMessage: Bool {return self._message != nil} /// Clears the value of `message`. Subsequent reads from it will return its default value. mutating func clearMessage() {self._message = nil} /// the sequence number of the message - must be increasing. var sequenceNumber: Int32 { get {return _sequenceNumber ?? 0} set {_sequenceNumber = newValue} } /// Returns true if `sequenceNumber` has been explicitly set. var hasSequenceNumber: Bool {return self._sequenceNumber != nil} /// Clears the value of `sequenceNumber`. Subsequent reads from it will return its default value. mutating func clearSequenceNumber() {self._sequenceNumber = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} fileprivate var _message: Data? = nil fileprivate var _sequenceNumber: Int32? = nil } /// sent as the first message from initiator to responder /// in an unauthenticated Diffie-Hellman Key Exchange struct Securegcm_InitiatorHello { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// The session public key to send to the responder var publicDhKey: Securemessage_GenericPublicKey { get {return _publicDhKey ?? Securemessage_GenericPublicKey()} set {_publicDhKey = newValue} } /// Returns true if `publicDhKey` has been explicitly set. var hasPublicDhKey: Bool {return self._publicDhKey != nil} /// Clears the value of `publicDhKey`. Subsequent reads from it will return its default value. mutating func clearPublicDhKey() {self._publicDhKey = nil} /// The protocol version var protocolVersion: Int32 { get {return _protocolVersion ?? 0} set {_protocolVersion = newValue} } /// Returns true if `protocolVersion` has been explicitly set. var hasProtocolVersion: Bool {return self._protocolVersion != nil} /// Clears the value of `protocolVersion`. Subsequent reads from it will return its default value. mutating func clearProtocolVersion() {self._protocolVersion = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} fileprivate var _publicDhKey: Securemessage_GenericPublicKey? = nil fileprivate var _protocolVersion: Int32? = nil } /// sent inside the header of the first message from the responder to the /// initiator in an unauthenticated Diffie-Hellman Key Exchange struct Securegcm_ResponderHello { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// The session public key to send to the initiator var publicDhKey: Securemessage_GenericPublicKey { get {return _publicDhKey ?? Securemessage_GenericPublicKey()} set {_publicDhKey = newValue} } /// Returns true if `publicDhKey` has been explicitly set. var hasPublicDhKey: Bool {return self._publicDhKey != nil} /// Clears the value of `publicDhKey`. Subsequent reads from it will return its default value. mutating func clearPublicDhKey() {self._publicDhKey = nil} /// The protocol version var protocolVersion: Int32 { get {return _protocolVersion ?? 0} set {_protocolVersion = newValue} } /// Returns true if `protocolVersion` has been explicitly set. var hasProtocolVersion: Bool {return self._protocolVersion != nil} /// Clears the value of `protocolVersion`. Subsequent reads from it will return its default value. mutating func clearProtocolVersion() {self._protocolVersion = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} fileprivate var _publicDhKey: Securemessage_GenericPublicKey? = nil fileprivate var _protocolVersion: Int32? = nil } /// A convenience proto for encoding curve points in affine representation struct Securegcm_EcPoint { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. var curve: Securegcm_Curve { get {return _curve ?? .ed25519} set {_curve = newValue} } /// Returns true if `curve` has been explicitly set. var hasCurve: Bool {return self._curve != nil} /// Clears the value of `curve`. Subsequent reads from it will return its default value. mutating func clearCurve() {self._curve = nil} /// x and y are encoded in big-endian two's complement /// client MUST verify (x,y) is a valid point on the specified curve var x: Data { get {return _x ?? Data()} set {_x = newValue} } /// Returns true if `x` has been explicitly set. var hasX: Bool {return self._x != nil} /// Clears the value of `x`. Subsequent reads from it will return its default value. mutating func clearX() {self._x = nil} var y: Data { get {return _y ?? Data()} set {_y = newValue} } /// Returns true if `y` has been explicitly set. var hasY: Bool {return self._y != nil} /// Clears the value of `y`. Subsequent reads from it will return its default value. mutating func clearY() {self._y = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} fileprivate var _curve: Securegcm_Curve? = nil fileprivate var _x: Data? = nil fileprivate var _y: Data? = nil } struct Securegcm_SpakeHandshakeMessage { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// Each flow in the protocol bumps this counter var flowNumber: Int32 { get {return _flowNumber ?? 0} set {_flowNumber = newValue} } /// Returns true if `flowNumber` has been explicitly set. var hasFlowNumber: Bool {return self._flowNumber != nil} /// Clears the value of `flowNumber`. Subsequent reads from it will return its default value. mutating func clearFlowNumber() {self._flowNumber = nil} /// Some (but not all) SPAKE flows send a point on an elliptic curve var ecPoint: Securegcm_EcPoint { get {return _ecPoint ?? Securegcm_EcPoint()} set {_ecPoint = newValue} } /// Returns true if `ecPoint` has been explicitly set. var hasEcPoint: Bool {return self._ecPoint != nil} /// Clears the value of `ecPoint`. Subsequent reads from it will return its default value. mutating func clearEcPoint() {self._ecPoint = nil} /// Some (but not all) SPAKE flows send a hash value var hashValue_p: Data { get {return _hashValue_p ?? Data()} set {_hashValue_p = newValue} } /// Returns true if `hashValue_p` has been explicitly set. var hasHashValue_p: Bool {return self._hashValue_p != nil} /// Clears the value of `hashValue_p`. Subsequent reads from it will return its default value. mutating func clearHashValue_p() {self._hashValue_p = nil} /// The last flow of a SPAKE protocol can send an optional payload, /// since the key exchange is already complete on the sender's side. var payload: Data { get {return _payload ?? Data()} set {_payload = newValue} } /// Returns true if `payload` has been explicitly set. var hasPayload: Bool {return self._payload != nil} /// Clears the value of `payload`. Subsequent reads from it will return its default value. mutating func clearPayload() {self._payload = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} fileprivate var _flowNumber: Int32? = nil fileprivate var _ecPoint: Securegcm_EcPoint? = nil fileprivate var _hashValue_p: Data? = nil fileprivate var _payload: Data? = nil } #if swift(>=5.5) && canImport(_Concurrency) extension Securegcm_Curve: @unchecked Sendable {} extension Securegcm_DeviceToDeviceMessage: @unchecked Sendable {} extension Securegcm_InitiatorHello: @unchecked Sendable {} extension Securegcm_ResponderHello: @unchecked Sendable {} extension Securegcm_EcPoint: @unchecked Sendable {} extension Securegcm_SpakeHandshakeMessage: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "securegcm" extension Securegcm_Curve: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "ED_25519"), ] } extension Securegcm_DeviceToDeviceMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".DeviceToDeviceMessage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "message"), 2: .standard(proto: "sequence_number"), ] mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularBytesField(value: &self._message) }() case 2: try { try decoder.decodeSingularInt32Field(value: &self._sequenceNumber) }() default: break } } } func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 try { if let v = self._message { try visitor.visitSingularBytesField(value: v, fieldNumber: 1) } }() try { if let v = self._sequenceNumber { try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) } }() try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Securegcm_DeviceToDeviceMessage, rhs: Securegcm_DeviceToDeviceMessage) -> Bool { if lhs._message != rhs._message {return false} if lhs._sequenceNumber != rhs._sequenceNumber {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension Securegcm_InitiatorHello: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".InitiatorHello" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "public_dh_key"), 2: .standard(proto: "protocol_version"), ] public var isInitialized: Bool { if let v = self._publicDhKey, !v.isInitialized {return false} return true } mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularMessageField(value: &self._publicDhKey) }() case 2: try { try decoder.decodeSingularInt32Field(value: &self._protocolVersion) }() default: break } } } func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 try { if let v = self._publicDhKey { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) } }() try { if let v = self._protocolVersion { try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) } }() try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Securegcm_InitiatorHello, rhs: Securegcm_InitiatorHello) -> Bool { if lhs._publicDhKey != rhs._publicDhKey {return false} if lhs._protocolVersion != rhs._protocolVersion {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension Securegcm_ResponderHello: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ResponderHello" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "public_dh_key"), 2: .standard(proto: "protocol_version"), ] public var isInitialized: Bool { if let v = self._publicDhKey, !v.isInitialized {return false} return true } mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularMessageField(value: &self._publicDhKey) }() case 2: try { try decoder.decodeSingularInt32Field(value: &self._protocolVersion) }() default: break } } } func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 try { if let v = self._publicDhKey { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) } }() try { if let v = self._protocolVersion { try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) } }() try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Securegcm_ResponderHello, rhs: Securegcm_ResponderHello) -> Bool { if lhs._publicDhKey != rhs._publicDhKey {return false} if lhs._protocolVersion != rhs._protocolVersion {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension Securegcm_EcPoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".EcPoint" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "curve"), 2: .same(proto: "x"), 3: .same(proto: "y"), ] public var isInitialized: Bool { if self._curve == nil {return false} if self._x == nil {return false} if self._y == nil {return false} return true } mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularEnumField(value: &self._curve) }() case 2: try { try decoder.decodeSingularBytesField(value: &self._x) }() case 3: try { try decoder.decodeSingularBytesField(value: &self._y) }() default: break } } } func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 try { if let v = self._curve { try visitor.visitSingularEnumField(value: v, fieldNumber: 1) } }() try { if let v = self._x { try visitor.visitSingularBytesField(value: v, fieldNumber: 2) } }() try { if let v = self._y { try visitor.visitSingularBytesField(value: v, fieldNumber: 3) } }() try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Securegcm_EcPoint, rhs: Securegcm_EcPoint) -> Bool { if lhs._curve != rhs._curve {return false} if lhs._x != rhs._x {return false} if lhs._y != rhs._y {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension Securegcm_SpakeHandshakeMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".SpakeHandshakeMessage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "flow_number"), 2: .standard(proto: "ec_point"), 3: .standard(proto: "hash_value"), 4: .same(proto: "payload"), ] public var isInitialized: Bool { if let v = self._ecPoint, !v.isInitialized {return false} return true } mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularInt32Field(value: &self._flowNumber) }() case 2: try { try decoder.decodeSingularMessageField(value: &self._ecPoint) }() case 3: try { try decoder.decodeSingularBytesField(value: &self._hashValue_p) }() case 4: try { try decoder.decodeSingularBytesField(value: &self._payload) }() default: break } } } func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 try { if let v = self._flowNumber { try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) } }() try { if let v = self._ecPoint { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() try { if let v = self._hashValue_p { try visitor.visitSingularBytesField(value: v, fieldNumber: 3) } }() try { if let v = self._payload { try visitor.visitSingularBytesField(value: v, fieldNumber: 4) } }() try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Securegcm_SpakeHandshakeMessage, rhs: Securegcm_SpakeHandshakeMessage) -> Bool { if lhs._flowNumber != rhs._flowNumber {return false} if lhs._ecPoint != rhs._ecPoint {return false} if lhs._hashValue_p != rhs._hashValue_p {return false} if lhs._payload != rhs._payload {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } }