From c6a93cd812ef4a2e984f2d9dd6ca316aede907ac Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Thu, 1 Feb 2024 18:03:48 -0800 Subject: [PATCH] Add sender HMAC to MessageV2 (#218) * bump the proto code * add should push entitlement * dump the protos one more time * update the protos again * feat: add to TextCodec & Composite * feat: add HKDF key derivation and HMAC signature generation * feat: add shouldPush parameter to MessageV2.encode() and prepareMessage() functions * feat: add shouldPush method to the remaining content codecs * fix: tests * fix: remove print statement in MessageTests.swift * fix: remove commented code * feat: set for all Content Types * fix: add decoded content in prepareMessage function * chore: remove unused dependencies * Replace xmtp-rust-swift with libxmtp-swift (#217) * rename module from XMTP to XMTPiOS * more renaming * remove xmtp-rust-swift references * Use new V2 client from libxmtp * building clean * remove PublishResponse * Use actual dep instead of local * Update XMTP.podspec Co-authored-by: Naomi Plasterer * implement streaming and pagination * Update XMTP.podspec Co-authored-by: Cameron Voell * disable file_length linter --------- Co-authored-by: Naomi Plasterer Co-authored-by: Cameron Voell * Update for latest uniffi (#219) * Fix example app (#220) * Access libxmtp-swift with static binaries (#225) * Access libxmtp-swift with static binaries * Update libxmtp ref * Updated reference to libxmtp-swift merge on main * Merge pre libxmtp into main (#223) * Add Key Material Function (#222) * add ket material field to ios * bump the podspec * Update podspec LibXMTP ref * Update libxmtp-swift refs * Update libxmtp-swift ref * Updated libxmtp-swift ref to tagged release * Update XMTP.podspec version --------- Co-authored-by: cameronvoell * Update Package.resolved with new branch and revision * bring back the proto work * remove the xmtp folder * chore: refactor message encoding and decoding * chore: update libxmtp-swift to latest version * fix: refactor ConversationTests.swift * potential test * chore: update XMTP.podspec version to 0.7.9-alpha0 --------- Co-authored-by: kele-leanes Co-authored-by: Pat Nakajima Co-authored-by: Cameron Voell Co-authored-by: Cameron Voell --- Package.resolved | 4 +- Sources/XMTPiOS/Codecs/AttachmentCodec.swift | 4 + Sources/XMTPiOS/Codecs/Composite.swift | 4 + Sources/XMTPiOS/Codecs/ContentCodec.swift | 1 + Sources/XMTPiOS/Codecs/ReactionCodec.swift | 11 + Sources/XMTPiOS/Codecs/ReadReceiptCodec.swift | 4 + .../Codecs/RemoteAttachmentCodec.swift | 4 + Sources/XMTPiOS/Codecs/ReplyCodec.swift | 4 + Sources/XMTPiOS/Codecs/TextCodec.swift | 4 + Sources/XMTPiOS/ConversationV2.swift | 8 +- Sources/XMTPiOS/Crypto.swift | 40 +- Sources/XMTPiOS/Messages/MessageV2.swift | 24 +- .../Proto/keystore_api/v1/keystore.pb.swift | 3324 ++++++++++------- .../Proto/message_contents/message.pb.swift | 612 +-- .../private_preferences.pb.swift | 347 +- Tests/XMTPTests/CodecTests.swift | 31 + Tests/XMTPTests/ConversationTests.swift | 18 +- Tests/XMTPTests/MessageTests.swift | 4 +- XMTP.podspec | 2 +- 19 files changed, 2673 insertions(+), 1777 deletions(-) diff --git a/Package.resolved b/Package.resolved index 13f2700c..074675b4 100644 --- a/Package.resolved +++ b/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/xmtp/libxmtp-swift", "state" : { - "branch" : "ccbf6ac", - "revision" : "ccbf6ac71b8c5a89c3078d8dc4057123bea8a291" + "branch" : "92274fe", + "revision" : "92274fe0dde1fc7f8f716ebcffa3d252813be56d" } }, { diff --git a/Sources/XMTPiOS/Codecs/AttachmentCodec.swift b/Sources/XMTPiOS/Codecs/AttachmentCodec.swift index 4bc405f3..96c8f843 100644 --- a/Sources/XMTPiOS/Codecs/AttachmentCodec.swift +++ b/Sources/XMTPiOS/Codecs/AttachmentCodec.swift @@ -59,4 +59,8 @@ public struct AttachmentCodec: ContentCodec { public func fallback(content: Attachment) throws -> String? { return "Can’t display “\(content.filename)”. This app doesn’t support attachments." } + + public func shouldPush(content: Attachment) throws -> Bool { + return true + } } diff --git a/Sources/XMTPiOS/Codecs/Composite.swift b/Sources/XMTPiOS/Codecs/Composite.swift index f10fec0e..217ef33c 100644 --- a/Sources/XMTPiOS/Codecs/Composite.swift +++ b/Sources/XMTPiOS/Codecs/Composite.swift @@ -45,6 +45,10 @@ struct CompositeCodec: ContentCodec { public func fallback(content: DecodedComposite) throws -> String? { return nil } + + public func shouldPush(content: DecodedComposite) throws -> Bool { + return false + } func toComposite(content decodedComposite: DecodedComposite) -> Composite { var composite = Composite() diff --git a/Sources/XMTPiOS/Codecs/ContentCodec.swift b/Sources/XMTPiOS/Codecs/ContentCodec.swift index 45e3f75c..e715a191 100644 --- a/Sources/XMTPiOS/Codecs/ContentCodec.swift +++ b/Sources/XMTPiOS/Codecs/ContentCodec.swift @@ -72,6 +72,7 @@ public protocol ContentCodec: Hashable, Equatable { func encode(content: T, client: Client) throws -> EncodedContent func decode(content: EncodedContent, client: Client) throws -> T func fallback(content: T) throws -> String? + func shouldPush(content: T) throws -> Bool } public extension ContentCodec { diff --git a/Sources/XMTPiOS/Codecs/ReactionCodec.swift b/Sources/XMTPiOS/Codecs/ReactionCodec.swift index 51b9ec0d..b9ed7033 100644 --- a/Sources/XMTPiOS/Codecs/ReactionCodec.swift +++ b/Sources/XMTPiOS/Codecs/ReactionCodec.swift @@ -97,4 +97,15 @@ public struct ReactionCodec: ContentCodec { return nil } } + + public func shouldPush(content: Reaction) throws -> Bool { + switch content.action { + case .added: + return true + case .removed: + return false + case .unknown: + return false + } + } } diff --git a/Sources/XMTPiOS/Codecs/ReadReceiptCodec.swift b/Sources/XMTPiOS/Codecs/ReadReceiptCodec.swift index 6f4f35c3..164ff23f 100644 --- a/Sources/XMTPiOS/Codecs/ReadReceiptCodec.swift +++ b/Sources/XMTPiOS/Codecs/ReadReceiptCodec.swift @@ -36,4 +36,8 @@ public struct ReadReceiptCodec: ContentCodec { public func fallback(content: ReadReceipt) throws -> String? { return nil } + + public func shouldPush(content: ReadReceipt) throws -> Bool { + return false + } } diff --git a/Sources/XMTPiOS/Codecs/RemoteAttachmentCodec.swift b/Sources/XMTPiOS/Codecs/RemoteAttachmentCodec.swift index 847fbddc..62af9969 100644 --- a/Sources/XMTPiOS/Codecs/RemoteAttachmentCodec.swift +++ b/Sources/XMTPiOS/Codecs/RemoteAttachmentCodec.swift @@ -206,4 +206,8 @@ public struct RemoteAttachmentCodec: ContentCodec { return Data(parameterData) } + + public func shouldPush(content: RemoteAttachment) throws -> Bool { + return true + } } diff --git a/Sources/XMTPiOS/Codecs/ReplyCodec.swift b/Sources/XMTPiOS/Codecs/ReplyCodec.swift index 4c7c98fc..b3244813 100644 --- a/Sources/XMTPiOS/Codecs/ReplyCodec.swift +++ b/Sources/XMTPiOS/Codecs/ReplyCodec.swift @@ -66,4 +66,8 @@ public struct ReplyCodec: ContentCodec { public func fallback(content: Reply) throws -> String? { return "Replied with “\(content.content)” to an earlier message" } + + public func shouldPush(content: Reply) throws -> Bool { + return true + } } diff --git a/Sources/XMTPiOS/Codecs/TextCodec.swift b/Sources/XMTPiOS/Codecs/TextCodec.swift index 64b6db07..b7f6bf13 100644 --- a/Sources/XMTPiOS/Codecs/TextCodec.swift +++ b/Sources/XMTPiOS/Codecs/TextCodec.swift @@ -46,4 +46,8 @@ public struct TextCodec: ContentCodec { public func fallback(content: String) throws -> String? { return nil } + + public func shouldPush(content: String) throws -> Bool { + return true + } } diff --git a/Sources/XMTPiOS/ConversationV2.swift b/Sources/XMTPiOS/ConversationV2.swift index cd345d9b..6274dd78 100644 --- a/Sources/XMTPiOS/ConversationV2.swift +++ b/Sources/XMTPiOS/ConversationV2.swift @@ -78,11 +78,14 @@ public struct ConversationV2 { } func prepareMessage(encodedContent: EncodedContent, options: SendOptions?) async throws -> PreparedMessage { + let codec = client.codecRegistry.find(for: options?.contentType) + let message = try await MessageV2.encode( client: client, content: encodedContent, topic: topic, - keyMaterial: keyMaterial + keyMaterial: keyMaterial, + codec: codec ) let topic = options?.ephemeral == true ? ephemeralTopic : topic @@ -233,7 +236,8 @@ public struct ConversationV2 { client: client, content: content, topic: topic, - keyMaterial: keyMaterial + keyMaterial: keyMaterial, + codec: codec ) let envelope = Envelope( diff --git a/Sources/XMTPiOS/Crypto.swift b/Sources/XMTPiOS/Crypto.swift index 6b3fdd65..4f3e7126 100644 --- a/Sources/XMTPiOS/Crypto.swift +++ b/Sources/XMTPiOS/Crypto.swift @@ -8,7 +8,7 @@ import Foundation public typealias CipherText = Xmtp_MessageContents_Ciphertext enum CryptoError: Error { - case randomBytes, combinedPayload + case randomBytes, combinedPayload, keyDerivationError, hmacSignatureError } enum Crypto { @@ -103,4 +103,42 @@ enum Crypto { throw CryptoError.randomBytes } } + + static func hkdfHmacKey(secret: Data, info: Data) throws -> SymmetricKey { + do { + let salt = try secureRandomBytes(count: 32) + let key = HKDF.deriveKey( + inputKeyMaterial: SymmetricKey(data: secret), + salt: salt, + info: info, + outputByteCount: 32) + return key + } catch { + throw CryptoError.keyDerivationError + } + } + + static func generateHmacSignature(secret: Data, info: Data, message: Data) throws -> Data { + do { + let key = try hkdfHmacKey(secret: secret, info: info) + let signature = HMAC.authenticationCode(for: message, using: key) + return Data(signature) + } catch { + throw CryptoError.hmacSignatureError + } + } + + static func exportHmacKey(key: SymmetricKey) -> Data { + var exportedData = Data(count: key.bitCount / 8) + exportedData.withUnsafeMutableBytes { buffer in + key.withUnsafeBytes { keyBuffer in + buffer.copyMemory(from: keyBuffer) + } + } + return exportedData + } + + static func importHmacKey(keyData: Data) -> SymmetricKey { + return SymmetricKey(data: keyData) + } } diff --git a/Sources/XMTPiOS/Messages/MessageV2.swift b/Sources/XMTPiOS/Messages/MessageV2.swift index 71de2c9a..5978caf9 100644 --- a/Sources/XMTPiOS/Messages/MessageV2.swift +++ b/Sources/XMTPiOS/Messages/MessageV2.swift @@ -12,14 +12,16 @@ import LibXMTP typealias MessageV2 = Xmtp_MessageContents_MessageV2 enum MessageV2Error: Error { - case invalidSignature, decodeError(String) + case invalidSignature, decodeError(String), invalidData } extension MessageV2 { - init(headerBytes: Data, ciphertext: CipherText) { + init(headerBytes: Data, ciphertext: CipherText, senderHmac: Data, shouldPush: Bool) { self.init() self.headerBytes = headerBytes self.ciphertext = ciphertext + self.senderHmac = senderHmac + self.shouldPush = shouldPush } static func decrypt(_ id: String, _ topic: String, _ message: MessageV2, keyMaterial: Data, client: Client) throws -> DecryptedMessage { @@ -78,7 +80,7 @@ extension MessageV2 { } } - static func encode(client: Client, content encodedContent: EncodedContent, topic: String, keyMaterial: Data) async throws -> MessageV2 { + static func encode(client: Client, content encodedContent: EncodedContent, topic: String, keyMaterial: Data, codec: Codec) async throws -> MessageV2 { let payload = try encodedContent.serializedData() let date = Date() @@ -95,10 +97,24 @@ extension MessageV2 { let signedBytes = try signedContent.serializedData() let ciphertext = try Crypto.encrypt(keyMaterial, signedBytes, additionalData: headerBytes) + + let thirtyDayPeriodsSinceEpoch = Int(date.timeIntervalSince1970 / 60 / 60 / 24 / 30) + let info = "\(thirtyDayPeriodsSinceEpoch)-\(client.address)" + guard let infoEncoded = info.data(using: .utf8) else { + throw MessageV2Error.invalidData + } + + let senderHmac = try Crypto.generateHmacSignature(secret: keyMaterial, info: infoEncoded, message: headerBytes) + + let decoded = try codec.decode(content: encodedContent, client: client) + let shouldPush = try codec.shouldPush(content: decoded) + return MessageV2( headerBytes: headerBytes, - ciphertext: ciphertext + ciphertext: ciphertext, + senderHmac: senderHmac, + shouldPush: shouldPush ) } } diff --git a/Sources/XMTPiOS/Proto/keystore_api/v1/keystore.pb.swift b/Sources/XMTPiOS/Proto/keystore_api/v1/keystore.pb.swift index 865874ae..901520aa 100644 --- a/Sources/XMTPiOS/Proto/keystore_api/v1/keystore.pb.swift +++ b/Sources/XMTPiOS/Proto/keystore_api/v1/keystore.pb.swift @@ -31,25 +31,25 @@ public enum Xmtp_KeystoreApi_V1_ErrorCode: SwiftProtobuf.Enum { case UNRECOGNIZED(Int) public init() { - self = .unspecified + self = .unspecified } public init?(rawValue: Int) { - switch rawValue { - case 0: self = .unspecified - case 1: self = .invalidInput - case 2: self = .noMatchingPrekey - default: self = .UNRECOGNIZED(rawValue) - } + switch rawValue { + case 0: self = .unspecified + case 1: self = .invalidInput + case 2: self = .noMatchingPrekey + default: self = .UNRECOGNIZED(rawValue) + } } public var rawValue: Int { - switch self { - case .unspecified: return 0 - case .invalidInput: return 1 - case .noMatchingPrekey: return 2 - case .UNRECOGNIZED(let i): return i - } + switch self { + case .unspecified: return 0 + case .invalidInput: return 1 + case .noMatchingPrekey: return 2 + case .UNRECOGNIZED(let i): return i + } } } @@ -59,9 +59,9 @@ public enum Xmtp_KeystoreApi_V1_ErrorCode: SwiftProtobuf.Enum { extension Xmtp_KeystoreApi_V1_ErrorCode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Xmtp_KeystoreApi_V1_ErrorCode] = [ - .unspecified, - .invalidInput, - .noMatchingPrekey, + .unspecified, + .invalidInput, + .noMatchingPrekey, ] } @@ -73,28 +73,31 @@ public enum Xmtp_KeystoreApi_V1_JobType: SwiftProtobuf.Enum { case unspecified // = 0 case refreshV1 // = 1 case refreshV2 // = 2 + case refreshPppp // = 3 case UNRECOGNIZED(Int) public init() { - self = .unspecified + self = .unspecified } public init?(rawValue: Int) { - switch rawValue { - case 0: self = .unspecified - case 1: self = .refreshV1 - case 2: self = .refreshV2 - default: self = .UNRECOGNIZED(rawValue) - } + switch rawValue { + case 0: self = .unspecified + case 1: self = .refreshV1 + case 2: self = .refreshV2 + case 3: self = .refreshPppp + default: self = .UNRECOGNIZED(rawValue) + } } public var rawValue: Int { - switch self { - case .unspecified: return 0 - case .refreshV1: return 1 - case .refreshV2: return 2 - case .UNRECOGNIZED(let i): return i - } + switch self { + case .unspecified: return 0 + case .refreshV1: return 1 + case .refreshV2: return 2 + case .refreshPppp: return 3 + case .UNRECOGNIZED(let i): return i + } } } @@ -104,9 +107,10 @@ public enum Xmtp_KeystoreApi_V1_JobType: SwiftProtobuf.Enum { extension Xmtp_KeystoreApi_V1_JobType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Xmtp_KeystoreApi_V1_JobType] = [ - .unspecified, - .refreshV1, - .refreshV2, + .unspecified, + .refreshV1, + .refreshV2, + .refreshPppp, ] } @@ -139,38 +143,38 @@ public struct Xmtp_KeystoreApi_V1_DecryptV1Request { /// A single decryption request public struct Request { - // 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. + // 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. - public var payload: Xmtp_MessageContents_Ciphertext { - get {return _payload ?? Xmtp_MessageContents_Ciphertext()} - set {_payload = newValue} - } - /// Returns true if `payload` has been explicitly set. - public var hasPayload: Bool {return self._payload != nil} - /// Clears the value of `payload`. Subsequent reads from it will return its default value. - public mutating func clearPayload() {self._payload = nil} + public var payload: Xmtp_MessageContents_Ciphertext { + get {return _payload ?? Xmtp_MessageContents_Ciphertext()} + set {_payload = newValue} + } + /// Returns true if `payload` has been explicitly set. + public var hasPayload: Bool {return self._payload != nil} + /// Clears the value of `payload`. Subsequent reads from it will return its default value. + public mutating func clearPayload() {self._payload = nil} - public var peerKeys: Xmtp_MessageContents_PublicKeyBundle { - get {return _peerKeys ?? Xmtp_MessageContents_PublicKeyBundle()} - set {_peerKeys = newValue} - } - /// Returns true if `peerKeys` has been explicitly set. - public var hasPeerKeys: Bool {return self._peerKeys != nil} - /// Clears the value of `peerKeys`. Subsequent reads from it will return its default value. - public mutating func clearPeerKeys() {self._peerKeys = nil} + public var peerKeys: Xmtp_MessageContents_PublicKeyBundle { + get {return _peerKeys ?? Xmtp_MessageContents_PublicKeyBundle()} + set {_peerKeys = newValue} + } + /// Returns true if `peerKeys` has been explicitly set. + public var hasPeerKeys: Bool {return self._peerKeys != nil} + /// Clears the value of `peerKeys`. Subsequent reads from it will return its default value. + public mutating func clearPeerKeys() {self._peerKeys = nil} - public var headerBytes: Data = Data() + public var headerBytes: Data = Data() - public var isSender: Bool = false + public var isSender: Bool = false - public var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - public init() {} + public init() {} - fileprivate var _payload: Xmtp_MessageContents_Ciphertext? = nil - fileprivate var _peerKeys: Xmtp_MessageContents_PublicKeyBundle? = nil + fileprivate var _payload: Xmtp_MessageContents_Ciphertext? = nil + fileprivate var _peerKeys: Xmtp_MessageContents_PublicKeyBundle? = nil } public init() {} @@ -188,68 +192,68 @@ public struct Xmtp_KeystoreApi_V1_DecryptResponse { /// A single decryption response public struct Response { - // 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. - - public var response: Xmtp_KeystoreApi_V1_DecryptResponse.Response.OneOf_Response? = nil - - public var result: Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success { - get { - if case .result(let v)? = response {return v} - return Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success() - } - set {response = .result(newValue)} - } - - public var error: Xmtp_KeystoreApi_V1_KeystoreError { - get { - if case .error(let v)? = response {return v} - return Xmtp_KeystoreApi_V1_KeystoreError() - } - set {response = .error(newValue)} - } - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public enum OneOf_Response: Equatable { - case result(Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success) - case error(Xmtp_KeystoreApi_V1_KeystoreError) - - #if !swift(>=4.1) - public static func ==(lhs: Xmtp_KeystoreApi_V1_DecryptResponse.Response.OneOf_Response, rhs: Xmtp_KeystoreApi_V1_DecryptResponse.Response.OneOf_Response) -> Bool { - // 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 (lhs, rhs) { - case (.result, .result): return { - guard case .result(let l) = lhs, case .result(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.error, .error): return { - guard case .error(let l) = lhs, case .error(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - /// Wrapper object for success response - public struct Success { - // 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. - - public var decrypted: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - } - - public init() {} + // 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. + + public var response: Xmtp_KeystoreApi_V1_DecryptResponse.Response.OneOf_Response? = nil + + public var result: Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success { + get { + if case .result(let v)? = response {return v} + return Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success() + } + set {response = .result(newValue)} + } + + public var error: Xmtp_KeystoreApi_V1_KeystoreError { + get { + if case .error(let v)? = response {return v} + return Xmtp_KeystoreApi_V1_KeystoreError() + } + set {response = .error(newValue)} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public enum OneOf_Response: Equatable { + case result(Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success) + case error(Xmtp_KeystoreApi_V1_KeystoreError) + + #if !swift(>=4.1) + public static func ==(lhs: Xmtp_KeystoreApi_V1_DecryptResponse.Response.OneOf_Response, rhs: Xmtp_KeystoreApi_V1_DecryptResponse.Response.OneOf_Response) -> Bool { + // 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 (lhs, rhs) { + case (.result, .result): return { + guard case .result(let l) = lhs, case .result(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.error, .error): return { + guard case .error(let l) = lhs, case .error(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + /// Wrapper object for success response + public struct Success { + // 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. + + public var decrypted: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + } + + public init() {} } public init() {} @@ -267,28 +271,28 @@ public struct Xmtp_KeystoreApi_V1_DecryptV2Request { /// A single decryption request public struct Request { - // 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. + // 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. - public var payload: Xmtp_MessageContents_Ciphertext { - get {return _payload ?? Xmtp_MessageContents_Ciphertext()} - set {_payload = newValue} - } - /// Returns true if `payload` has been explicitly set. - public var hasPayload: Bool {return self._payload != nil} - /// Clears the value of `payload`. Subsequent reads from it will return its default value. - public mutating func clearPayload() {self._payload = nil} + public var payload: Xmtp_MessageContents_Ciphertext { + get {return _payload ?? Xmtp_MessageContents_Ciphertext()} + set {_payload = newValue} + } + /// Returns true if `payload` has been explicitly set. + public var hasPayload: Bool {return self._payload != nil} + /// Clears the value of `payload`. Subsequent reads from it will return its default value. + public mutating func clearPayload() {self._payload = nil} - public var headerBytes: Data = Data() + public var headerBytes: Data = Data() - public var contentTopic: String = String() + public var contentTopic: String = String() - public var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - public init() {} + public init() {} - fileprivate var _payload: Xmtp_MessageContents_Ciphertext? = nil + fileprivate var _payload: Xmtp_MessageContents_Ciphertext? = nil } public init() {} @@ -306,28 +310,28 @@ public struct Xmtp_KeystoreApi_V1_EncryptV1Request { /// A single encryption request public struct Request { - // 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. + // 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. - public var recipient: Xmtp_MessageContents_PublicKeyBundle { - get {return _recipient ?? Xmtp_MessageContents_PublicKeyBundle()} - set {_recipient = newValue} - } - /// Returns true if `recipient` has been explicitly set. - public var hasRecipient: Bool {return self._recipient != nil} - /// Clears the value of `recipient`. Subsequent reads from it will return its default value. - public mutating func clearRecipient() {self._recipient = nil} + public var recipient: Xmtp_MessageContents_PublicKeyBundle { + get {return _recipient ?? Xmtp_MessageContents_PublicKeyBundle()} + set {_recipient = newValue} + } + /// Returns true if `recipient` has been explicitly set. + public var hasRecipient: Bool {return self._recipient != nil} + /// Clears the value of `recipient`. Subsequent reads from it will return its default value. + public mutating func clearRecipient() {self._recipient = nil} - public var payload: Data = Data() + public var payload: Data = Data() - public var headerBytes: Data = Data() + public var headerBytes: Data = Data() - public var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - public init() {} + public init() {} - fileprivate var _recipient: Xmtp_MessageContents_PublicKeyBundle? = nil + fileprivate var _recipient: Xmtp_MessageContents_PublicKeyBundle? = nil } public init() {} @@ -345,77 +349,79 @@ public struct Xmtp_KeystoreApi_V1_EncryptResponse { /// A single encryption response public struct Response { - // 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. - - public var response: Xmtp_KeystoreApi_V1_EncryptResponse.Response.OneOf_Response? = nil - - public var result: Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success { - get { - if case .result(let v)? = response {return v} - return Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success() - } - set {response = .result(newValue)} - } - - public var error: Xmtp_KeystoreApi_V1_KeystoreError { - get { - if case .error(let v)? = response {return v} - return Xmtp_KeystoreApi_V1_KeystoreError() - } - set {response = .error(newValue)} - } - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public enum OneOf_Response: Equatable { - case result(Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success) - case error(Xmtp_KeystoreApi_V1_KeystoreError) - - #if !swift(>=4.1) - public static func ==(lhs: Xmtp_KeystoreApi_V1_EncryptResponse.Response.OneOf_Response, rhs: Xmtp_KeystoreApi_V1_EncryptResponse.Response.OneOf_Response) -> Bool { - // 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 (lhs, rhs) { - case (.result, .result): return { - guard case .result(let l) = lhs, case .result(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.error, .error): return { - guard case .error(let l) = lhs, case .error(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - /// Wrapper object for success response - public struct Success { - // 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. - - public var encrypted: Xmtp_MessageContents_Ciphertext { - get {return _encrypted ?? Xmtp_MessageContents_Ciphertext()} - set {_encrypted = newValue} - } - /// Returns true if `encrypted` has been explicitly set. - public var hasEncrypted: Bool {return self._encrypted != nil} - /// Clears the value of `encrypted`. Subsequent reads from it will return its default value. - public mutating func clearEncrypted() {self._encrypted = nil} - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _encrypted: Xmtp_MessageContents_Ciphertext? = nil - } - - public init() {} + // 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. + + public var response: Xmtp_KeystoreApi_V1_EncryptResponse.Response.OneOf_Response? = nil + + public var result: Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success { + get { + if case .result(let v)? = response {return v} + return Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success() + } + set {response = .result(newValue)} + } + + public var error: Xmtp_KeystoreApi_V1_KeystoreError { + get { + if case .error(let v)? = response {return v} + return Xmtp_KeystoreApi_V1_KeystoreError() + } + set {response = .error(newValue)} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public enum OneOf_Response: Equatable { + case result(Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success) + case error(Xmtp_KeystoreApi_V1_KeystoreError) + + #if !swift(>=4.1) + public static func ==(lhs: Xmtp_KeystoreApi_V1_EncryptResponse.Response.OneOf_Response, rhs: Xmtp_KeystoreApi_V1_EncryptResponse.Response.OneOf_Response) -> Bool { + // 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 (lhs, rhs) { + case (.result, .result): return { + guard case .result(let l) = lhs, case .result(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.error, .error): return { + guard case .error(let l) = lhs, case .error(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + /// Wrapper object for success response + public struct Success { + // 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. + + public var encrypted: Xmtp_MessageContents_Ciphertext { + get {return _encrypted ?? Xmtp_MessageContents_Ciphertext()} + set {_encrypted = newValue} + } + /// Returns true if `encrypted` has been explicitly set. + public var hasEncrypted: Bool {return self._encrypted != nil} + /// Clears the value of `encrypted`. Subsequent reads from it will return its default value. + public mutating func clearEncrypted() {self._encrypted = nil} + + public var senderHmac: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _encrypted: Xmtp_MessageContents_Ciphertext? = nil + } + + public init() {} } public init() {} @@ -433,24 +439,168 @@ public struct Xmtp_KeystoreApi_V1_EncryptV2Request { /// A single encryption request public struct Request { - // 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. + // 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. - public var payload: Data = Data() + public var payload: Data = Data() - public var headerBytes: Data = Data() + public var headerBytes: Data = Data() - public var contentTopic: String = String() + public var contentTopic: String = String() - public var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - public init() {} + public init() {} } public init() {} } +/// Encrypt a message for yourself +public struct Xmtp_KeystoreApi_V1_SelfEncryptRequest { + // 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. + + public var requests: [Xmtp_KeystoreApi_V1_SelfEncryptRequest.Request] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Request type + public struct Request { + // 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. + + public var payload: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + } + + public init() {} +} + +/// Response type for SelfEncryptRequest +public struct Xmtp_KeystoreApi_V1_SelfEncryptResponse { + // 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. + + public var responses: [Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Response type + public struct Response { + // 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. + + public var response: Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.OneOf_Response? = nil + + public var result: Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.Success { + get { + if case .result(let v)? = response {return v} + return Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.Success() + } + set {response = .result(newValue)} + } + + public var error: Xmtp_KeystoreApi_V1_KeystoreError { + get { + if case .error(let v)? = response {return v} + return Xmtp_KeystoreApi_V1_KeystoreError() + } + set {response = .error(newValue)} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public enum OneOf_Response: Equatable { + case result(Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.Success) + case error(Xmtp_KeystoreApi_V1_KeystoreError) + + #if !swift(>=4.1) + public static func ==(lhs: Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.OneOf_Response, rhs: Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.OneOf_Response) -> Bool { + // 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 (lhs, rhs) { + case (.result, .result): return { + guard case .result(let l) = lhs, case .result(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.error, .error): return { + guard case .error(let l) = lhs, case .error(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + /// Success response + public struct Success { + // 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. + + public var encrypted: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + } + + public init() {} + } + + public init() {} +} + +/// SelfDecryptRequest +public struct Xmtp_KeystoreApi_V1_SelfDecryptRequest { + // 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. + + public var requests: [Xmtp_KeystoreApi_V1_SelfDecryptRequest.Request] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Request type + public struct Request { + // 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. + + public var payload: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + } + + public init() {} +} + +/// Get the private preferences topic identifier +public struct Xmtp_KeystoreApi_V1_GetPrivatePreferencesTopicIdentifierResponse { + // 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. + + public var identifier: String = String() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + /// Request to create an invite payload, and store the topic keys in the Keystore public struct Xmtp_KeystoreApi_V1_CreateInviteRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the @@ -458,8 +608,8 @@ public struct Xmtp_KeystoreApi_V1_CreateInviteRequest { // methods supported on all messages. public var context: Xmtp_MessageContents_InvitationV1.Context { - get {return _context ?? Xmtp_MessageContents_InvitationV1.Context()} - set {_context = newValue} + get {return _context ?? Xmtp_MessageContents_InvitationV1.Context()} + set {_context = newValue} } /// Returns true if `context` has been explicitly set. public var hasContext: Bool {return self._context != nil} @@ -467,8 +617,8 @@ public struct Xmtp_KeystoreApi_V1_CreateInviteRequest { public mutating func clearContext() {self._context = nil} public var recipient: Xmtp_MessageContents_SignedPublicKeyBundle { - get {return _recipient ?? Xmtp_MessageContents_SignedPublicKeyBundle()} - set {_recipient = newValue} + get {return _recipient ?? Xmtp_MessageContents_SignedPublicKeyBundle()} + set {_recipient = newValue} } /// Returns true if `recipient` has been explicitly set. public var hasRecipient: Bool {return self._recipient != nil} @@ -492,8 +642,8 @@ public struct Xmtp_KeystoreApi_V1_CreateInviteResponse { // methods supported on all messages. public var conversation: Xmtp_MessageContents_ConversationReference { - get {return _conversation ?? Xmtp_MessageContents_ConversationReference()} - set {_conversation = newValue} + get {return _conversation ?? Xmtp_MessageContents_ConversationReference()} + set {_conversation = newValue} } /// Returns true if `conversation` has been explicitly set. public var hasConversation: Bool {return self._conversation != nil} @@ -521,19 +671,19 @@ public struct Xmtp_KeystoreApi_V1_SaveInvitesRequest { /// Mirrors xmtp.envelope schema public struct Request { - // 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. + // 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. - public var contentTopic: String = String() + public var contentTopic: String = String() - public var timestampNs: UInt64 = 0 + public var timestampNs: UInt64 = 0 - public var payload: Data = Data() + public var payload: Data = Data() - public var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - public init() {} + public init() {} } public init() {} @@ -551,77 +701,77 @@ public struct Xmtp_KeystoreApi_V1_SaveInvitesResponse { /// A single response public struct Response { - // 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. - - public var response: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.OneOf_Response? = nil - - public var result: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success { - get { - if case .result(let v)? = response {return v} - return Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success() - } - set {response = .result(newValue)} - } - - public var error: Xmtp_KeystoreApi_V1_KeystoreError { - get { - if case .error(let v)? = response {return v} - return Xmtp_KeystoreApi_V1_KeystoreError() - } - set {response = .error(newValue)} - } - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public enum OneOf_Response: Equatable { - case result(Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success) - case error(Xmtp_KeystoreApi_V1_KeystoreError) - - #if !swift(>=4.1) - public static func ==(lhs: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.OneOf_Response, rhs: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.OneOf_Response) -> Bool { - // 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 (lhs, rhs) { - case (.result, .result): return { - guard case .result(let l) = lhs, case .result(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.error, .error): return { - guard case .error(let l) = lhs, case .error(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - /// Wrapper object for success response - public struct Success { - // 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. - - public var conversation: Xmtp_MessageContents_ConversationReference { - get {return _conversation ?? Xmtp_MessageContents_ConversationReference()} - set {_conversation = newValue} - } - /// Returns true if `conversation` has been explicitly set. - public var hasConversation: Bool {return self._conversation != nil} - /// Clears the value of `conversation`. Subsequent reads from it will return its default value. - public mutating func clearConversation() {self._conversation = nil} - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _conversation: Xmtp_MessageContents_ConversationReference? = nil - } - - public init() {} + // 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. + + public var response: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.OneOf_Response? = nil + + public var result: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success { + get { + if case .result(let v)? = response {return v} + return Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success() + } + set {response = .result(newValue)} + } + + public var error: Xmtp_KeystoreApi_V1_KeystoreError { + get { + if case .error(let v)? = response {return v} + return Xmtp_KeystoreApi_V1_KeystoreError() + } + set {response = .error(newValue)} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public enum OneOf_Response: Equatable { + case result(Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success) + case error(Xmtp_KeystoreApi_V1_KeystoreError) + + #if !swift(>=4.1) + public static func ==(lhs: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.OneOf_Response, rhs: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.OneOf_Response) -> Bool { + // 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 (lhs, rhs) { + case (.result, .result): return { + guard case .result(let l) = lhs, case .result(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.error, .error): return { + guard case .error(let l) = lhs, case .error(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + /// Wrapper object for success response + public struct Success { + // 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. + + public var conversation: Xmtp_MessageContents_ConversationReference { + get {return _conversation ?? Xmtp_MessageContents_ConversationReference()} + set {_conversation = newValue} + } + /// Returns true if `conversation` has been explicitly set. + public var hasConversation: Bool {return self._conversation != nil} + /// Clears the value of `conversation`. Subsequent reads from it will return its default value. + public mutating func clearConversation() {self._conversation = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _conversation: Xmtp_MessageContents_ConversationReference? = nil + } + + public init() {} } public init() {} @@ -634,8 +784,8 @@ public struct Xmtp_KeystoreApi_V1_CreateAuthTokenRequest { // methods supported on all messages. public var timestampNs: UInt64 { - get {return _timestampNs ?? 0} - set {_timestampNs = newValue} + get {return _timestampNs ?? 0} + set {_timestampNs = newValue} } /// Returns true if `timestampNs` has been explicitly set. public var hasTimestampNs: Bool {return self._timestampNs != nil} @@ -713,33 +863,33 @@ public struct Xmtp_KeystoreApi_V1_GetKeystoreStatusResponse { /// Status of the Keystore for the specified wallet address public enum KeystoreStatus: SwiftProtobuf.Enum { - public typealias RawValue = Int - case unspecified // = 0 - case uninitialized // = 1 - case initialized // = 2 - case UNRECOGNIZED(Int) - - public init() { - self = .unspecified - } - - public init?(rawValue: Int) { - switch rawValue { - case 0: self = .unspecified - case 1: self = .uninitialized - case 2: self = .initialized - default: self = .UNRECOGNIZED(rawValue) - } - } - - public var rawValue: Int { - switch self { - case .unspecified: return 0 - case .uninitialized: return 1 - case .initialized: return 2 - case .UNRECOGNIZED(let i): return i - } - } + public typealias RawValue = Int + case unspecified // = 0 + case uninitialized // = 1 + case initialized // = 2 + case UNRECOGNIZED(Int) + + public init() { + self = .unspecified + } + + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .unspecified + case 1: self = .uninitialized + case 2: self = .initialized + default: self = .UNRECOGNIZED(rawValue) + } + } + + public var rawValue: Int { + switch self { + case .unspecified: return 0 + case .uninitialized: return 1 + case .initialized: return 2 + case .UNRECOGNIZED(let i): return i + } + } } @@ -751,9 +901,9 @@ public struct Xmtp_KeystoreApi_V1_GetKeystoreStatusResponse { extension Xmtp_KeystoreApi_V1_GetKeystoreStatusResponse.KeystoreStatus: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Xmtp_KeystoreApi_V1_GetKeystoreStatusResponse.KeystoreStatus] = [ - .unspecified, - .uninitialized, - .initialized, + .unspecified, + .uninitialized, + .initialized, ] } @@ -769,30 +919,30 @@ public struct Xmtp_KeystoreApi_V1_InitKeystoreRequest { public var bundle: Xmtp_KeystoreApi_V1_InitKeystoreRequest.OneOf_Bundle? = nil public var v1: Xmtp_MessageContents_PrivateKeyBundleV1 { - get { - if case .v1(let v)? = bundle {return v} - return Xmtp_MessageContents_PrivateKeyBundleV1() - } - set {bundle = .v1(newValue)} + get { + if case .v1(let v)? = bundle {return v} + return Xmtp_MessageContents_PrivateKeyBundleV1() + } + set {bundle = .v1(newValue)} } public var unknownFields = SwiftProtobuf.UnknownStorage() public enum OneOf_Bundle: Equatable { - case v1(Xmtp_MessageContents_PrivateKeyBundleV1) + case v1(Xmtp_MessageContents_PrivateKeyBundleV1) #if !swift(>=4.1) - public static func ==(lhs: Xmtp_KeystoreApi_V1_InitKeystoreRequest.OneOf_Bundle, rhs: Xmtp_KeystoreApi_V1_InitKeystoreRequest.OneOf_Bundle) -> Bool { - // 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 (lhs, rhs) { - case (.v1, .v1): return { - guard case .v1(let l) = lhs, case .v1(let r) = rhs else { preconditionFailure() } - return l == r - }() - } - } + public static func ==(lhs: Xmtp_KeystoreApi_V1_InitKeystoreRequest.OneOf_Bundle, rhs: Xmtp_KeystoreApi_V1_InitKeystoreRequest.OneOf_Bundle) -> Bool { + // 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 (lhs, rhs) { + case (.v1, .v1): return { + guard case .v1(let l) = lhs, case .v1(let r) = rhs else { preconditionFailure() } + return l == r + }() + } + } #endif } @@ -806,8 +956,8 @@ public struct Xmtp_KeystoreApi_V1_InitKeystoreResponse { // methods supported on all messages. public var error: Xmtp_KeystoreApi_V1_KeystoreError { - get {return _error ?? Xmtp_KeystoreApi_V1_KeystoreError()} - set {_error = newValue} + get {return _error ?? Xmtp_KeystoreApi_V1_KeystoreError()} + set {_error = newValue} } /// Returns true if `error` has been explicitly set. public var hasError: Bool {return self._error != nil} @@ -833,44 +983,44 @@ public struct Xmtp_KeystoreApi_V1_SignDigestRequest { public var signer: Xmtp_KeystoreApi_V1_SignDigestRequest.OneOf_Signer? = nil public var identityKey: Bool { - get { - if case .identityKey(let v)? = signer {return v} - return false - } - set {signer = .identityKey(newValue)} + get { + if case .identityKey(let v)? = signer {return v} + return false + } + set {signer = .identityKey(newValue)} } public var prekeyIndex: UInt32 { - get { - if case .prekeyIndex(let v)? = signer {return v} - return 0 - } - set {signer = .prekeyIndex(newValue)} + get { + if case .prekeyIndex(let v)? = signer {return v} + return 0 + } + set {signer = .prekeyIndex(newValue)} } public var unknownFields = SwiftProtobuf.UnknownStorage() public enum OneOf_Signer: Equatable { - case identityKey(Bool) - case prekeyIndex(UInt32) + case identityKey(Bool) + case prekeyIndex(UInt32) #if !swift(>=4.1) - public static func ==(lhs: Xmtp_KeystoreApi_V1_SignDigestRequest.OneOf_Signer, rhs: Xmtp_KeystoreApi_V1_SignDigestRequest.OneOf_Signer) -> Bool { - // 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 (lhs, rhs) { - case (.identityKey, .identityKey): return { - guard case .identityKey(let l) = lhs, case .identityKey(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.prekeyIndex, .prekeyIndex): return { - guard case .prekeyIndex(let l) = lhs, case .prekeyIndex(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } + public static func ==(lhs: Xmtp_KeystoreApi_V1_SignDigestRequest.OneOf_Signer, rhs: Xmtp_KeystoreApi_V1_SignDigestRequest.OneOf_Signer) -> Bool { + // 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 (lhs, rhs) { + case (.identityKey, .identityKey): return { + guard case .identityKey(let l) = lhs, case .identityKey(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.prekeyIndex, .prekeyIndex): return { + guard case .prekeyIndex(let l) = lhs, case .prekeyIndex(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } #endif } @@ -941,28 +1091,82 @@ public struct Xmtp_KeystoreApi_V1_TopicMap { /// TopicData wraps the invitation and the timestamp it was created public struct TopicData { - // 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. + // 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. - public var createdNs: UInt64 = 0 + public var createdNs: UInt64 = 0 - public var peerAddress: String = String() + public var peerAddress: String = String() - public var invitation: Xmtp_MessageContents_InvitationV1 { - get {return _invitation ?? Xmtp_MessageContents_InvitationV1()} - set {_invitation = newValue} - } - /// Returns true if `invitation` has been explicitly set. - public var hasInvitation: Bool {return self._invitation != nil} - /// Clears the value of `invitation`. Subsequent reads from it will return its default value. - public mutating func clearInvitation() {self._invitation = nil} + public var invitation: Xmtp_MessageContents_InvitationV1 { + get {return _invitation ?? Xmtp_MessageContents_InvitationV1()} + set {_invitation = newValue} + } + /// Returns true if `invitation` has been explicitly set. + public var hasInvitation: Bool {return self._invitation != nil} + /// Clears the value of `invitation`. Subsequent reads from it will return its default value. + public mutating func clearInvitation() {self._invitation = nil} - public var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - public init() {} + public init() {} - fileprivate var _invitation: Xmtp_MessageContents_InvitationV1? = nil + fileprivate var _invitation: Xmtp_MessageContents_InvitationV1? = nil + } + + public init() {} +} + +/// Used to get a mapping of conversation topics to their HMAC keys +public struct Xmtp_KeystoreApi_V1_GetConversationHmacKeysRequest { + // 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. + + public var topics: [String] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// A mapping of topics to their HMAC keys +public struct Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse { + // 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. + + public var hmacKeys: Dictionary = [:] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + /// HmacKeyData wraps the HMAC key and the number of 30 day periods since epoch + public struct HmacKeyData { + // 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. + + public var thirtyDayPeriodsSinceEpoch: Int32 = 0 + + public var hmacKey: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + } + + /// HmacKeys represents multiple HmacKeyData objects + public struct HmacKeys { + // 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. + + public var values: [Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.HmacKeyData] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} } public init() {} @@ -988,6 +1192,15 @@ extension Xmtp_KeystoreApi_V1_EncryptResponse.Response.OneOf_Response: @unchecke extension Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success: @unchecked Sendable {} extension Xmtp_KeystoreApi_V1_EncryptV2Request: @unchecked Sendable {} extension Xmtp_KeystoreApi_V1_EncryptV2Request.Request: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_SelfEncryptRequest: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_SelfEncryptRequest.Request: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_SelfEncryptResponse: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.OneOf_Response: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.Success: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_SelfDecryptRequest: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_SelfDecryptRequest.Request: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_GetPrivatePreferencesTopicIdentifierResponse: @unchecked Sendable {} extension Xmtp_KeystoreApi_V1_CreateInviteRequest: @unchecked Sendable {} extension Xmtp_KeystoreApi_V1_CreateInviteResponse: @unchecked Sendable {} extension Xmtp_KeystoreApi_V1_SaveInvitesRequest: @unchecked Sendable {} @@ -1014,6 +1227,10 @@ extension Xmtp_KeystoreApi_V1_SetRefeshJobRequest: @unchecked Sendable {} extension Xmtp_KeystoreApi_V1_SetRefreshJobResponse: @unchecked Sendable {} extension Xmtp_KeystoreApi_V1_TopicMap: @unchecked Sendable {} extension Xmtp_KeystoreApi_V1_TopicMap.TopicData: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_GetConversationHmacKeysRequest: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.HmacKeyData: @unchecked Sendable {} +extension Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.HmacKeys: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -1022,1021 +1239,1322 @@ fileprivate let _protobuf_package = "xmtp.keystore_api.v1" extension Xmtp_KeystoreApi_V1_ErrorCode: SwiftProtobuf._ProtoNameProviding { public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "ERROR_CODE_UNSPECIFIED"), - 1: .same(proto: "ERROR_CODE_INVALID_INPUT"), - 2: .same(proto: "ERROR_CODE_NO_MATCHING_PREKEY"), + 0: .same(proto: "ERROR_CODE_UNSPECIFIED"), + 1: .same(proto: "ERROR_CODE_INVALID_INPUT"), + 2: .same(proto: "ERROR_CODE_NO_MATCHING_PREKEY"), ] } extension Xmtp_KeystoreApi_V1_JobType: SwiftProtobuf._ProtoNameProviding { public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "JOB_TYPE_UNSPECIFIED"), - 1: .same(proto: "JOB_TYPE_REFRESH_V1"), - 2: .same(proto: "JOB_TYPE_REFRESH_V2"), + 0: .same(proto: "JOB_TYPE_UNSPECIFIED"), + 1: .same(proto: "JOB_TYPE_REFRESH_V1"), + 2: .same(proto: "JOB_TYPE_REFRESH_V2"), + 3: .same(proto: "JOB_TYPE_REFRESH_PPPP"), ] } extension Xmtp_KeystoreApi_V1_KeystoreError: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".KeystoreError" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "message"), - 2: .same(proto: "code"), + 1: .same(proto: "message"), + 2: .same(proto: "code"), ] public 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.decodeSingularStringField(value: &self.message) }() - case 2: try { try decoder.decodeSingularEnumField(value: &self.code) }() - default: break - } - } + 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.decodeSingularStringField(value: &self.message) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self.code) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.message.isEmpty { - try visitor.visitSingularStringField(value: self.message, fieldNumber: 1) - } - if self.code != .unspecified { - try visitor.visitSingularEnumField(value: self.code, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) + if !self.message.isEmpty { + try visitor.visitSingularStringField(value: self.message, fieldNumber: 1) + } + if self.code != .unspecified { + try visitor.visitSingularEnumField(value: self.code, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_KeystoreError, rhs: Xmtp_KeystoreApi_V1_KeystoreError) -> Bool { - if lhs.message != rhs.message {return false} - if lhs.code != rhs.code {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.message != rhs.message {return false} + if lhs.code != rhs.code {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_DecryptV1Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".DecryptV1Request" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "requests"), + 1: .same(proto: "requests"), ] public 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.decodeRepeatedMessageField(value: &self.requests) }() - default: break - } - } + 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.decodeRepeatedMessageField(value: &self.requests) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.requests.isEmpty { - try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.requests.isEmpty { + try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_DecryptV1Request, rhs: Xmtp_KeystoreApi_V1_DecryptV1Request) -> Bool { - if lhs.requests != rhs.requests {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.requests != rhs.requests {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_DecryptV1Request.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_DecryptV1Request.protoMessageName + ".Request" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "payload"), - 2: .standard(proto: "peer_keys"), - 3: .standard(proto: "header_bytes"), - 4: .standard(proto: "is_sender"), + 1: .same(proto: "payload"), + 2: .standard(proto: "peer_keys"), + 3: .standard(proto: "header_bytes"), + 4: .standard(proto: "is_sender"), ] public 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._payload) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._peerKeys) }() - case 3: try { try decoder.decodeSingularBytesField(value: &self.headerBytes) }() - case 4: try { try decoder.decodeSingularBoolField(value: &self.isSender) }() - default: break - } - } + 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._payload) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._peerKeys) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self.headerBytes) }() + case 4: try { try decoder.decodeSingularBoolField(value: &self.isSender) }() + default: break + } + } } public 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._payload { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if let v = self._peerKeys { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - if !self.headerBytes.isEmpty { - try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 3) - } - if self.isSender != false { - try visitor.visitSingularBoolField(value: self.isSender, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) + // 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._payload { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._peerKeys { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if !self.headerBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 3) + } + if self.isSender != false { + try visitor.visitSingularBoolField(value: self.isSender, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_DecryptV1Request.Request, rhs: Xmtp_KeystoreApi_V1_DecryptV1Request.Request) -> Bool { - if lhs._payload != rhs._payload {return false} - if lhs._peerKeys != rhs._peerKeys {return false} - if lhs.headerBytes != rhs.headerBytes {return false} - if lhs.isSender != rhs.isSender {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs._payload != rhs._payload {return false} + if lhs._peerKeys != rhs._peerKeys {return false} + if lhs.headerBytes != rhs.headerBytes {return false} + if lhs.isSender != rhs.isSender {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_DecryptResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".DecryptResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "responses"), + 1: .same(proto: "responses"), ] public 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.decodeRepeatedMessageField(value: &self.responses) }() - default: break - } - } + 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.decodeRepeatedMessageField(value: &self.responses) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.responses.isEmpty { - try visitor.visitRepeatedMessageField(value: self.responses, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.responses.isEmpty { + try visitor.visitRepeatedMessageField(value: self.responses, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_DecryptResponse, rhs: Xmtp_KeystoreApi_V1_DecryptResponse) -> Bool { - if lhs.responses != rhs.responses {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.responses != rhs.responses {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_DecryptResponse.Response: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_DecryptResponse.protoMessageName + ".Response" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "result"), - 2: .same(proto: "error"), + 1: .same(proto: "result"), + 2: .same(proto: "error"), ] public 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 { - var v: Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success? - var hadOneofValue = false - if let current = self.response { - hadOneofValue = true - if case .result(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.response = .result(v) - } - }() - case 2: try { - var v: Xmtp_KeystoreApi_V1_KeystoreError? - var hadOneofValue = false - if let current = self.response { - hadOneofValue = true - if case .error(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.response = .error(v) - } - }() - default: break - } - } + 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 { + var v: Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success? + var hadOneofValue = false + if let current = self.response { + hadOneofValue = true + if case .result(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.response = .result(v) + } + }() + case 2: try { + var v: Xmtp_KeystoreApi_V1_KeystoreError? + var hadOneofValue = false + if let current = self.response { + hadOneofValue = true + if case .error(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.response = .error(v) + } + }() + default: break + } + } } public 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 - switch self.response { - case .result?: try { - guard case .result(let v)? = self.response else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - }() - case .error?: try { - guard case .error(let v)? = self.response else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) + // 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 + switch self.response { + case .result?: try { + guard case .result(let v)? = self.response else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + }() + case .error?: try { + guard case .error(let v)? = self.response else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_DecryptResponse.Response, rhs: Xmtp_KeystoreApi_V1_DecryptResponse.Response) -> Bool { - if lhs.response != rhs.response {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.response != rhs.response {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_DecryptResponse.Response.protoMessageName + ".Success" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "decrypted"), + 1: .same(proto: "decrypted"), ] public 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.decrypted) }() - default: break - } - } + 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.decrypted) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.decrypted.isEmpty { - try visitor.visitSingularBytesField(value: self.decrypted, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.decrypted.isEmpty { + try visitor.visitSingularBytesField(value: self.decrypted, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success, rhs: Xmtp_KeystoreApi_V1_DecryptResponse.Response.Success) -> Bool { - if lhs.decrypted != rhs.decrypted {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.decrypted != rhs.decrypted {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_DecryptV2Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".DecryptV2Request" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "requests"), + 1: .same(proto: "requests"), ] public 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.decodeRepeatedMessageField(value: &self.requests) }() - default: break - } - } + 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.decodeRepeatedMessageField(value: &self.requests) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.requests.isEmpty { - try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.requests.isEmpty { + try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_DecryptV2Request, rhs: Xmtp_KeystoreApi_V1_DecryptV2Request) -> Bool { - if lhs.requests != rhs.requests {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.requests != rhs.requests {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_DecryptV2Request.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_DecryptV2Request.protoMessageName + ".Request" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "payload"), - 2: .standard(proto: "header_bytes"), - 3: .standard(proto: "content_topic"), + 1: .same(proto: "payload"), + 2: .standard(proto: "header_bytes"), + 3: .standard(proto: "content_topic"), ] public 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._payload) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.headerBytes) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.contentTopic) }() - default: break - } - } + 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._payload) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.headerBytes) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.contentTopic) }() + default: break + } + } } public 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._payload { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.headerBytes.isEmpty { - try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 2) - } - if !self.contentTopic.isEmpty { - try visitor.visitSingularStringField(value: self.contentTopic, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) + // 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._payload { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.headerBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 2) + } + if !self.contentTopic.isEmpty { + try visitor.visitSingularStringField(value: self.contentTopic, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_DecryptV2Request.Request, rhs: Xmtp_KeystoreApi_V1_DecryptV2Request.Request) -> Bool { - if lhs._payload != rhs._payload {return false} - if lhs.headerBytes != rhs.headerBytes {return false} - if lhs.contentTopic != rhs.contentTopic {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs._payload != rhs._payload {return false} + if lhs.headerBytes != rhs.headerBytes {return false} + if lhs.contentTopic != rhs.contentTopic {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_EncryptV1Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".EncryptV1Request" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "requests"), + 1: .same(proto: "requests"), ] public 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.decodeRepeatedMessageField(value: &self.requests) }() - default: break - } - } + 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.decodeRepeatedMessageField(value: &self.requests) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.requests.isEmpty { - try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.requests.isEmpty { + try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_EncryptV1Request, rhs: Xmtp_KeystoreApi_V1_EncryptV1Request) -> Bool { - if lhs.requests != rhs.requests {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.requests != rhs.requests {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_EncryptV1Request.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_EncryptV1Request.protoMessageName + ".Request" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "recipient"), - 2: .same(proto: "payload"), - 3: .standard(proto: "header_bytes"), + 1: .same(proto: "recipient"), + 2: .same(proto: "payload"), + 3: .standard(proto: "header_bytes"), ] public 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._recipient) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.payload) }() - case 3: try { try decoder.decodeSingularBytesField(value: &self.headerBytes) }() - default: break - } - } + 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._recipient) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.payload) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self.headerBytes) }() + default: break + } + } } public 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._recipient { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.payload.isEmpty { - try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 2) - } - if !self.headerBytes.isEmpty { - try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) + // 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._recipient { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.payload.isEmpty { + try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 2) + } + if !self.headerBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_EncryptV1Request.Request, rhs: Xmtp_KeystoreApi_V1_EncryptV1Request.Request) -> Bool { - if lhs._recipient != rhs._recipient {return false} - if lhs.payload != rhs.payload {return false} - if lhs.headerBytes != rhs.headerBytes {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs._recipient != rhs._recipient {return false} + if lhs.payload != rhs.payload {return false} + if lhs.headerBytes != rhs.headerBytes {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_EncryptResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".EncryptResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "responses"), + 1: .same(proto: "responses"), ] public 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.decodeRepeatedMessageField(value: &self.responses) }() - default: break - } - } + 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.decodeRepeatedMessageField(value: &self.responses) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.responses.isEmpty { - try visitor.visitRepeatedMessageField(value: self.responses, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.responses.isEmpty { + try visitor.visitRepeatedMessageField(value: self.responses, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_EncryptResponse, rhs: Xmtp_KeystoreApi_V1_EncryptResponse) -> Bool { - if lhs.responses != rhs.responses {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.responses != rhs.responses {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_EncryptResponse.Response: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_EncryptResponse.protoMessageName + ".Response" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "result"), - 2: .same(proto: "error"), + 1: .same(proto: "result"), + 2: .same(proto: "error"), ] public 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 { - var v: Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success? - var hadOneofValue = false - if let current = self.response { - hadOneofValue = true - if case .result(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.response = .result(v) - } - }() - case 2: try { - var v: Xmtp_KeystoreApi_V1_KeystoreError? - var hadOneofValue = false - if let current = self.response { - hadOneofValue = true - if case .error(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.response = .error(v) - } - }() - default: break - } - } + 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 { + var v: Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success? + var hadOneofValue = false + if let current = self.response { + hadOneofValue = true + if case .result(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.response = .result(v) + } + }() + case 2: try { + var v: Xmtp_KeystoreApi_V1_KeystoreError? + var hadOneofValue = false + if let current = self.response { + hadOneofValue = true + if case .error(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.response = .error(v) + } + }() + default: break + } + } } public 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 - switch self.response { - case .result?: try { - guard case .result(let v)? = self.response else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - }() - case .error?: try { - guard case .error(let v)? = self.response else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) + // 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 + switch self.response { + case .result?: try { + guard case .result(let v)? = self.response else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + }() + case .error?: try { + guard case .error(let v)? = self.response else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_EncryptResponse.Response, rhs: Xmtp_KeystoreApi_V1_EncryptResponse.Response) -> Bool { - if lhs.response != rhs.response {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.response != rhs.response {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_EncryptResponse.Response.protoMessageName + ".Success" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "encrypted"), + 1: .same(proto: "encrypted"), + 2: .standard(proto: "sender_hmac"), ] public 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._encrypted) }() - default: break - } - } + 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._encrypted) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.senderHmac) }() + default: break + } + } } public 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._encrypted { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try unknownFields.traverse(visitor: &visitor) + // 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._encrypted { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.senderHmac.isEmpty { + try visitor.visitSingularBytesField(value: self.senderHmac, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success, rhs: Xmtp_KeystoreApi_V1_EncryptResponse.Response.Success) -> Bool { - if lhs._encrypted != rhs._encrypted {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs._encrypted != rhs._encrypted {return false} + if lhs.senderHmac != rhs.senderHmac {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_EncryptV2Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".EncryptV2Request" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "requests"), + 1: .same(proto: "requests"), ] public 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.decodeRepeatedMessageField(value: &self.requests) }() - default: break - } - } + 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.decodeRepeatedMessageField(value: &self.requests) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.requests.isEmpty { - try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.requests.isEmpty { + try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_EncryptV2Request, rhs: Xmtp_KeystoreApi_V1_EncryptV2Request) -> Bool { - if lhs.requests != rhs.requests {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.requests != rhs.requests {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_EncryptV2Request.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_EncryptV2Request.protoMessageName + ".Request" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "payload"), - 2: .standard(proto: "header_bytes"), - 3: .standard(proto: "content_topic"), + 1: .same(proto: "payload"), + 2: .standard(proto: "header_bytes"), + 3: .standard(proto: "content_topic"), ] public 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.payload) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.headerBytes) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.contentTopic) }() - default: break - } - } + 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.payload) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.headerBytes) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.contentTopic) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.payload.isEmpty { - try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 1) - } - if !self.headerBytes.isEmpty { - try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 2) - } - if !self.contentTopic.isEmpty { - try visitor.visitSingularStringField(value: self.contentTopic, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) + if !self.payload.isEmpty { + try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 1) + } + if !self.headerBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 2) + } + if !self.contentTopic.isEmpty { + try visitor.visitSingularStringField(value: self.contentTopic, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_EncryptV2Request.Request, rhs: Xmtp_KeystoreApi_V1_EncryptV2Request.Request) -> Bool { - if lhs.payload != rhs.payload {return false} - if lhs.headerBytes != rhs.headerBytes {return false} - if lhs.contentTopic != rhs.contentTopic {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.payload != rhs.payload {return false} + if lhs.headerBytes != rhs.headerBytes {return false} + if lhs.contentTopic != rhs.contentTopic {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_SelfEncryptRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".SelfEncryptRequest" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "requests"), + ] + + public 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.decodeRepeatedMessageField(value: &self.requests) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.requests.isEmpty { + try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_SelfEncryptRequest, rhs: Xmtp_KeystoreApi_V1_SelfEncryptRequest) -> Bool { + if lhs.requests != rhs.requests {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_SelfEncryptRequest.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Xmtp_KeystoreApi_V1_SelfEncryptRequest.protoMessageName + ".Request" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "payload"), + ] + + public 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.payload) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.payload.isEmpty { + try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_SelfEncryptRequest.Request, rhs: Xmtp_KeystoreApi_V1_SelfEncryptRequest.Request) -> Bool { + if lhs.payload != rhs.payload {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_SelfEncryptResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".SelfEncryptResponse" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "responses"), + ] + + public 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.decodeRepeatedMessageField(value: &self.responses) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.responses.isEmpty { + try visitor.visitRepeatedMessageField(value: self.responses, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_SelfEncryptResponse, rhs: Xmtp_KeystoreApi_V1_SelfEncryptResponse) -> Bool { + if lhs.responses != rhs.responses {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Xmtp_KeystoreApi_V1_SelfEncryptResponse.protoMessageName + ".Response" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "result"), + 2: .same(proto: "error"), + ] + + public 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 { + var v: Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.Success? + var hadOneofValue = false + if let current = self.response { + hadOneofValue = true + if case .result(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.response = .result(v) + } + }() + case 2: try { + var v: Xmtp_KeystoreApi_V1_KeystoreError? + var hadOneofValue = false + if let current = self.response { + hadOneofValue = true + if case .error(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.response = .error(v) + } + }() + default: break + } + } + } + + public 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 + switch self.response { + case .result?: try { + guard case .result(let v)? = self.response else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + }() + case .error?: try { + guard case .error(let v)? = self.response else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response, rhs: Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response) -> Bool { + if lhs.response != rhs.response {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.Success: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.protoMessageName + ".Success" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "encrypted"), + ] + + public 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.encrypted) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.encrypted.isEmpty { + try visitor.visitSingularBytesField(value: self.encrypted, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.Success, rhs: Xmtp_KeystoreApi_V1_SelfEncryptResponse.Response.Success) -> Bool { + if lhs.encrypted != rhs.encrypted {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_SelfDecryptRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".SelfDecryptRequest" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "requests"), + ] + + public 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.decodeRepeatedMessageField(value: &self.requests) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.requests.isEmpty { + try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_SelfDecryptRequest, rhs: Xmtp_KeystoreApi_V1_SelfDecryptRequest) -> Bool { + if lhs.requests != rhs.requests {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_SelfDecryptRequest.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Xmtp_KeystoreApi_V1_SelfDecryptRequest.protoMessageName + ".Request" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "payload"), + ] + + public 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.payload) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.payload.isEmpty { + try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_SelfDecryptRequest.Request, rhs: Xmtp_KeystoreApi_V1_SelfDecryptRequest.Request) -> Bool { + if lhs.payload != rhs.payload {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_GetPrivatePreferencesTopicIdentifierResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".GetPrivatePreferencesTopicIdentifierResponse" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "identifier"), + ] + + public 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.decodeSingularStringField(value: &self.identifier) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.identifier.isEmpty { + try visitor.visitSingularStringField(value: self.identifier, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_GetPrivatePreferencesTopicIdentifierResponse, rhs: Xmtp_KeystoreApi_V1_GetPrivatePreferencesTopicIdentifierResponse) -> Bool { + if lhs.identifier != rhs.identifier {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_CreateInviteRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".CreateInviteRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "context"), - 2: .same(proto: "recipient"), - 3: .standard(proto: "created_ns"), + 1: .same(proto: "context"), + 2: .same(proto: "recipient"), + 3: .standard(proto: "created_ns"), ] public 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._context) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._recipient) }() - case 3: try { try decoder.decodeSingularUInt64Field(value: &self.createdNs) }() - default: break - } - } + 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._context) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._recipient) }() + case 3: try { try decoder.decodeSingularUInt64Field(value: &self.createdNs) }() + default: break + } + } } public 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._context { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if let v = self._recipient { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - if self.createdNs != 0 { - try visitor.visitSingularUInt64Field(value: self.createdNs, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) + // 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._context { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._recipient { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if self.createdNs != 0 { + try visitor.visitSingularUInt64Field(value: self.createdNs, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_CreateInviteRequest, rhs: Xmtp_KeystoreApi_V1_CreateInviteRequest) -> Bool { - if lhs._context != rhs._context {return false} - if lhs._recipient != rhs._recipient {return false} - if lhs.createdNs != rhs.createdNs {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs._context != rhs._context {return false} + if lhs._recipient != rhs._recipient {return false} + if lhs.createdNs != rhs.createdNs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_CreateInviteResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".CreateInviteResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "conversation"), - 2: .same(proto: "payload"), + 1: .same(proto: "conversation"), + 2: .same(proto: "payload"), ] public 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._conversation) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.payload) }() - default: break - } - } + 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._conversation) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.payload) }() + default: break + } + } } public 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._conversation { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.payload.isEmpty { - try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) + // 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._conversation { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.payload.isEmpty { + try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_CreateInviteResponse, rhs: Xmtp_KeystoreApi_V1_CreateInviteResponse) -> Bool { - if lhs._conversation != rhs._conversation {return false} - if lhs.payload != rhs.payload {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs._conversation != rhs._conversation {return false} + if lhs.payload != rhs.payload {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_SaveInvitesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".SaveInvitesRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "requests"), + 1: .same(proto: "requests"), ] public 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.decodeRepeatedMessageField(value: &self.requests) }() - default: break - } - } + 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.decodeRepeatedMessageField(value: &self.requests) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.requests.isEmpty { - try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.requests.isEmpty { + try visitor.visitRepeatedMessageField(value: self.requests, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_SaveInvitesRequest, rhs: Xmtp_KeystoreApi_V1_SaveInvitesRequest) -> Bool { - if lhs.requests != rhs.requests {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.requests != rhs.requests {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_SaveInvitesRequest.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_SaveInvitesRequest.protoMessageName + ".Request" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "content_topic"), - 2: .standard(proto: "timestamp_ns"), - 3: .same(proto: "payload"), + 1: .standard(proto: "content_topic"), + 2: .standard(proto: "timestamp_ns"), + 3: .same(proto: "payload"), ] public 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.decodeSingularStringField(value: &self.contentTopic) }() - case 2: try { try decoder.decodeSingularUInt64Field(value: &self.timestampNs) }() - case 3: try { try decoder.decodeSingularBytesField(value: &self.payload) }() - default: break - } - } + 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.decodeSingularStringField(value: &self.contentTopic) }() + case 2: try { try decoder.decodeSingularUInt64Field(value: &self.timestampNs) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self.payload) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.contentTopic.isEmpty { - try visitor.visitSingularStringField(value: self.contentTopic, fieldNumber: 1) - } - if self.timestampNs != 0 { - try visitor.visitSingularUInt64Field(value: self.timestampNs, fieldNumber: 2) - } - if !self.payload.isEmpty { - try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) + if !self.contentTopic.isEmpty { + try visitor.visitSingularStringField(value: self.contentTopic, fieldNumber: 1) + } + if self.timestampNs != 0 { + try visitor.visitSingularUInt64Field(value: self.timestampNs, fieldNumber: 2) + } + if !self.payload.isEmpty { + try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_SaveInvitesRequest.Request, rhs: Xmtp_KeystoreApi_V1_SaveInvitesRequest.Request) -> Bool { - if lhs.contentTopic != rhs.contentTopic {return false} - if lhs.timestampNs != rhs.timestampNs {return false} - if lhs.payload != rhs.payload {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.contentTopic != rhs.contentTopic {return false} + if lhs.timestampNs != rhs.timestampNs {return false} + if lhs.payload != rhs.payload {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_SaveInvitesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".SaveInvitesResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "responses"), + 1: .same(proto: "responses"), ] public 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.decodeRepeatedMessageField(value: &self.responses) }() - default: break - } - } + 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.decodeRepeatedMessageField(value: &self.responses) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.responses.isEmpty { - try visitor.visitRepeatedMessageField(value: self.responses, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.responses.isEmpty { + try visitor.visitRepeatedMessageField(value: self.responses, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_SaveInvitesResponse, rhs: Xmtp_KeystoreApi_V1_SaveInvitesResponse) -> Bool { - if lhs.responses != rhs.responses {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.responses != rhs.responses {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_SaveInvitesResponse.protoMessageName + ".Response" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "result"), - 2: .same(proto: "error"), + 1: .same(proto: "result"), + 2: .same(proto: "error"), ] public 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 { - var v: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success? - var hadOneofValue = false - if let current = self.response { - hadOneofValue = true - if case .result(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.response = .result(v) - } - }() - case 2: try { - var v: Xmtp_KeystoreApi_V1_KeystoreError? - var hadOneofValue = false - if let current = self.response { - hadOneofValue = true - if case .error(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.response = .error(v) - } - }() - default: break - } - } + 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 { + var v: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success? + var hadOneofValue = false + if let current = self.response { + hadOneofValue = true + if case .result(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.response = .result(v) + } + }() + case 2: try { + var v: Xmtp_KeystoreApi_V1_KeystoreError? + var hadOneofValue = false + if let current = self.response { + hadOneofValue = true + if case .error(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.response = .error(v) + } + }() + default: break + } + } } public 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 - switch self.response { - case .result?: try { - guard case .result(let v)? = self.response else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - }() - case .error?: try { - guard case .error(let v)? = self.response else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) + // 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 + switch self.response { + case .result?: try { + guard case .result(let v)? = self.response else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + }() + case .error?: try { + guard case .error(let v)? = self.response else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response, rhs: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response) -> Bool { - if lhs.response != rhs.response {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.response != rhs.response {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.protoMessageName + ".Success" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "conversation"), + 1: .same(proto: "conversation"), ] public 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._conversation) }() - default: break - } - } + 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._conversation) }() + default: break + } + } } public 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._conversation { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try unknownFields.traverse(visitor: &visitor) + // 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._conversation { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success, rhs: Xmtp_KeystoreApi_V1_SaveInvitesResponse.Response.Success) -> Bool { - if lhs._conversation != rhs._conversation {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs._conversation != rhs._conversation {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_CreateAuthTokenRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".CreateAuthTokenRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "timestamp_ns"), + 1: .standard(proto: "timestamp_ns"), ] public 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.decodeSingularUInt64Field(value: &self._timestampNs) }() - default: break - } - } + 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.decodeSingularUInt64Field(value: &self._timestampNs) }() + default: break + } + } } public 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._timestampNs { - try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) - } }() - try unknownFields.traverse(visitor: &visitor) + // 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._timestampNs { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_CreateAuthTokenRequest, rhs: Xmtp_KeystoreApi_V1_CreateAuthTokenRequest) -> Bool { - if lhs._timestampNs != rhs._timestampNs {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs._timestampNs != rhs._timestampNs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_SaveV1ConversationsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".SaveV1ConversationsRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "conversations"), + 1: .same(proto: "conversations"), ] public 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.decodeRepeatedMessageField(value: &self.conversations) }() - default: break - } - } + 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.decodeRepeatedMessageField(value: &self.conversations) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.conversations.isEmpty { - try visitor.visitRepeatedMessageField(value: self.conversations, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.conversations.isEmpty { + try visitor.visitRepeatedMessageField(value: self.conversations, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_SaveV1ConversationsRequest, rhs: Xmtp_KeystoreApi_V1_SaveV1ConversationsRequest) -> Bool { - if lhs.conversations != rhs.conversations {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.conversations != rhs.conversations {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } @@ -2045,373 +2563,373 @@ extension Xmtp_KeystoreApi_V1_SaveV1ConversationsResponse: SwiftProtobuf.Message public static let _protobuf_nameMap = SwiftProtobuf._NameMap() public mutating func decodeMessage(decoder: inout D) throws { - while let _ = try decoder.nextFieldNumber() { - } + while let _ = try decoder.nextFieldNumber() { + } } public func traverse(visitor: inout V) throws { - try unknownFields.traverse(visitor: &visitor) + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_SaveV1ConversationsResponse, rhs: Xmtp_KeystoreApi_V1_SaveV1ConversationsResponse) -> Bool { - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_GetConversationsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GetConversationsResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "conversations"), + 1: .same(proto: "conversations"), ] public 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.decodeRepeatedMessageField(value: &self.conversations) }() - default: break - } - } + 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.decodeRepeatedMessageField(value: &self.conversations) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.conversations.isEmpty { - try visitor.visitRepeatedMessageField(value: self.conversations, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.conversations.isEmpty { + try visitor.visitRepeatedMessageField(value: self.conversations, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_GetConversationsResponse, rhs: Xmtp_KeystoreApi_V1_GetConversationsResponse) -> Bool { - if lhs.conversations != rhs.conversations {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.conversations != rhs.conversations {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_GetKeystoreStatusRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GetKeystoreStatusRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "wallet_address"), + 1: .standard(proto: "wallet_address"), ] public 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.decodeSingularStringField(value: &self.walletAddress) }() - default: break - } - } + 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.decodeSingularStringField(value: &self.walletAddress) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.walletAddress.isEmpty { - try visitor.visitSingularStringField(value: self.walletAddress, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.walletAddress.isEmpty { + try visitor.visitSingularStringField(value: self.walletAddress, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_GetKeystoreStatusRequest, rhs: Xmtp_KeystoreApi_V1_GetKeystoreStatusRequest) -> Bool { - if lhs.walletAddress != rhs.walletAddress {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.walletAddress != rhs.walletAddress {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_GetKeystoreStatusResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GetKeystoreStatusResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "status"), + 1: .same(proto: "status"), ] public 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.status) }() - default: break - } - } + 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.status) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if self.status != .unspecified { - try visitor.visitSingularEnumField(value: self.status, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if self.status != .unspecified { + try visitor.visitSingularEnumField(value: self.status, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_GetKeystoreStatusResponse, rhs: Xmtp_KeystoreApi_V1_GetKeystoreStatusResponse) -> Bool { - if lhs.status != rhs.status {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.status != rhs.status {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_GetKeystoreStatusResponse.KeystoreStatus: SwiftProtobuf._ProtoNameProviding { public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "KEYSTORE_STATUS_UNSPECIFIED"), - 1: .same(proto: "KEYSTORE_STATUS_UNINITIALIZED"), - 2: .same(proto: "KEYSTORE_STATUS_INITIALIZED"), + 0: .same(proto: "KEYSTORE_STATUS_UNSPECIFIED"), + 1: .same(proto: "KEYSTORE_STATUS_UNINITIALIZED"), + 2: .same(proto: "KEYSTORE_STATUS_INITIALIZED"), ] } extension Xmtp_KeystoreApi_V1_InitKeystoreRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".InitKeystoreRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "v1"), + 1: .same(proto: "v1"), ] public 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 { - var v: Xmtp_MessageContents_PrivateKeyBundleV1? - var hadOneofValue = false - if let current = self.bundle { - hadOneofValue = true - if case .v1(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.bundle = .v1(v) - } - }() - default: break - } - } + 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 { + var v: Xmtp_MessageContents_PrivateKeyBundleV1? + var hadOneofValue = false + if let current = self.bundle { + hadOneofValue = true + if case .v1(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.bundle = .v1(v) + } + }() + default: break + } + } } public 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 case .v1(let v)? = self.bundle { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try unknownFields.traverse(visitor: &visitor) + // 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 case .v1(let v)? = self.bundle { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_InitKeystoreRequest, rhs: Xmtp_KeystoreApi_V1_InitKeystoreRequest) -> Bool { - if lhs.bundle != rhs.bundle {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.bundle != rhs.bundle {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_InitKeystoreResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".InitKeystoreResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "error"), + 1: .same(proto: "error"), ] public 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._error) }() - default: break - } - } + 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._error) }() + default: break + } + } } public 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._error { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try unknownFields.traverse(visitor: &visitor) + // 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._error { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_InitKeystoreResponse, rhs: Xmtp_KeystoreApi_V1_InitKeystoreResponse) -> Bool { - if lhs._error != rhs._error {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs._error != rhs._error {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_SignDigestRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".SignDigestRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "digest"), - 2: .standard(proto: "identity_key"), - 3: .standard(proto: "prekey_index"), + 1: .same(proto: "digest"), + 2: .standard(proto: "identity_key"), + 3: .standard(proto: "prekey_index"), ] public 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.digest) }() - case 2: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if self.signer != nil {try decoder.handleConflictingOneOf()} - self.signer = .identityKey(v) - } - }() - case 3: try { - var v: UInt32? - try decoder.decodeSingularUInt32Field(value: &v) - if let v = v { - if self.signer != nil {try decoder.handleConflictingOneOf()} - self.signer = .prekeyIndex(v) - } - }() - default: break - } - } + 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.digest) }() + case 2: try { + var v: Bool? + try decoder.decodeSingularBoolField(value: &v) + if let v = v { + if self.signer != nil {try decoder.handleConflictingOneOf()} + self.signer = .identityKey(v) + } + }() + case 3: try { + var v: UInt32? + try decoder.decodeSingularUInt32Field(value: &v) + if let v = v { + if self.signer != nil {try decoder.handleConflictingOneOf()} + self.signer = .prekeyIndex(v) + } + }() + default: break + } + } } public 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 - if !self.digest.isEmpty { - try visitor.visitSingularBytesField(value: self.digest, fieldNumber: 1) - } - switch self.signer { - case .identityKey?: try { - guard case .identityKey(let v)? = self.signer else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 2) - }() - case .prekeyIndex?: try { - guard case .prekeyIndex(let v)? = self.signer else { preconditionFailure() } - try visitor.visitSingularUInt32Field(value: v, fieldNumber: 3) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) + // 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 + if !self.digest.isEmpty { + try visitor.visitSingularBytesField(value: self.digest, fieldNumber: 1) + } + switch self.signer { + case .identityKey?: try { + guard case .identityKey(let v)? = self.signer else { preconditionFailure() } + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + }() + case .prekeyIndex?: try { + guard case .prekeyIndex(let v)? = self.signer else { preconditionFailure() } + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 3) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_SignDigestRequest, rhs: Xmtp_KeystoreApi_V1_SignDigestRequest) -> Bool { - if lhs.digest != rhs.digest {return false} - if lhs.signer != rhs.signer {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.digest != rhs.digest {return false} + if lhs.signer != rhs.signer {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_GetRefreshJobRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GetRefreshJobRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "job_type"), + 1: .standard(proto: "job_type"), ] public 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.jobType) }() - default: break - } - } + 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.jobType) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if self.jobType != .unspecified { - try visitor.visitSingularEnumField(value: self.jobType, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if self.jobType != .unspecified { + try visitor.visitSingularEnumField(value: self.jobType, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_GetRefreshJobRequest, rhs: Xmtp_KeystoreApi_V1_GetRefreshJobRequest) -> Bool { - if lhs.jobType != rhs.jobType {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.jobType != rhs.jobType {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_GetRefreshJobResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GetRefreshJobResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "last_run_ns"), + 1: .standard(proto: "last_run_ns"), ] public 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.decodeSingularInt64Field(value: &self.lastRunNs) }() - default: break - } - } + 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.decodeSingularInt64Field(value: &self.lastRunNs) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if self.lastRunNs != 0 { - try visitor.visitSingularInt64Field(value: self.lastRunNs, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if self.lastRunNs != 0 { + try visitor.visitSingularInt64Field(value: self.lastRunNs, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_GetRefreshJobResponse, rhs: Xmtp_KeystoreApi_V1_GetRefreshJobResponse) -> Bool { - if lhs.lastRunNs != rhs.lastRunNs {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.lastRunNs != rhs.lastRunNs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_SetRefeshJobRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".SetRefeshJobRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "job_type"), - 2: .standard(proto: "last_run_ns"), + 1: .standard(proto: "job_type"), + 2: .standard(proto: "last_run_ns"), ] public 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.jobType) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.lastRunNs) }() - default: break - } - } + 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.jobType) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self.lastRunNs) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if self.jobType != .unspecified { - try visitor.visitSingularEnumField(value: self.jobType, fieldNumber: 1) - } - if self.lastRunNs != 0 { - try visitor.visitSingularInt64Field(value: self.lastRunNs, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) + if self.jobType != .unspecified { + try visitor.visitSingularEnumField(value: self.jobType, fieldNumber: 1) + } + if self.lastRunNs != 0 { + try visitor.visitSingularInt64Field(value: self.lastRunNs, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_SetRefeshJobRequest, rhs: Xmtp_KeystoreApi_V1_SetRefeshJobRequest) -> Bool { - if lhs.jobType != rhs.jobType {return false} - if lhs.lastRunNs != rhs.lastRunNs {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.jobType != rhs.jobType {return false} + if lhs.lastRunNs != rhs.lastRunNs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } @@ -2420,96 +2938,230 @@ extension Xmtp_KeystoreApi_V1_SetRefreshJobResponse: SwiftProtobuf.Message, Swif public static let _protobuf_nameMap = SwiftProtobuf._NameMap() public mutating func decodeMessage(decoder: inout D) throws { - while let _ = try decoder.nextFieldNumber() { - } + while let _ = try decoder.nextFieldNumber() { + } } public func traverse(visitor: inout V) throws { - try unknownFields.traverse(visitor: &visitor) + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_SetRefreshJobResponse, rhs: Xmtp_KeystoreApi_V1_SetRefreshJobResponse) -> Bool { - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_TopicMap: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".TopicMap" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "topics"), + 1: .same(proto: "topics"), ] public 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.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.topics) }() - default: break - } - } + 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.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.topics) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.topics.isEmpty { - try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.topics, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.topics.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.topics, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_TopicMap, rhs: Xmtp_KeystoreApi_V1_TopicMap) -> Bool { - if lhs.topics != rhs.topics {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.topics != rhs.topics {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_KeystoreApi_V1_TopicMap.TopicData: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_KeystoreApi_V1_TopicMap.protoMessageName + ".TopicData" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "created_ns"), - 2: .standard(proto: "peer_address"), - 3: .same(proto: "invitation"), + 1: .standard(proto: "created_ns"), + 2: .standard(proto: "peer_address"), + 3: .same(proto: "invitation"), ] public 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.decodeSingularUInt64Field(value: &self.createdNs) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.peerAddress) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._invitation) }() - default: break - } - } + 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.decodeSingularUInt64Field(value: &self.createdNs) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.peerAddress) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._invitation) }() + default: break + } + } } public 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 - if self.createdNs != 0 { - try visitor.visitSingularUInt64Field(value: self.createdNs, fieldNumber: 1) - } - if !self.peerAddress.isEmpty { - try visitor.visitSingularStringField(value: self.peerAddress, fieldNumber: 2) - } - try { if let v = self._invitation { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - try unknownFields.traverse(visitor: &visitor) + // 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 + if self.createdNs != 0 { + try visitor.visitSingularUInt64Field(value: self.createdNs, fieldNumber: 1) + } + if !self.peerAddress.isEmpty { + try visitor.visitSingularStringField(value: self.peerAddress, fieldNumber: 2) + } + try { if let v = self._invitation { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_KeystoreApi_V1_TopicMap.TopicData, rhs: Xmtp_KeystoreApi_V1_TopicMap.TopicData) -> Bool { - if lhs.createdNs != rhs.createdNs {return false} - if lhs.peerAddress != rhs.peerAddress {return false} - if lhs._invitation != rhs._invitation {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.createdNs != rhs.createdNs {return false} + if lhs.peerAddress != rhs.peerAddress {return false} + if lhs._invitation != rhs._invitation {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_GetConversationHmacKeysRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".GetConversationHmacKeysRequest" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "topics"), + ] + + public 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.decodeRepeatedStringField(value: &self.topics) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.topics.isEmpty { + try visitor.visitRepeatedStringField(value: self.topics, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_GetConversationHmacKeysRequest, rhs: Xmtp_KeystoreApi_V1_GetConversationHmacKeysRequest) -> Bool { + if lhs.topics != rhs.topics {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".GetConversationHmacKeysResponse" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "hmac_keys"), + ] + + public 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.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.hmacKeys) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.hmacKeys.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.hmacKeys, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse, rhs: Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse) -> Bool { + if lhs.hmacKeys != rhs.hmacKeys {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.HmacKeyData: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.protoMessageName + ".HmacKeyData" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "thirty_day_periods_since_epoch"), + 2: .standard(proto: "hmac_key"), + ] + + public 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.thirtyDayPeriodsSinceEpoch) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.hmacKey) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.thirtyDayPeriodsSinceEpoch != 0 { + try visitor.visitSingularInt32Field(value: self.thirtyDayPeriodsSinceEpoch, fieldNumber: 1) + } + if !self.hmacKey.isEmpty { + try visitor.visitSingularBytesField(value: self.hmacKey, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.HmacKeyData, rhs: Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.HmacKeyData) -> Bool { + if lhs.thirtyDayPeriodsSinceEpoch != rhs.thirtyDayPeriodsSinceEpoch {return false} + if lhs.hmacKey != rhs.hmacKey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.HmacKeys: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.protoMessageName + ".HmacKeys" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "values"), + ] + + public 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.decodeRepeatedMessageField(value: &self.values) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.values.isEmpty { + try visitor.visitRepeatedMessageField(value: self.values, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.HmacKeys, rhs: Xmtp_KeystoreApi_V1_GetConversationHmacKeysResponse.HmacKeys) -> Bool { + if lhs.values != rhs.values {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } diff --git a/Sources/XMTPiOS/Proto/message_contents/message.pb.swift b/Sources/XMTPiOS/Proto/message_contents/message.pb.swift index 9e13e272..8cbf8114 100644 --- a/Sources/XMTPiOS/Proto/message_contents/message.pb.swift +++ b/Sources/XMTPiOS/Proto/message_contents/message.pb.swift @@ -30,8 +30,8 @@ public struct Xmtp_MessageContents_MessageHeaderV1 { // methods supported on all messages. public var sender: Xmtp_MessageContents_PublicKeyBundle { - get {return _storage._sender ?? Xmtp_MessageContents_PublicKeyBundle()} - set {_uniqueStorage()._sender = newValue} + get {return _storage._sender ?? Xmtp_MessageContents_PublicKeyBundle()} + set {_uniqueStorage()._sender = newValue} } /// Returns true if `sender` has been explicitly set. public var hasSender: Bool {return _storage._sender != nil} @@ -39,8 +39,8 @@ public struct Xmtp_MessageContents_MessageHeaderV1 { public mutating func clearSender() {_uniqueStorage()._sender = nil} public var recipient: Xmtp_MessageContents_PublicKeyBundle { - get {return _storage._recipient ?? Xmtp_MessageContents_PublicKeyBundle()} - set {_uniqueStorage()._recipient = newValue} + get {return _storage._recipient ?? Xmtp_MessageContents_PublicKeyBundle()} + set {_uniqueStorage()._recipient = newValue} } /// Returns true if `recipient` has been explicitly set. public var hasRecipient: Bool {return _storage._recipient != nil} @@ -48,8 +48,8 @@ public struct Xmtp_MessageContents_MessageHeaderV1 { public mutating func clearRecipient() {_uniqueStorage()._recipient = nil} public var timestamp: UInt64 { - get {return _storage._timestamp} - set {_uniqueStorage()._timestamp = newValue} + get {return _storage._timestamp} + set {_uniqueStorage()._timestamp = newValue} } public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -70,8 +70,8 @@ public struct Xmtp_MessageContents_MessageV1 { /// Ciphertext.payload MUST contain encrypted EncodedContent public var ciphertext: Xmtp_MessageContents_Ciphertext { - get {return _ciphertext ?? Xmtp_MessageContents_Ciphertext()} - set {_ciphertext = newValue} + get {return _ciphertext ?? Xmtp_MessageContents_Ciphertext()} + set {_ciphertext = newValue} } /// Returns true if `ciphertext` has been explicitly set. public var hasCiphertext: Bool {return self._ciphertext != nil} @@ -116,14 +116,20 @@ public struct Xmtp_MessageContents_MessageV2 { /// Ciphertext.payload MUST contain encrypted SignedContent public var ciphertext: Xmtp_MessageContents_Ciphertext { - get {return _ciphertext ?? Xmtp_MessageContents_Ciphertext()} - set {_ciphertext = newValue} + get {return _ciphertext ?? Xmtp_MessageContents_Ciphertext()} + set {_ciphertext = newValue} } /// Returns true if `ciphertext` has been explicitly set. public var hasCiphertext: Bool {return self._ciphertext != nil} /// Clears the value of `ciphertext`. Subsequent reads from it will return its default value. public mutating func clearCiphertext() {self._ciphertext = nil} + /// HMAC of the message ciphertext, with the HMAC key derived from the topic key + public var senderHmac: Data = Data() + + /// Flag indicating whether the message should be pushed from a notification server + public var shouldPush: Bool = false + public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} @@ -140,44 +146,44 @@ public struct Xmtp_MessageContents_Message { public var version: Xmtp_MessageContents_Message.OneOf_Version? = nil public var v1: Xmtp_MessageContents_MessageV1 { - get { - if case .v1(let v)? = version {return v} - return Xmtp_MessageContents_MessageV1() - } - set {version = .v1(newValue)} + get { + if case .v1(let v)? = version {return v} + return Xmtp_MessageContents_MessageV1() + } + set {version = .v1(newValue)} } public var v2: Xmtp_MessageContents_MessageV2 { - get { - if case .v2(let v)? = version {return v} - return Xmtp_MessageContents_MessageV2() - } - set {version = .v2(newValue)} + get { + if case .v2(let v)? = version {return v} + return Xmtp_MessageContents_MessageV2() + } + set {version = .v2(newValue)} } public var unknownFields = SwiftProtobuf.UnknownStorage() public enum OneOf_Version: Equatable { - case v1(Xmtp_MessageContents_MessageV1) - case v2(Xmtp_MessageContents_MessageV2) + case v1(Xmtp_MessageContents_MessageV1) + case v2(Xmtp_MessageContents_MessageV2) #if !swift(>=4.1) - public static func ==(lhs: Xmtp_MessageContents_Message.OneOf_Version, rhs: Xmtp_MessageContents_Message.OneOf_Version) -> Bool { - // 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 (lhs, rhs) { - case (.v1, .v1): return { - guard case .v1(let l) = lhs, case .v1(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.v2, .v2): return { - guard case .v2(let l) = lhs, case .v2(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } + public static func ==(lhs: Xmtp_MessageContents_Message.OneOf_Version, rhs: Xmtp_MessageContents_Message.OneOf_Version) -> Bool { + // 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 (lhs, rhs) { + case (.v1, .v1): return { + guard case .v1(let l) = lhs, case .v1(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.v2, .v2): return { + guard case .v2(let l) = lhs, case .v2(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } #endif } @@ -199,8 +205,8 @@ public struct Xmtp_MessageContents_DecodedMessage { public var senderAddress: String = String() public var recipientAddress: String { - get {return _recipientAddress ?? String()} - set {_recipientAddress = newValue} + get {return _recipientAddress ?? String()} + set {_recipientAddress = newValue} } /// Returns true if `recipientAddress` has been explicitly set. public var hasRecipientAddress: Bool {return self._recipientAddress != nil} @@ -212,8 +218,8 @@ public struct Xmtp_MessageContents_DecodedMessage { public var contentTopic: String = String() public var conversation: Xmtp_MessageContents_ConversationReference { - get {return _conversation ?? Xmtp_MessageContents_ConversationReference()} - set {_conversation = newValue} + get {return _conversation ?? Xmtp_MessageContents_ConversationReference()} + set {_conversation = newValue} } /// Returns true if `conversation` has been explicitly set. public var hasConversation: Bool {return self._conversation != nil} @@ -248,353 +254,365 @@ fileprivate let _protobuf_package = "xmtp.message_contents" extension Xmtp_MessageContents_MessageHeaderV1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".MessageHeaderV1" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "sender"), - 2: .same(proto: "recipient"), - 3: .same(proto: "timestamp"), + 1: .same(proto: "sender"), + 2: .same(proto: "recipient"), + 3: .same(proto: "timestamp"), ] fileprivate class _StorageClass { - var _sender: Xmtp_MessageContents_PublicKeyBundle? = nil - var _recipient: Xmtp_MessageContents_PublicKeyBundle? = nil - var _timestamp: UInt64 = 0 + var _sender: Xmtp_MessageContents_PublicKeyBundle? = nil + var _recipient: Xmtp_MessageContents_PublicKeyBundle? = nil + var _timestamp: UInt64 = 0 - static let defaultInstance = _StorageClass() + static let defaultInstance = _StorageClass() - private init() {} + private init() {} - init(copying source: _StorageClass) { - _sender = source._sender - _recipient = source._recipient - _timestamp = source._timestamp - } + init(copying source: _StorageClass) { + _sender = source._sender + _recipient = source._recipient + _timestamp = source._timestamp + } } fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage } public mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - 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: &_storage._sender) }() - case 2: try { try decoder.decodeSingularMessageField(value: &_storage._recipient) }() - case 3: try { try decoder.decodeSingularUInt64Field(value: &_storage._timestamp) }() - default: break - } - } - } + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + 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: &_storage._sender) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._recipient) }() + case 3: try { try decoder.decodeSingularUInt64Field(value: &_storage._timestamp) }() + default: break + } + } + } } public func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - // 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 = _storage._sender { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if let v = _storage._recipient { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - if _storage._timestamp != 0 { - try visitor.visitSingularUInt64Field(value: _storage._timestamp, fieldNumber: 3) - } - } - try unknownFields.traverse(visitor: &visitor) + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // 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 = _storage._sender { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = _storage._recipient { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if _storage._timestamp != 0 { + try visitor.visitSingularUInt64Field(value: _storage._timestamp, fieldNumber: 3) + } + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_MessageContents_MessageHeaderV1, rhs: Xmtp_MessageContents_MessageHeaderV1) -> Bool { - if lhs._storage !== rhs._storage { - let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in - let _storage = _args.0 - let rhs_storage = _args.1 - if _storage._sender != rhs_storage._sender {return false} - if _storage._recipient != rhs_storage._recipient {return false} - if _storage._timestamp != rhs_storage._timestamp {return false} - return true - } - if !storagesAreEqual {return false} - } - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._sender != rhs_storage._sender {return false} + if _storage._recipient != rhs_storage._recipient {return false} + if _storage._timestamp != rhs_storage._timestamp {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_MessageContents_MessageV1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".MessageV1" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "header_bytes"), - 2: .same(proto: "ciphertext"), + 1: .standard(proto: "header_bytes"), + 2: .same(proto: "ciphertext"), ] public 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.headerBytes) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._ciphertext) }() - default: break - } - } + 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.headerBytes) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._ciphertext) }() + default: break + } + } } public 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 - if !self.headerBytes.isEmpty { - try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 1) - } - try { if let v = self._ciphertext { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) + // 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 + if !self.headerBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 1) + } + try { if let v = self._ciphertext { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_MessageContents_MessageV1, rhs: Xmtp_MessageContents_MessageV1) -> Bool { - if lhs.headerBytes != rhs.headerBytes {return false} - if lhs._ciphertext != rhs._ciphertext {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.headerBytes != rhs.headerBytes {return false} + if lhs._ciphertext != rhs._ciphertext {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_MessageContents_MessageHeaderV2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".MessageHeaderV2" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "created_ns"), - 2: .same(proto: "topic"), + 1: .standard(proto: "created_ns"), + 2: .same(proto: "topic"), ] public 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.decodeSingularUInt64Field(value: &self.createdNs) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.topic) }() - default: break - } - } + 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.decodeSingularUInt64Field(value: &self.createdNs) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.topic) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if self.createdNs != 0 { - try visitor.visitSingularUInt64Field(value: self.createdNs, fieldNumber: 1) - } - if !self.topic.isEmpty { - try visitor.visitSingularStringField(value: self.topic, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) + if self.createdNs != 0 { + try visitor.visitSingularUInt64Field(value: self.createdNs, fieldNumber: 1) + } + if !self.topic.isEmpty { + try visitor.visitSingularStringField(value: self.topic, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_MessageContents_MessageHeaderV2, rhs: Xmtp_MessageContents_MessageHeaderV2) -> Bool { - if lhs.createdNs != rhs.createdNs {return false} - if lhs.topic != rhs.topic {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.createdNs != rhs.createdNs {return false} + if lhs.topic != rhs.topic {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_MessageContents_MessageV2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".MessageV2" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "header_bytes"), - 2: .same(proto: "ciphertext"), + 1: .standard(proto: "header_bytes"), + 2: .same(proto: "ciphertext"), + 3: .standard(proto: "sender_hmac"), + 4: .standard(proto: "should_push"), ] public 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.headerBytes) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._ciphertext) }() - default: break - } - } + 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.headerBytes) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._ciphertext) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self.senderHmac) }() + case 4: try { try decoder.decodeSingularBoolField(value: &self.shouldPush) }() + default: break + } + } } public 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 - if !self.headerBytes.isEmpty { - try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 1) - } - try { if let v = self._ciphertext { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) + // 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 + if !self.headerBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 1) + } + try { if let v = self._ciphertext { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if !self.senderHmac.isEmpty { + try visitor.visitSingularBytesField(value: self.senderHmac, fieldNumber: 3) + } + if self.shouldPush != false { + try visitor.visitSingularBoolField(value: self.shouldPush, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_MessageContents_MessageV2, rhs: Xmtp_MessageContents_MessageV2) -> Bool { - if lhs.headerBytes != rhs.headerBytes {return false} - if lhs._ciphertext != rhs._ciphertext {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.headerBytes != rhs.headerBytes {return false} + if lhs._ciphertext != rhs._ciphertext {return false} + if lhs.senderHmac != rhs.senderHmac {return false} + if lhs.shouldPush != rhs.shouldPush {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_MessageContents_Message: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".Message" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "v1"), - 2: .same(proto: "v2"), + 1: .same(proto: "v1"), + 2: .same(proto: "v2"), ] public 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 { - var v: Xmtp_MessageContents_MessageV1? - var hadOneofValue = false - if let current = self.version { - hadOneofValue = true - if case .v1(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.version = .v1(v) - } - }() - case 2: try { - var v: Xmtp_MessageContents_MessageV2? - var hadOneofValue = false - if let current = self.version { - hadOneofValue = true - if case .v2(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.version = .v2(v) - } - }() - default: break - } - } + 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 { + var v: Xmtp_MessageContents_MessageV1? + var hadOneofValue = false + if let current = self.version { + hadOneofValue = true + if case .v1(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.version = .v1(v) + } + }() + case 2: try { + var v: Xmtp_MessageContents_MessageV2? + var hadOneofValue = false + if let current = self.version { + hadOneofValue = true + if case .v2(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.version = .v2(v) + } + }() + default: break + } + } } public 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 - switch self.version { - case .v1?: try { - guard case .v1(let v)? = self.version else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - }() - case .v2?: try { - guard case .v2(let v)? = self.version else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) + // 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 + switch self.version { + case .v1?: try { + guard case .v1(let v)? = self.version else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + }() + case .v2?: try { + guard case .v2(let v)? = self.version else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_MessageContents_Message, rhs: Xmtp_MessageContents_Message) -> Bool { - if lhs.version != rhs.version {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.version != rhs.version {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_MessageContents_DecodedMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".DecodedMessage" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "id"), - 2: .standard(proto: "message_version"), - 3: .standard(proto: "sender_address"), - 4: .standard(proto: "recipient_address"), - 5: .standard(proto: "sent_ns"), - 6: .standard(proto: "content_topic"), - 7: .same(proto: "conversation"), - 8: .standard(proto: "content_bytes"), + 1: .same(proto: "id"), + 2: .standard(proto: "message_version"), + 3: .standard(proto: "sender_address"), + 4: .standard(proto: "recipient_address"), + 5: .standard(proto: "sent_ns"), + 6: .standard(proto: "content_topic"), + 7: .same(proto: "conversation"), + 8: .standard(proto: "content_bytes"), ] public 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.decodeSingularStringField(value: &self.id) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.messageVersion) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.senderAddress) }() - case 4: try { try decoder.decodeSingularStringField(value: &self._recipientAddress) }() - case 5: try { try decoder.decodeSingularUInt64Field(value: &self.sentNs) }() - case 6: try { try decoder.decodeSingularStringField(value: &self.contentTopic) }() - case 7: try { try decoder.decodeSingularMessageField(value: &self._conversation) }() - case 8: try { try decoder.decodeSingularBytesField(value: &self.contentBytes) }() - default: break - } - } + 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.decodeSingularStringField(value: &self.id) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.messageVersion) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.senderAddress) }() + case 4: try { try decoder.decodeSingularStringField(value: &self._recipientAddress) }() + case 5: try { try decoder.decodeSingularUInt64Field(value: &self.sentNs) }() + case 6: try { try decoder.decodeSingularStringField(value: &self.contentTopic) }() + case 7: try { try decoder.decodeSingularMessageField(value: &self._conversation) }() + case 8: try { try decoder.decodeSingularBytesField(value: &self.contentBytes) }() + default: break + } + } } public 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 - if !self.id.isEmpty { - try visitor.visitSingularStringField(value: self.id, fieldNumber: 1) - } - if !self.messageVersion.isEmpty { - try visitor.visitSingularStringField(value: self.messageVersion, fieldNumber: 2) - } - if !self.senderAddress.isEmpty { - try visitor.visitSingularStringField(value: self.senderAddress, fieldNumber: 3) - } - try { if let v = self._recipientAddress { - try visitor.visitSingularStringField(value: v, fieldNumber: 4) - } }() - if self.sentNs != 0 { - try visitor.visitSingularUInt64Field(value: self.sentNs, fieldNumber: 5) - } - if !self.contentTopic.isEmpty { - try visitor.visitSingularStringField(value: self.contentTopic, fieldNumber: 6) - } - try { if let v = self._conversation { - try visitor.visitSingularMessageField(value: v, fieldNumber: 7) - } }() - if !self.contentBytes.isEmpty { - try visitor.visitSingularBytesField(value: self.contentBytes, fieldNumber: 8) - } - try unknownFields.traverse(visitor: &visitor) + // 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 + if !self.id.isEmpty { + try visitor.visitSingularStringField(value: self.id, fieldNumber: 1) + } + if !self.messageVersion.isEmpty { + try visitor.visitSingularStringField(value: self.messageVersion, fieldNumber: 2) + } + if !self.senderAddress.isEmpty { + try visitor.visitSingularStringField(value: self.senderAddress, fieldNumber: 3) + } + try { if let v = self._recipientAddress { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } }() + if self.sentNs != 0 { + try visitor.visitSingularUInt64Field(value: self.sentNs, fieldNumber: 5) + } + if !self.contentTopic.isEmpty { + try visitor.visitSingularStringField(value: self.contentTopic, fieldNumber: 6) + } + try { if let v = self._conversation { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + if !self.contentBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.contentBytes, fieldNumber: 8) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_MessageContents_DecodedMessage, rhs: Xmtp_MessageContents_DecodedMessage) -> Bool { - if lhs.id != rhs.id {return false} - if lhs.messageVersion != rhs.messageVersion {return false} - if lhs.senderAddress != rhs.senderAddress {return false} - if lhs._recipientAddress != rhs._recipientAddress {return false} - if lhs.sentNs != rhs.sentNs {return false} - if lhs.contentTopic != rhs.contentTopic {return false} - if lhs._conversation != rhs._conversation {return false} - if lhs.contentBytes != rhs.contentBytes {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.id != rhs.id {return false} + if lhs.messageVersion != rhs.messageVersion {return false} + if lhs.senderAddress != rhs.senderAddress {return false} + if lhs._recipientAddress != rhs._recipientAddress {return false} + if lhs.sentNs != rhs.sentNs {return false} + if lhs.contentTopic != rhs.contentTopic {return false} + if lhs._conversation != rhs._conversation {return false} + if lhs.contentBytes != rhs.contentBytes {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } diff --git a/Sources/XMTPiOS/Proto/message_contents/private_preferences.pb.swift b/Sources/XMTPiOS/Proto/message_contents/private_preferences.pb.swift index 0e969de9..185242d9 100644 --- a/Sources/XMTPiOS/Proto/message_contents/private_preferences.pb.swift +++ b/Sources/XMTPiOS/Proto/message_contents/private_preferences.pb.swift @@ -36,71 +36,110 @@ public struct Xmtp_MessageContents_PrivatePreferencesAction { public var messageType: Xmtp_MessageContents_PrivatePreferencesAction.OneOf_MessageType? = nil public var allow: Xmtp_MessageContents_PrivatePreferencesAction.Allow { - get { - if case .allow(let v)? = messageType {return v} - return Xmtp_MessageContents_PrivatePreferencesAction.Allow() - } - set {messageType = .allow(newValue)} + get { + if case .allow(let v)? = messageType {return v} + return Xmtp_MessageContents_PrivatePreferencesAction.Allow() + } + set {messageType = .allow(newValue)} } public var block: Xmtp_MessageContents_PrivatePreferencesAction.Block { - get { - if case .block(let v)? = messageType {return v} - return Xmtp_MessageContents_PrivatePreferencesAction.Block() - } - set {messageType = .block(newValue)} + get { + if case .block(let v)? = messageType {return v} + return Xmtp_MessageContents_PrivatePreferencesAction.Block() + } + set {messageType = .block(newValue)} } public var unknownFields = SwiftProtobuf.UnknownStorage() public enum OneOf_MessageType: Equatable { - case allow(Xmtp_MessageContents_PrivatePreferencesAction.Allow) - case block(Xmtp_MessageContents_PrivatePreferencesAction.Block) + case allow(Xmtp_MessageContents_PrivatePreferencesAction.Allow) + case block(Xmtp_MessageContents_PrivatePreferencesAction.Block) #if !swift(>=4.1) - public static func ==(lhs: Xmtp_MessageContents_PrivatePreferencesAction.OneOf_MessageType, rhs: Xmtp_MessageContents_PrivatePreferencesAction.OneOf_MessageType) -> Bool { - // 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 (lhs, rhs) { - case (.allow, .allow): return { - guard case .allow(let l) = lhs, case .allow(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.block, .block): return { - guard case .block(let l) = lhs, case .block(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } + public static func ==(lhs: Xmtp_MessageContents_PrivatePreferencesAction.OneOf_MessageType, rhs: Xmtp_MessageContents_PrivatePreferencesAction.OneOf_MessageType) -> Bool { + // 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 (lhs, rhs) { + case (.allow, .allow): return { + guard case .allow(let l) = lhs, case .allow(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.block, .block): return { + guard case .block(let l) = lhs, case .block(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } #endif } /// Add the given wallet addresses to the allow list public struct Allow { - // 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. + // 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. - public var walletAddresses: [String] = [] + public var walletAddresses: [String] = [] - public var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - public init() {} + public init() {} } /// Add the given wallet addresses to the block list public struct Block { - // 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. + // 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. - public var walletAddresses: [String] = [] + public var walletAddresses: [String] = [] - public var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - public init() {} + public init() {} + } + + public init() {} +} + +/// The payload that goes over the wire +public struct Xmtp_MessageContents_PrivatePreferencesPayload { + // 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. + + public var version: Xmtp_MessageContents_PrivatePreferencesPayload.OneOf_Version? = nil + + public var v1: Xmtp_MessageContents_Ciphertext { + get { + if case .v1(let v)? = version {return v} + return Xmtp_MessageContents_Ciphertext() + } + set {version = .v1(newValue)} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public enum OneOf_Version: Equatable { + case v1(Xmtp_MessageContents_Ciphertext) + + #if !swift(>=4.1) + public static func ==(lhs: Xmtp_MessageContents_PrivatePreferencesPayload.OneOf_Version, rhs: Xmtp_MessageContents_PrivatePreferencesPayload.OneOf_Version) -> Bool { + // 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 (lhs, rhs) { + case (.v1, .v1): return { + guard case .v1(let l) = lhs, case .v1(let r) = rhs else { preconditionFailure() } + return l == r + }() + } + } + #endif } public init() {} @@ -111,6 +150,8 @@ extension Xmtp_MessageContents_PrivatePreferencesAction: @unchecked Sendable {} extension Xmtp_MessageContents_PrivatePreferencesAction.OneOf_MessageType: @unchecked Sendable {} extension Xmtp_MessageContents_PrivatePreferencesAction.Allow: @unchecked Sendable {} extension Xmtp_MessageContents_PrivatePreferencesAction.Block: @unchecked Sendable {} +extension Xmtp_MessageContents_PrivatePreferencesPayload: @unchecked Sendable {} +extension Xmtp_MessageContents_PrivatePreferencesPayload.OneOf_Version: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -120,133 +161,181 @@ fileprivate let _protobuf_package = "xmtp.message_contents" extension Xmtp_MessageContents_PrivatePreferencesAction: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".PrivatePreferencesAction" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "allow"), - 2: .same(proto: "block"), + 1: .same(proto: "allow"), + 2: .same(proto: "block"), ] public 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 { - var v: Xmtp_MessageContents_PrivatePreferencesAction.Allow? - var hadOneofValue = false - if let current = self.messageType { - hadOneofValue = true - if case .allow(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.messageType = .allow(v) - } - }() - case 2: try { - var v: Xmtp_MessageContents_PrivatePreferencesAction.Block? - var hadOneofValue = false - if let current = self.messageType { - hadOneofValue = true - if case .block(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.messageType = .block(v) - } - }() - default: break - } - } + 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 { + var v: Xmtp_MessageContents_PrivatePreferencesAction.Allow? + var hadOneofValue = false + if let current = self.messageType { + hadOneofValue = true + if case .allow(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.messageType = .allow(v) + } + }() + case 2: try { + var v: Xmtp_MessageContents_PrivatePreferencesAction.Block? + var hadOneofValue = false + if let current = self.messageType { + hadOneofValue = true + if case .block(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.messageType = .block(v) + } + }() + default: break + } + } } public 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 - switch self.messageType { - case .allow?: try { - guard case .allow(let v)? = self.messageType else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - }() - case .block?: try { - guard case .block(let v)? = self.messageType else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) + // 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 + switch self.messageType { + case .allow?: try { + guard case .allow(let v)? = self.messageType else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + }() + case .block?: try { + guard case .block(let v)? = self.messageType else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_MessageContents_PrivatePreferencesAction, rhs: Xmtp_MessageContents_PrivatePreferencesAction) -> Bool { - if lhs.messageType != rhs.messageType {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.messageType != rhs.messageType {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_MessageContents_PrivatePreferencesAction.Allow: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_MessageContents_PrivatePreferencesAction.protoMessageName + ".Allow" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "wallet_addresses"), + 1: .standard(proto: "wallet_addresses"), ] public 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.decodeRepeatedStringField(value: &self.walletAddresses) }() - default: break - } - } + 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.decodeRepeatedStringField(value: &self.walletAddresses) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.walletAddresses.isEmpty { - try visitor.visitRepeatedStringField(value: self.walletAddresses, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.walletAddresses.isEmpty { + try visitor.visitRepeatedStringField(value: self.walletAddresses, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_MessageContents_PrivatePreferencesAction.Allow, rhs: Xmtp_MessageContents_PrivatePreferencesAction.Allow) -> Bool { - if lhs.walletAddresses != rhs.walletAddresses {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.walletAddresses != rhs.walletAddresses {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } extension Xmtp_MessageContents_PrivatePreferencesAction.Block: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = Xmtp_MessageContents_PrivatePreferencesAction.protoMessageName + ".Block" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "wallet_addresses"), + 1: .standard(proto: "wallet_addresses"), ] public 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.decodeRepeatedStringField(value: &self.walletAddresses) }() - default: break - } - } + 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.decodeRepeatedStringField(value: &self.walletAddresses) }() + default: break + } + } } public func traverse(visitor: inout V) throws { - if !self.walletAddresses.isEmpty { - try visitor.visitRepeatedStringField(value: self.walletAddresses, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) + if !self.walletAddresses.isEmpty { + try visitor.visitRepeatedStringField(value: self.walletAddresses, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Xmtp_MessageContents_PrivatePreferencesAction.Block, rhs: Xmtp_MessageContents_PrivatePreferencesAction.Block) -> Bool { - if lhs.walletAddresses != rhs.walletAddresses {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true + if lhs.walletAddresses != rhs.walletAddresses {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Xmtp_MessageContents_PrivatePreferencesPayload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".PrivatePreferencesPayload" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "v1"), + ] + + public 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 { + var v: Xmtp_MessageContents_Ciphertext? + var hadOneofValue = false + if let current = self.version { + hadOneofValue = true + if case .v1(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.version = .v1(v) + } + }() + default: break + } + } + } + + public 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 case .v1(let v)? = self.version { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Xmtp_MessageContents_PrivatePreferencesPayload, rhs: Xmtp_MessageContents_PrivatePreferencesPayload) -> Bool { + if lhs.version != rhs.version {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true } } diff --git a/Tests/XMTPTests/CodecTests.swift b/Tests/XMTPTests/CodecTests.swift index f4850990..08ce1300 100644 --- a/Tests/XMTPTests/CodecTests.swift +++ b/Tests/XMTPTests/CodecTests.swift @@ -9,6 +9,10 @@ import XCTest @testable import XMTPiOS struct NumberCodec: ContentCodec { + func shouldPush(content: Double) throws -> Bool { + return false + } + func fallback(content: Double) throws -> String? { return "pi" } @@ -74,6 +78,33 @@ class CodecTests: XCTestCase { XCTAssertEqual(nil, content) XCTAssertEqual("pi", messages[0].fallbackContent) } + + func testCanGetPushInfoBeforeDecoded() async throws { + let fixtures = await fixtures() + + let aliceClient = fixtures.aliceClient! + let aliceConversation = try await aliceClient.conversations.newConversation(with: fixtures.bob.address) + + aliceClient.register(codec: NumberCodec()) + + try await aliceConversation.send(content: 3.14, options: .init(contentType: NumberCodec().contentType)) + + let messages = try await aliceConversation.messages() + XCTAssertEqual(messages.count, 1) + + let message = try await MessageV2.encode( + client: aliceClient, + content: messages[0].encodedContent, + topic: aliceConversation.topic, + keyMaterial: Data(aliceConversation.keyMaterial!), + codec: NumberCodec() + ) + + XCTAssertEqual(false, message.shouldPush) + XCTAssert(!message.senderHmac.isEmpty) + + } + func testCompositeCodecOnePart() async throws { let fixtures = await fixtures() diff --git a/Tests/XMTPTests/ConversationTests.swift b/Tests/XMTPTests/ConversationTests.swift index 8a6d6412..07e8b13f 100644 --- a/Tests/XMTPTests/ConversationTests.swift +++ b/Tests/XMTPTests/ConversationTests.swift @@ -230,7 +230,8 @@ class ConversationTests: XCTestCase { client: bobClient, content: encodedContent, topic: conversation.topic, - keyMaterial: conversation.keyMaterial + keyMaterial: conversation.keyMaterial, + codec: encoder ) ).serializedData() ) @@ -265,7 +266,8 @@ class ConversationTests: XCTestCase { } let codec = TextCodec() - let originalContent = try codec.encode(content: "hello", client: aliceClient) + let originalContentText = "hello" + let originalContent = try codec.encode(content: originalContentText, client: aliceClient) let tamperedContent = try codec.encode(content: "this is a fake", client: aliceClient) let originalPayload = try originalContent.serializedData() @@ -285,10 +287,20 @@ class ConversationTests: XCTestCase { let signedBytes = try signedContent.serializedData() let ciphertext = try Crypto.encrypt(aliceConversation.keyMaterial, signedBytes, additionalData: headerBytes) + + let thirtyDayPeriodsSinceEpoch = Int(date.timeIntervalSince1970 / 60 / 60 / 24 / 30) + let info = "\(thirtyDayPeriodsSinceEpoch)-\(aliceClient.address)" + let infoEncoded = info.data(using: .utf8) + + let senderHmac = try Crypto.generateHmacSignature(secret: aliceConversation.keyMaterial, info: infoEncoded!, message: headerBytes) + + let shouldPush = try codec.shouldPush(content: originalContentText) let tamperedMessage = MessageV2( headerBytes: headerBytes, - ciphertext: ciphertext + ciphertext: ciphertext, + senderHmac: senderHmac, + shouldPush: shouldPush ) try await aliceClient.publish(envelopes: [ diff --git a/Tests/XMTPTests/MessageTests.swift b/Tests/XMTPTests/MessageTests.swift index e1a9ffc9..b49a08a7 100644 --- a/Tests/XMTPTests/MessageTests.swift +++ b/Tests/XMTPTests/MessageTests.swift @@ -44,7 +44,7 @@ class MessageTests: XCTestCase { } func testFullyEncodesDecodesMessagesV2() async throws { - try TestConfig.skipIfNotRunningLocalNodeTests() + try TestConfig.skipIfNotRunningLocalNodeTests() let aliceWallet = try PrivateKey.generate() let bobWallet = try PrivateKey.generate() @@ -63,7 +63,7 @@ class MessageTests: XCTestCase { let sealedInvitation = try SealedInvitation.createV1(sender: alice.toV2(), recipient: bob.toV2().getPublicKeyBundle(), created: Date(), invitation: invitationv1) let encoder = TextCodec() let encodedContent = try encoder.encode(content: "Yo!", client: client) - let message1 = try await MessageV2.encode(client: client, content: encodedContent, topic: invitationv1.topic, keyMaterial: invitationv1.aes256GcmHkdfSha256.keyMaterial) + let message1 = try await MessageV2.encode(client: client, content: encodedContent, topic: invitationv1.topic, keyMaterial: invitationv1.aes256GcmHkdfSha256.keyMaterial, codec: encoder) let decoded = try MessageV2.decode("", "", message1, keyMaterial: invitationv1.aes256GcmHkdfSha256.keyMaterial, client: client) let result: String = try decoded.content() diff --git a/XMTP.podspec b/XMTP.podspec index c3696625..0538e2b2 100644 --- a/XMTP.podspec +++ b/XMTP.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |spec| # spec.name = "XMTP" - spec.version = "0.7.8-alpha0" + spec.version = "0.7.9-alpha0" spec.summary = "XMTP SDK Cocoapod" # This description is used to generate tags and improve search results.