12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103 |
- // _____ _
- // |_ _| |_ _ _ ___ ___ _ __ __ _
- // | | | ' \| '_/ -_) -_) ' \/ _` |_
- // |_| |_||_|_| \___\___|_|_|_\__,_(_)
- //
- // Threema iOS Client
- // Copyright (c) 2020 Threema GmbH
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU Affero General Public License, version 3,
- // as published by the Free Software Foundation.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU Affero General Public License for more details.
- //
- // You should have received a copy of the GNU Affero General Public License
- // along with this program. If not, see <https://www.gnu.org/licenses/>.
- 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
- }
- /// Policy determining the device slot's lifetime.
- enum D2m_DeviceSlotExpirationPolicy: SwiftProtobuf.Enum {
- typealias RawValue = Int
- /// The device slot should be removed shortly after the device
- /// disconnected. However, there should be a delay of several minutes to
- /// ensure that the device can reconnect if it disconnected unintentionally.
- case volatile // = 0
- /// The device slot should be kept as long as possible
- case persistent // = 1
- case UNRECOGNIZED(Int)
- init() {
- self = .volatile
- }
- init?(rawValue: Int) {
- switch rawValue {
- case 0: self = .volatile
- case 1: self = .persistent
- default: self = .UNRECOGNIZED(rawValue)
- }
- }
- var rawValue: Int {
- switch self {
- case .volatile: return 0
- case .persistent: return 1
- case .UNRECOGNIZED(let i): return i
- }
- }
- }
- #if swift(>=4.2)
- extension D2m_DeviceSlotExpirationPolicy: CaseIterable {
- // The compiler won't synthesize support with the UNRECOGNIZED case.
- static var allCases: [D2m_DeviceSlotExpirationPolicy] = [
- .volatile,
- .persistent,
- ]
- }
- #endif // swift(>=4.2)
- /// Send along client information when connecting to the mediator server.
- ///
- /// This message is serialized, hex-encoded (lowercase) and then used as the
- /// WebSocket path.
- ///
- /// Type: n/a
- /// Direction: Client -> Server
- struct D2m_ClientUrlInfo {
- // 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.
- /// 32 byte mediator path public key
- var mpk: Data = SwiftProtobuf.Internal.emptyData
- /// Server group, as assigned by the server when the Threema identity has
- /// been created.
- var serverGroup: UInt32 = 0
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Initial message from the server, containing an authentication challenge.
- ///
- /// Type: 0x10
- /// Direction: Client <-- Server
- struct D2m_ServerHello {
- // 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.
- /// Highest protocol version the server supports
- var version: UInt32 = 0
- /// 32 byte temporary public key
- var tpk: Data = SwiftProtobuf.Internal.emptyData
- /// 32 byte random challenge
- var challenge: Data = SwiftProtobuf.Internal.emptyData
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Initial message from the client, containing the authentication challenge
- /// response and additional login information.
- ///
- /// Type: 0x11
- /// Direction: Client --> Server
- struct D2m_ClientHello {
- // 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.
- /// Protocol version which the client has selected
- var version: UInt32 = 0
- /// Challenge response (72 bytes) for authentication.
- ///
- /// The response is created using NaCl box encryption:
- ///
- /// Box(MPK.secret, TPK.public)
- /// .encrypt(data=<challenge>, nonce=<random>)
- ///
- /// The nonce is then prepended to the encrypted challenge.
- ///
- /// nonce (24 bytes) || encrypted-box (16 + 32 bytes)
- var response: Data = SwiftProtobuf.Internal.emptyData
- /// Unique device id
- var deviceID: UInt64 = 0
- var deviceSlotsExhaustedPolicy: D2m_ClientHello.DeviceSlotsExhaustedPolicy = .reject
- /// Policy determining the device slot's lifetime
- var deviceSlotExpirationPolicy: D2m_DeviceSlotExpirationPolicy = .volatile
- /// Device info (`d2d.DeviceInfo`), encrypted by `MK.secret`
- var encryptedDeviceInfo: Data = SwiftProtobuf.Internal.emptyData
- var unknownFields = SwiftProtobuf.UnknownStorage()
- /// Policy to be applied in case the device id is not registered on the server
- /// and all device slots have been exhausted.
- enum DeviceSlotsExhaustedPolicy: SwiftProtobuf.Enum {
- typealias RawValue = Int
- /// Terminate the connection
- case reject // = 0
- /// Drop the least recently used device
- case dropLeastRecent // = 1
- case UNRECOGNIZED(Int)
- init() {
- self = .reject
- }
- init?(rawValue: Int) {
- switch rawValue {
- case 0: self = .reject
- case 1: self = .dropLeastRecent
- default: self = .UNRECOGNIZED(rawValue)
- }
- }
- var rawValue: Int {
- switch self {
- case .reject: return 0
- case .dropLeastRecent: return 1
- case .UNRECOGNIZED(let i): return i
- }
- }
- }
- init() {}
- }
- #if swift(>=4.2)
- extension D2m_ClientHello.DeviceSlotsExhaustedPolicy: CaseIterable {
- // The compiler won't synthesize support with the UNRECOGNIZED case.
- static var allCases: [D2m_ClientHello.DeviceSlotsExhaustedPolicy] = [
- .reject,
- .dropLeastRecent,
- ]
- }
- #endif // swift(>=4.2)
- /// Parts of the server's configuration and the device slot state.
- ///
- /// Type: 0x12
- /// Direction: Client <-- Server
- struct D2m_ServerInfo {
- // 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.
- /// Maximum number of device slots
- var maxDeviceSlots: UInt32 = 0
- var deviceSlotState: D2m_ServerInfo.DeviceSlotState = .new
- /// Device data shared among devices (`SharedDeviceData`), encrypted by
- /// `MK.secret`.
- var encryptedSharedDeviceData: Data = SwiftProtobuf.Internal.emptyData
- var unknownFields = SwiftProtobuf.UnknownStorage()
- /// Informs the device about its device slot state on the server
- enum DeviceSlotState: SwiftProtobuf.Enum {
- typealias RawValue = Int
- /// A new device slot has been allocated for the device (i.e. the device's
- /// id was not registered on the server).
- case new // = 0
- /// An existing device slot has been reused for the device (i.e. the
- /// device's id is already registered on the server).
- case existing // = 1
- case UNRECOGNIZED(Int)
- init() {
- self = .new
- }
- init?(rawValue: Int) {
- switch rawValue {
- case 0: self = .new
- case 1: self = .existing
- default: self = .UNRECOGNIZED(rawValue)
- }
- }
- var rawValue: Int {
- switch self {
- case .new: return 0
- case .existing: return 1
- case .UNRECOGNIZED(let i): return i
- }
- }
- }
- init() {}
- }
- #if swift(>=4.2)
- extension D2m_ServerInfo.DeviceSlotState: CaseIterable {
- // The compiler won't synthesize support with the UNRECOGNIZED case.
- static var allCases: [D2m_ServerInfo.DeviceSlotState] = [
- .new,
- .existing,
- ]
- }
- #endif // swift(>=4.2)
- /// The device's reflection queue on the server has been fully transmitted to
- /// the device.
- ///
- /// Note: This does not mean that reflected messages have already been
- /// acknowledged by the device!
- ///
- /// Type: 0x20
- /// Direction: Client <-- Server
- struct D2m_ReflectionQueueDry {
- // 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 unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// The device's role has been promoted to leader, indicating that the device
- /// should now request to receive and reflect messages from the chat server.
- ///
- /// Type: 0x21
- /// Direction: Client <-- Server
- struct D2m_RolePromotedToLeader {
- // 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 unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Request device information of all devices.
- ///
- /// Type: 0x30
- /// Direction: Client --> Server
- struct D2m_GetDevicesInfo {
- // 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 unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Device information of all devices.
- ///
- /// Type: 0x31
- /// Direction: Client <-- Server
- struct D2m_DevicesInfo {
- // 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 augmentedDeviceInfo: Dictionary<UInt64,D2m_DevicesInfo.AugmentedDeviceInfo> = [:]
- var unknownFields = SwiftProtobuf.UnknownStorage()
- /// Device id to (augmented) device info map of all devices.
- struct AugmentedDeviceInfo {
- // 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.
- /// Device info (`d2d.DeviceInfo`), encrypted by `MK.secret`.
- var encryptedDeviceInfo: Data = SwiftProtobuf.Internal.emptyData
- /// Unix-ish timestamp in milliseconds containing the most recent login
- /// time of the device.
- var lastLoginAt: UInt64 = 0
- /// Expiration policy of the device.
- var deviceSlotExpirationPolicy: D2m_DeviceSlotExpirationPolicy = .volatile
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- init() {}
- }
- /// Request to drop a device and free its device slot.
- ///
- /// Type: 0x32
- /// Direction: Client --> Server
- struct D2m_DropDevice {
- // 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.
- /// Unique device id
- var deviceID: UInt64 = 0
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Acknowledges that a device has been dropped and the device slot has been
- /// free'd.
- ///
- /// Type: 0x33
- /// Direction: Client <-- Server
- struct D2m_DropDeviceAck {
- // 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.
- /// Unique device id
- var deviceID: UInt64 = 0
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Set the shared device data which is being sent to each device during login.
- ///
- /// Type: 0x34
- /// Direction: Client --> Server
- struct D2m_SetSharedDeviceData {
- // 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.
- /// Device data shared among devices (`SharedDeviceData`), encrypted by
- /// `MK.secret`.
- var encryptedSharedDeviceData: Data = SwiftProtobuf.Internal.emptyData
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Acquires a device group lock for an atomic operation shared across the
- /// device group.
- ///
- /// Reflection messages from the device to the mediator server will only be
- /// reflected once the transaction is committed.
- ///
- /// Type: 0x40
- /// Direction: Client --> Server
- struct D2m_BeginTransaction {
- // 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 transaction scope (`TransactionScope` in D2D), encrypted by
- /// `MK.secret`
- var encryptedScope: Data = SwiftProtobuf.Internal.emptyData
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Acknowledges that the device group lock has been acquired and that the
- /// transaction has been started.
- ///
- /// Type: 0x41
- /// Direction: Client <-- Server
- struct D2m_BeginTransactionAck {
- // 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 unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Commits a transaction, releases a device group lock.
- ///
- /// Type: 0x42
- /// Direction: Client --> Server
- struct D2m_CommitTransaction {
- // 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 unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Acknowledges that the transaction has been committed and that the device
- /// group lock has been released.
- ///
- /// Type: 0x43
- /// Direction: Client <-- Server
- struct D2m_CommitTransactionAck {
- // 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 unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// A `BeginTransaction` request is rejected because another transaction is
- /// already in process.
- ///
- /// Type: 0x44
- /// Direction: Client <-- Server
- struct D2m_TransactionRejected {
- // 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 device that currently holds the lock
- var deviceID: UInt64 = 0
- /// The encrypted transaction scope associated with the currently locked transaction
- var encryptedScope: Data = SwiftProtobuf.Internal.emptyData
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// When a transaction ends (either because it was committed or because the
- /// device disconnected), this message is sent to all connected devices except
- /// for the device that committed the transaction.
- ///
- /// This can be used by the other devices as a "retry signal" if a previous
- /// "BeginTransaction" attempt was unsuccessful.
- ///
- /// Type: 0x45
- /// Direction: Client <-- Server
- struct D2m_TransactionEnded {
- // 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 device that held the lock up until now
- var deviceID: UInt64 = 0
- /// The encrypted transaction scope associated with the transaction that just ended
- var encryptedScope: Data = SwiftProtobuf.Internal.emptyData
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- // MARK: - Code below here is support for the SwiftProtobuf runtime.
- fileprivate let _protobuf_package = "d2m"
- extension D2m_DeviceSlotExpirationPolicy: SwiftProtobuf._ProtoNameProviding {
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 0: .same(proto: "VOLATILE"),
- 1: .same(proto: "PERSISTENT"),
- ]
- }
- extension D2m_ClientUrlInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".ClientUrlInfo"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "mpk"),
- 2: .standard(proto: "server_group"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularBytesField(value: &self.mpk)
- case 2: try decoder.decodeSingularUInt32Field(value: &self.serverGroup)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if !self.mpk.isEmpty {
- try visitor.visitSingularBytesField(value: self.mpk, fieldNumber: 1)
- }
- if self.serverGroup != 0 {
- try visitor.visitSingularUInt32Field(value: self.serverGroup, fieldNumber: 2)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_ClientUrlInfo, rhs: D2m_ClientUrlInfo) -> Bool {
- if lhs.mpk != rhs.mpk {return false}
- if lhs.serverGroup != rhs.serverGroup {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_ServerHello: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".ServerHello"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "version"),
- 2: .same(proto: "tpk"),
- 3: .same(proto: "challenge"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularUInt32Field(value: &self.version)
- case 2: try decoder.decodeSingularBytesField(value: &self.tpk)
- case 3: try decoder.decodeSingularBytesField(value: &self.challenge)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if self.version != 0 {
- try visitor.visitSingularUInt32Field(value: self.version, fieldNumber: 1)
- }
- if !self.tpk.isEmpty {
- try visitor.visitSingularBytesField(value: self.tpk, fieldNumber: 2)
- }
- if !self.challenge.isEmpty {
- try visitor.visitSingularBytesField(value: self.challenge, fieldNumber: 3)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_ServerHello, rhs: D2m_ServerHello) -> Bool {
- if lhs.version != rhs.version {return false}
- if lhs.tpk != rhs.tpk {return false}
- if lhs.challenge != rhs.challenge {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_ClientHello: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".ClientHello"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "version"),
- 2: .same(proto: "response"),
- 3: .standard(proto: "device_id"),
- 4: .standard(proto: "device_slots_exhausted_policy"),
- 5: .standard(proto: "device_slot_expiration_policy"),
- 6: .standard(proto: "encrypted_device_info"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularUInt32Field(value: &self.version)
- case 2: try decoder.decodeSingularBytesField(value: &self.response)
- case 3: try decoder.decodeSingularFixed64Field(value: &self.deviceID)
- case 4: try decoder.decodeSingularEnumField(value: &self.deviceSlotsExhaustedPolicy)
- case 5: try decoder.decodeSingularEnumField(value: &self.deviceSlotExpirationPolicy)
- case 6: try decoder.decodeSingularBytesField(value: &self.encryptedDeviceInfo)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if self.version != 0 {
- try visitor.visitSingularUInt32Field(value: self.version, fieldNumber: 1)
- }
- if !self.response.isEmpty {
- try visitor.visitSingularBytesField(value: self.response, fieldNumber: 2)
- }
- if self.deviceID != 0 {
- try visitor.visitSingularFixed64Field(value: self.deviceID, fieldNumber: 3)
- }
- if self.deviceSlotsExhaustedPolicy != .reject {
- try visitor.visitSingularEnumField(value: self.deviceSlotsExhaustedPolicy, fieldNumber: 4)
- }
- if self.deviceSlotExpirationPolicy != .volatile {
- try visitor.visitSingularEnumField(value: self.deviceSlotExpirationPolicy, fieldNumber: 5)
- }
- if !self.encryptedDeviceInfo.isEmpty {
- try visitor.visitSingularBytesField(value: self.encryptedDeviceInfo, fieldNumber: 6)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_ClientHello, rhs: D2m_ClientHello) -> Bool {
- if lhs.version != rhs.version {return false}
- if lhs.response != rhs.response {return false}
- if lhs.deviceID != rhs.deviceID {return false}
- if lhs.deviceSlotsExhaustedPolicy != rhs.deviceSlotsExhaustedPolicy {return false}
- if lhs.deviceSlotExpirationPolicy != rhs.deviceSlotExpirationPolicy {return false}
- if lhs.encryptedDeviceInfo != rhs.encryptedDeviceInfo {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_ClientHello.DeviceSlotsExhaustedPolicy: SwiftProtobuf._ProtoNameProviding {
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 0: .same(proto: "REJECT"),
- 1: .same(proto: "DROP_LEAST_RECENT"),
- ]
- }
- extension D2m_ServerInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".ServerInfo"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "max_device_slots"),
- 2: .standard(proto: "device_slot_state"),
- 3: .standard(proto: "encrypted_shared_device_data"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularUInt32Field(value: &self.maxDeviceSlots)
- case 2: try decoder.decodeSingularEnumField(value: &self.deviceSlotState)
- case 3: try decoder.decodeSingularBytesField(value: &self.encryptedSharedDeviceData)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if self.maxDeviceSlots != 0 {
- try visitor.visitSingularUInt32Field(value: self.maxDeviceSlots, fieldNumber: 1)
- }
- if self.deviceSlotState != .new {
- try visitor.visitSingularEnumField(value: self.deviceSlotState, fieldNumber: 2)
- }
- if !self.encryptedSharedDeviceData.isEmpty {
- try visitor.visitSingularBytesField(value: self.encryptedSharedDeviceData, fieldNumber: 3)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_ServerInfo, rhs: D2m_ServerInfo) -> Bool {
- if lhs.maxDeviceSlots != rhs.maxDeviceSlots {return false}
- if lhs.deviceSlotState != rhs.deviceSlotState {return false}
- if lhs.encryptedSharedDeviceData != rhs.encryptedSharedDeviceData {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_ServerInfo.DeviceSlotState: SwiftProtobuf._ProtoNameProviding {
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 0: .same(proto: "NEW"),
- 1: .same(proto: "EXISTING"),
- ]
- }
- extension D2m_ReflectionQueueDry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".ReflectionQueueDry"
- static let _protobuf_nameMap = SwiftProtobuf._NameMap()
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let _ = try decoder.nextFieldNumber() {
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_ReflectionQueueDry, rhs: D2m_ReflectionQueueDry) -> Bool {
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_RolePromotedToLeader: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".RolePromotedToLeader"
- static let _protobuf_nameMap = SwiftProtobuf._NameMap()
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let _ = try decoder.nextFieldNumber() {
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_RolePromotedToLeader, rhs: D2m_RolePromotedToLeader) -> Bool {
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_GetDevicesInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".GetDevicesInfo"
- static let _protobuf_nameMap = SwiftProtobuf._NameMap()
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let _ = try decoder.nextFieldNumber() {
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_GetDevicesInfo, rhs: D2m_GetDevicesInfo) -> Bool {
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_DevicesInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".DevicesInfo"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "augmented_device_info"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufFixed64,D2m_DevicesInfo.AugmentedDeviceInfo>.self, value: &self.augmentedDeviceInfo)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if !self.augmentedDeviceInfo.isEmpty {
- try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufFixed64,D2m_DevicesInfo.AugmentedDeviceInfo>.self, value: self.augmentedDeviceInfo, fieldNumber: 1)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_DevicesInfo, rhs: D2m_DevicesInfo) -> Bool {
- if lhs.augmentedDeviceInfo != rhs.augmentedDeviceInfo {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_DevicesInfo.AugmentedDeviceInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = D2m_DevicesInfo.protoMessageName + ".AugmentedDeviceInfo"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "encrypted_device_info"),
- 2: .standard(proto: "last_login_at"),
- 3: .standard(proto: "device_slot_expiration_policy"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularBytesField(value: &self.encryptedDeviceInfo)
- case 2: try decoder.decodeSingularUInt64Field(value: &self.lastLoginAt)
- case 3: try decoder.decodeSingularEnumField(value: &self.deviceSlotExpirationPolicy)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if !self.encryptedDeviceInfo.isEmpty {
- try visitor.visitSingularBytesField(value: self.encryptedDeviceInfo, fieldNumber: 1)
- }
- if self.lastLoginAt != 0 {
- try visitor.visitSingularUInt64Field(value: self.lastLoginAt, fieldNumber: 2)
- }
- if self.deviceSlotExpirationPolicy != .volatile {
- try visitor.visitSingularEnumField(value: self.deviceSlotExpirationPolicy, fieldNumber: 3)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_DevicesInfo.AugmentedDeviceInfo, rhs: D2m_DevicesInfo.AugmentedDeviceInfo) -> Bool {
- if lhs.encryptedDeviceInfo != rhs.encryptedDeviceInfo {return false}
- if lhs.lastLoginAt != rhs.lastLoginAt {return false}
- if lhs.deviceSlotExpirationPolicy != rhs.deviceSlotExpirationPolicy {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_DropDevice: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".DropDevice"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "device_id"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularFixed64Field(value: &self.deviceID)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if self.deviceID != 0 {
- try visitor.visitSingularFixed64Field(value: self.deviceID, fieldNumber: 1)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_DropDevice, rhs: D2m_DropDevice) -> Bool {
- if lhs.deviceID != rhs.deviceID {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_DropDeviceAck: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".DropDeviceAck"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "device_id"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularFixed64Field(value: &self.deviceID)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if self.deviceID != 0 {
- try visitor.visitSingularFixed64Field(value: self.deviceID, fieldNumber: 1)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_DropDeviceAck, rhs: D2m_DropDeviceAck) -> Bool {
- if lhs.deviceID != rhs.deviceID {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_SetSharedDeviceData: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".SetSharedDeviceData"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "encrypted_shared_device_data"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularBytesField(value: &self.encryptedSharedDeviceData)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if !self.encryptedSharedDeviceData.isEmpty {
- try visitor.visitSingularBytesField(value: self.encryptedSharedDeviceData, fieldNumber: 1)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_SetSharedDeviceData, rhs: D2m_SetSharedDeviceData) -> Bool {
- if lhs.encryptedSharedDeviceData != rhs.encryptedSharedDeviceData {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_BeginTransaction: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".BeginTransaction"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "encrypted_scope"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularBytesField(value: &self.encryptedScope)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if !self.encryptedScope.isEmpty {
- try visitor.visitSingularBytesField(value: self.encryptedScope, fieldNumber: 1)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_BeginTransaction, rhs: D2m_BeginTransaction) -> Bool {
- if lhs.encryptedScope != rhs.encryptedScope {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_BeginTransactionAck: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".BeginTransactionAck"
- static let _protobuf_nameMap = SwiftProtobuf._NameMap()
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let _ = try decoder.nextFieldNumber() {
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_BeginTransactionAck, rhs: D2m_BeginTransactionAck) -> Bool {
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_CommitTransaction: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".CommitTransaction"
- static let _protobuf_nameMap = SwiftProtobuf._NameMap()
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let _ = try decoder.nextFieldNumber() {
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_CommitTransaction, rhs: D2m_CommitTransaction) -> Bool {
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_CommitTransactionAck: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".CommitTransactionAck"
- static let _protobuf_nameMap = SwiftProtobuf._NameMap()
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let _ = try decoder.nextFieldNumber() {
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_CommitTransactionAck, rhs: D2m_CommitTransactionAck) -> Bool {
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_TransactionRejected: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".TransactionRejected"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "device_id"),
- 2: .standard(proto: "encrypted_scope"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularFixed64Field(value: &self.deviceID)
- case 2: try decoder.decodeSingularBytesField(value: &self.encryptedScope)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if self.deviceID != 0 {
- try visitor.visitSingularFixed64Field(value: self.deviceID, fieldNumber: 1)
- }
- if !self.encryptedScope.isEmpty {
- try visitor.visitSingularBytesField(value: self.encryptedScope, fieldNumber: 2)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_TransactionRejected, rhs: D2m_TransactionRejected) -> Bool {
- if lhs.deviceID != rhs.deviceID {return false}
- if lhs.encryptedScope != rhs.encryptedScope {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension D2m_TransactionEnded: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".TransactionEnded"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "device_id"),
- 2: .standard(proto: "encrypted_scope"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- switch fieldNumber {
- case 1: try decoder.decodeSingularFixed64Field(value: &self.deviceID)
- case 2: try decoder.decodeSingularBytesField(value: &self.encryptedScope)
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if self.deviceID != 0 {
- try visitor.visitSingularFixed64Field(value: self.deviceID, fieldNumber: 1)
- }
- if !self.encryptedScope.isEmpty {
- try visitor.visitSingularBytesField(value: self.encryptedScope, fieldNumber: 2)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: D2m_TransactionEnded, rhs: D2m_TransactionEnded) -> Bool {
- if lhs.deviceID != rhs.deviceID {return false}
- if lhs.encryptedScope != rhs.encryptedScope {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
|