diff --git a/Sources/XMTP/Proto/message_api/v3/mls.pb.swift b/Sources/XMTP/Proto/message_api/v3/mls.pb.swift deleted file mode 100644 index 5b295e2b..00000000 --- a/Sources/XMTP/Proto/message_api/v3/mls.pb.swift +++ /dev/null @@ -1,978 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: message_api/v3/mls.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -/// Message API - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -/// Publish a batch of MLS messages -public struct Xmtp_MessageApi_V3_PublishToGroupRequest { - // 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 messages: [Xmtp_Mls_MessageContents_GroupMessage] = [] - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -/// Publish a batch of welcome messages -public struct Xmtp_MessageApi_V3_PublishWelcomesRequest { - // 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 welcomeMessages: [Xmtp_MessageApi_V3_PublishWelcomesRequest.WelcomeMessageRequest] = [] - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - /// An individual welcome message - public struct WelcomeMessageRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// The topic will be derived from this - public var installationID: String = String() - - public var welcomeMessage: Xmtp_Mls_MessageContents_WelcomeMessage { - get {return _welcomeMessage ?? Xmtp_Mls_MessageContents_WelcomeMessage()} - set {_welcomeMessage = newValue} - } - /// Returns true if `welcomeMessage` has been explicitly set. - public var hasWelcomeMessage: Bool {return self._welcomeMessage != nil} - /// Clears the value of `welcomeMessage`. Subsequent reads from it will return its default value. - public mutating func clearWelcomeMessage() {self._welcomeMessage = nil} - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _welcomeMessage: Xmtp_Mls_MessageContents_WelcomeMessage? = nil - } - - public init() {} -} - -/// Register a new installation -public struct Xmtp_MessageApi_V3_RegisterInstallationRequest { - // 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 credentialBytes: Data = Data() - - public var signingKeyPublic: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -public struct Xmtp_MessageApi_V3_RegisterInstallationResponse { - // 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 installationID: String = String() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -/// Upload one or more key packages -public struct Xmtp_MessageApi_V3_UploadKeyPackagesRequest { - // 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 keyPackages: [Xmtp_MessageApi_V3_UploadKeyPackagesRequest.KeyPackageUpload] = [] - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - /// An individual key package upload request - public struct KeyPackageUpload { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// The owner's wallet address would be extracted from the identity - /// credential in the key package, and all signatures would be validated. - public var keyPackageTlsSerialized: Data = Data() - - /// The node will always treat the most recent last-resort key package as - /// the active one, and will ignore all others. - public var isLastResort: Bool = false - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - } - - public init() {} -} - -/// Consume one or more key packages, removing them from further use -public struct Xmtp_MessageApi_V3_ConsumeKeyPackagesRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// The caller can provide an array of wallet addresses, and the API - /// will return one key package for each installation associated with each - /// wallet address - public var installationIds: [String] = [] - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -/// The response to a ConsumeKeyPackagesRequest -public struct Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse { - // 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. - - /// Returns one key package per installation in the original order of the - /// request. If any installations are missing key packages, - public var keyPackages: [Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse.KeyPackage] = [] - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - /// An individual key package - public struct KeyPackage { - // 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 keyPackageTlsSerialized: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - } - - public init() {} -} - -/// Revoke an installation -public struct Xmtp_MessageApi_V3_RevokeInstallationRequest { - // 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 installationID: String = String() - - /// All revocations must be validated with a wallet signature over the - /// installation_id being revoked (and some sort of standard prologue) - public var walletSignature: Xmtp_MessageContents_Signature { - get {return _walletSignature ?? Xmtp_MessageContents_Signature()} - set {_walletSignature = newValue} - } - /// Returns true if `walletSignature` has been explicitly set. - public var hasWalletSignature: Bool {return self._walletSignature != nil} - /// Clears the value of `walletSignature`. Subsequent reads from it will return its default value. - public mutating func clearWalletSignature() {self._walletSignature = nil} - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _walletSignature: Xmtp_MessageContents_Signature? = nil -} - -/// Get all updates for an identity since the specified time -public struct Xmtp_MessageApi_V3_GetIdentityUpdatesRequest { - // 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 startTimeNs: UInt64 = 0 - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -/// Used to get any new or revoked installations for a list of wallet addresses -public struct Xmtp_MessageApi_V3_GetIdentityUpdatesResponse { - // 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. - - /// A list of updates (or empty objects if no changes) in the original order - /// of the request - public var updates: [Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.WalletUpdates] = [] - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - /// A new installation ID was seen for the first time by the nodes - public struct NewInstallationUpdate { - // 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 installationID: String = String() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - } - - /// An installation was revoked - public struct RevokedInstallationUpdate { - // 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 installationID: String = String() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - } - - /// A wrapper for any update to the wallet - public struct Update { - // 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 timestampNs: UInt64 = 0 - - public var kind: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.Update.OneOf_Kind? = nil - - public var newInstallation: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.NewInstallationUpdate { - get { - if case .newInstallation(let v)? = kind {return v} - return Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.NewInstallationUpdate() - } - set {kind = .newInstallation(newValue)} - } - - public var revokedInstallation: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.RevokedInstallationUpdate { - get { - if case .revokedInstallation(let v)? = kind {return v} - return Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.RevokedInstallationUpdate() - } - set {kind = .revokedInstallation(newValue)} - } - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public enum OneOf_Kind: Equatable { - case newInstallation(Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.NewInstallationUpdate) - case revokedInstallation(Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.RevokedInstallationUpdate) - - #if !swift(>=4.1) - public static func ==(lhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.Update.OneOf_Kind, rhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.Update.OneOf_Kind) -> 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 (.newInstallation, .newInstallation): return { - guard case .newInstallation(let l) = lhs, case .newInstallation(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.revokedInstallation, .revokedInstallation): return { - guard case .revokedInstallation(let l) = lhs, case .revokedInstallation(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - public init() {} - } - - /// A wrapper for the updates for a single wallet - public struct WalletUpdates { - // 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 updates: [Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.Update] = [] - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - } - - public init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension Xmtp_MessageApi_V3_PublishToGroupRequest: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_PublishWelcomesRequest: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_PublishWelcomesRequest.WelcomeMessageRequest: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_RegisterInstallationRequest: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_RegisterInstallationResponse: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_UploadKeyPackagesRequest: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_UploadKeyPackagesRequest.KeyPackageUpload: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_ConsumeKeyPackagesRequest: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse.KeyPackage: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_RevokeInstallationRequest: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_GetIdentityUpdatesRequest: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.NewInstallationUpdate: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.RevokedInstallationUpdate: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.Update: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.Update.OneOf_Kind: @unchecked Sendable {} -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.WalletUpdates: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "xmtp.message_api.v3" - -extension Xmtp_MessageApi_V3_PublishToGroupRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".PublishToGroupRequest" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "messages"), - ] - - 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.messages) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.messages.isEmpty { - try visitor.visitRepeatedMessageField(value: self.messages, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_PublishToGroupRequest, rhs: Xmtp_MessageApi_V3_PublishToGroupRequest) -> Bool { - if lhs.messages != rhs.messages {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_PublishWelcomesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".PublishWelcomesRequest" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "welcome_messages"), - ] - - 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.welcomeMessages) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.welcomeMessages.isEmpty { - try visitor.visitRepeatedMessageField(value: self.welcomeMessages, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_PublishWelcomesRequest, rhs: Xmtp_MessageApi_V3_PublishWelcomesRequest) -> Bool { - if lhs.welcomeMessages != rhs.welcomeMessages {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_PublishWelcomesRequest.WelcomeMessageRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = Xmtp_MessageApi_V3_PublishWelcomesRequest.protoMessageName + ".WelcomeMessageRequest" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "installation_id"), - 2: .standard(proto: "welcome_message"), - ] - - 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.installationID) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._welcomeMessage) }() - 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.installationID.isEmpty { - try visitor.visitSingularStringField(value: self.installationID, fieldNumber: 1) - } - try { if let v = self._welcomeMessage { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_PublishWelcomesRequest.WelcomeMessageRequest, rhs: Xmtp_MessageApi_V3_PublishWelcomesRequest.WelcomeMessageRequest) -> Bool { - if lhs.installationID != rhs.installationID {return false} - if lhs._welcomeMessage != rhs._welcomeMessage {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_RegisterInstallationRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".RegisterInstallationRequest" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "credential_bytes"), - 2: .standard(proto: "signing_key_public"), - ] - - 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.credentialBytes) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.signingKeyPublic) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.credentialBytes.isEmpty { - try visitor.visitSingularBytesField(value: self.credentialBytes, fieldNumber: 1) - } - if !self.signingKeyPublic.isEmpty { - try visitor.visitSingularBytesField(value: self.signingKeyPublic, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_RegisterInstallationRequest, rhs: Xmtp_MessageApi_V3_RegisterInstallationRequest) -> Bool { - if lhs.credentialBytes != rhs.credentialBytes {return false} - if lhs.signingKeyPublic != rhs.signingKeyPublic {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_RegisterInstallationResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".RegisterInstallationResponse" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "installation_id"), - ] - - 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.installationID) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.installationID.isEmpty { - try visitor.visitSingularStringField(value: self.installationID, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_RegisterInstallationResponse, rhs: Xmtp_MessageApi_V3_RegisterInstallationResponse) -> Bool { - if lhs.installationID != rhs.installationID {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_UploadKeyPackagesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".UploadKeyPackagesRequest" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "key_packages"), - ] - - 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.keyPackages) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.keyPackages.isEmpty { - try visitor.visitRepeatedMessageField(value: self.keyPackages, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_UploadKeyPackagesRequest, rhs: Xmtp_MessageApi_V3_UploadKeyPackagesRequest) -> Bool { - if lhs.keyPackages != rhs.keyPackages {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_UploadKeyPackagesRequest.KeyPackageUpload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = Xmtp_MessageApi_V3_UploadKeyPackagesRequest.protoMessageName + ".KeyPackageUpload" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "key_package_tls_serialized"), - 2: .standard(proto: "is_last_resort"), - ] - - 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.keyPackageTlsSerialized) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self.isLastResort) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.keyPackageTlsSerialized.isEmpty { - try visitor.visitSingularBytesField(value: self.keyPackageTlsSerialized, fieldNumber: 1) - } - if self.isLastResort != false { - try visitor.visitSingularBoolField(value: self.isLastResort, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_UploadKeyPackagesRequest.KeyPackageUpload, rhs: Xmtp_MessageApi_V3_UploadKeyPackagesRequest.KeyPackageUpload) -> Bool { - if lhs.keyPackageTlsSerialized != rhs.keyPackageTlsSerialized {return false} - if lhs.isLastResort != rhs.isLastResort {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_ConsumeKeyPackagesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".ConsumeKeyPackagesRequest" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "installation_ids"), - ] - - 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.installationIds) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.installationIds.isEmpty { - try visitor.visitRepeatedStringField(value: self.installationIds, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_ConsumeKeyPackagesRequest, rhs: Xmtp_MessageApi_V3_ConsumeKeyPackagesRequest) -> Bool { - if lhs.installationIds != rhs.installationIds {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".ConsumeKeyPackagesResponse" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "key_packages"), - ] - - 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.keyPackages) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.keyPackages.isEmpty { - try visitor.visitRepeatedMessageField(value: self.keyPackages, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse, rhs: Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse) -> Bool { - if lhs.keyPackages != rhs.keyPackages {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse.KeyPackage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse.protoMessageName + ".KeyPackage" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "key_package_tls_serialized"), - ] - - 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.keyPackageTlsSerialized) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.keyPackageTlsSerialized.isEmpty { - try visitor.visitSingularBytesField(value: self.keyPackageTlsSerialized, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse.KeyPackage, rhs: Xmtp_MessageApi_V3_ConsumeKeyPackagesResponse.KeyPackage) -> Bool { - if lhs.keyPackageTlsSerialized != rhs.keyPackageTlsSerialized {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_RevokeInstallationRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".RevokeInstallationRequest" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "installation_id"), - 2: .standard(proto: "wallet_signature"), - ] - - 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.installationID) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._walletSignature) }() - 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.installationID.isEmpty { - try visitor.visitSingularStringField(value: self.installationID, fieldNumber: 1) - } - try { if let v = self._walletSignature { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_RevokeInstallationRequest, rhs: Xmtp_MessageApi_V3_RevokeInstallationRequest) -> Bool { - if lhs.installationID != rhs.installationID {return false} - if lhs._walletSignature != rhs._walletSignature {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_GetIdentityUpdatesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".GetIdentityUpdatesRequest" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "wallet_addresses"), - 2: .standard(proto: "start_time_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.decodeRepeatedStringField(value: &self.walletAddresses) }() - case 2: try { try decoder.decodeSingularUInt64Field(value: &self.startTimeNs) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.walletAddresses.isEmpty { - try visitor.visitRepeatedStringField(value: self.walletAddresses, fieldNumber: 1) - } - if self.startTimeNs != 0 { - try visitor.visitSingularUInt64Field(value: self.startTimeNs, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_GetIdentityUpdatesRequest, rhs: Xmtp_MessageApi_V3_GetIdentityUpdatesRequest) -> Bool { - if lhs.walletAddresses != rhs.walletAddresses {return false} - if lhs.startTimeNs != rhs.startTimeNs {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".GetIdentityUpdatesResponse" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "updates"), - ] - - 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.updates) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.updates.isEmpty { - try visitor.visitRepeatedMessageField(value: self.updates, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse, rhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse) -> Bool { - if lhs.updates != rhs.updates {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.NewInstallationUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.protoMessageName + ".NewInstallationUpdate" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "installation_id"), - ] - - 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.installationID) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.installationID.isEmpty { - try visitor.visitSingularStringField(value: self.installationID, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.NewInstallationUpdate, rhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.NewInstallationUpdate) -> Bool { - if lhs.installationID != rhs.installationID {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.RevokedInstallationUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.protoMessageName + ".RevokedInstallationUpdate" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "installation_id"), - ] - - 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.installationID) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.installationID.isEmpty { - try visitor.visitSingularStringField(value: self.installationID, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.RevokedInstallationUpdate, rhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.RevokedInstallationUpdate) -> Bool { - if lhs.installationID != rhs.installationID {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.Update: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.protoMessageName + ".Update" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "timestamp_ns"), - 2: .standard(proto: "new_installation"), - 3: .standard(proto: "revoked_installation"), - ] - - 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) }() - case 2: try { - var v: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.NewInstallationUpdate? - var hadOneofValue = false - if let current = self.kind { - hadOneofValue = true - if case .newInstallation(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.kind = .newInstallation(v) - } - }() - case 3: try { - var v: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.RevokedInstallationUpdate? - var hadOneofValue = false - if let current = self.kind { - hadOneofValue = true - if case .revokedInstallation(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.kind = .revokedInstallation(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.timestampNs != 0 { - try visitor.visitSingularUInt64Field(value: self.timestampNs, fieldNumber: 1) - } - switch self.kind { - case .newInstallation?: try { - guard case .newInstallation(let v)? = self.kind else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case .revokedInstallation?: try { - guard case .revokedInstallation(let v)? = self.kind else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.Update, rhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.Update) -> Bool { - if lhs.timestampNs != rhs.timestampNs {return false} - if lhs.kind != rhs.kind {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.WalletUpdates: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.protoMessageName + ".WalletUpdates" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "updates"), - ] - - 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.updates) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.updates.isEmpty { - try visitor.visitRepeatedMessageField(value: self.updates, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.WalletUpdates, rhs: Xmtp_MessageApi_V3_GetIdentityUpdatesResponse.WalletUpdates) -> Bool { - if lhs.updates != rhs.updates {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Sources/XMTP/Proto/mls/message_contents/message.pb.swift b/Sources/XMTP/Proto/mls/message_contents/message.pb.swift deleted file mode 100644 index ed157698..00000000 --- a/Sources/XMTP/Proto/mls/message_contents/message.pb.swift +++ /dev/null @@ -1,300 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: mls/message_contents/message.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -/// V3 invite message structure - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -/// Wrapper for a MLS welcome message -public struct Xmtp_Mls_MessageContents_WelcomeMessage { - // 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_Mls_MessageContents_WelcomeMessage.OneOf_Version? = nil - - public var v1: Xmtp_Mls_MessageContents_WelcomeMessage.V1 { - get { - if case .v1(let v)? = version {return v} - return Xmtp_Mls_MessageContents_WelcomeMessage.V1() - } - set {version = .v1(newValue)} - } - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public enum OneOf_Version: Equatable { - case v1(Xmtp_Mls_MessageContents_WelcomeMessage.V1) - - #if !swift(>=4.1) - public static func ==(lhs: Xmtp_Mls_MessageContents_WelcomeMessage.OneOf_Version, rhs: Xmtp_Mls_MessageContents_WelcomeMessage.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 - } - - /// Version 1 of the WelcomeMessage format - public struct V1 { - // 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 welcomeMessageTlsSerialized: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - } - - public init() {} -} - -/// GroupMessage wraps any MLS message sent to a group topic -public struct Xmtp_Mls_MessageContents_GroupMessage { - // 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_Mls_MessageContents_GroupMessage.OneOf_Version? = nil - - public var v1: Xmtp_Mls_MessageContents_GroupMessage.V1 { - get { - if case .v1(let v)? = version {return v} - return Xmtp_Mls_MessageContents_GroupMessage.V1() - } - set {version = .v1(newValue)} - } - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public enum OneOf_Version: Equatable { - case v1(Xmtp_Mls_MessageContents_GroupMessage.V1) - - #if !swift(>=4.1) - public static func ==(lhs: Xmtp_Mls_MessageContents_GroupMessage.OneOf_Version, rhs: Xmtp_Mls_MessageContents_GroupMessage.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 - } - - /// Version 1 of the GroupMessage format - public struct V1 { - // 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 mlsMessageTlsSerialized: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - } - - public init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension Xmtp_Mls_MessageContents_WelcomeMessage: @unchecked Sendable {} -extension Xmtp_Mls_MessageContents_WelcomeMessage.OneOf_Version: @unchecked Sendable {} -extension Xmtp_Mls_MessageContents_WelcomeMessage.V1: @unchecked Sendable {} -extension Xmtp_Mls_MessageContents_GroupMessage: @unchecked Sendable {} -extension Xmtp_Mls_MessageContents_GroupMessage.OneOf_Version: @unchecked Sendable {} -extension Xmtp_Mls_MessageContents_GroupMessage.V1: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "xmtp.mls.message_contents" - -extension Xmtp_Mls_MessageContents_WelcomeMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".WelcomeMessage" - 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_Mls_MessageContents_WelcomeMessage.V1? - 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_Mls_MessageContents_WelcomeMessage, rhs: Xmtp_Mls_MessageContents_WelcomeMessage) -> Bool { - if lhs.version != rhs.version {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_Mls_MessageContents_WelcomeMessage.V1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = Xmtp_Mls_MessageContents_WelcomeMessage.protoMessageName + ".V1" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "welcome_message_tls_serialized"), - ] - - 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.welcomeMessageTlsSerialized) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.welcomeMessageTlsSerialized.isEmpty { - try visitor.visitSingularBytesField(value: self.welcomeMessageTlsSerialized, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_Mls_MessageContents_WelcomeMessage.V1, rhs: Xmtp_Mls_MessageContents_WelcomeMessage.V1) -> Bool { - if lhs.welcomeMessageTlsSerialized != rhs.welcomeMessageTlsSerialized {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_Mls_MessageContents_GroupMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".GroupMessage" - 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_Mls_MessageContents_GroupMessage.V1? - 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_Mls_MessageContents_GroupMessage, rhs: Xmtp_Mls_MessageContents_GroupMessage) -> Bool { - if lhs.version != rhs.version {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_Mls_MessageContents_GroupMessage.V1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = Xmtp_Mls_MessageContents_GroupMessage.protoMessageName + ".V1" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "mls_message_tls_serialized"), - ] - - 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.mlsMessageTlsSerialized) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.mlsMessageTlsSerialized.isEmpty { - try visitor.visitSingularBytesField(value: self.mlsMessageTlsSerialized, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_Mls_MessageContents_GroupMessage.V1, rhs: Xmtp_Mls_MessageContents_GroupMessage.V1) -> Bool { - if lhs.mlsMessageTlsSerialized != rhs.mlsMessageTlsSerialized {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Sources/XMTP/Proto/v3/message_contents/association.pb.swift b/Sources/XMTP/Proto/v3/message_contents/association.pb.swift deleted file mode 100644 index 3d2f91f5..00000000 --- a/Sources/XMTP/Proto/v3/message_contents/association.pb.swift +++ /dev/null @@ -1,248 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: v3/message_contents/association.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -/// Association types - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -/// Allows for us to update the format of the association text without -/// incrementing the entire proto -public enum Xmtp_V3_MessageContents_AssociationTextVersion: SwiftProtobuf.Enum { - public typealias RawValue = Int - case unspecified // = 0 - case associationTextVersion1 // = 1 - case UNRECOGNIZED(Int) - - public init() { - self = .unspecified - } - - public init?(rawValue: Int) { - switch rawValue { - case 0: self = .unspecified - case 1: self = .associationTextVersion1 - default: self = .UNRECOGNIZED(rawValue) - } - } - - public var rawValue: Int { - switch self { - case .unspecified: return 0 - case .associationTextVersion1: return 1 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension Xmtp_V3_MessageContents_AssociationTextVersion: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - public static let allCases: [Xmtp_V3_MessageContents_AssociationTextVersion] = [ - .unspecified, - .associationTextVersion1, - ] -} - -#endif // swift(>=4.2) - -/// EIP191Association is used for all EIP 191 compliant wallet signatures -public struct Xmtp_V3_MessageContents_Eip191Association { - // 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 associationTextVersion: Xmtp_V3_MessageContents_AssociationTextVersion = .unspecified - - public var signature: Xmtp_V3_MessageContents_RecoverableEcdsaSignature { - get {return _signature ?? Xmtp_V3_MessageContents_RecoverableEcdsaSignature()} - set {_signature = newValue} - } - /// Returns true if `signature` has been explicitly set. - public var hasSignature: Bool {return self._signature != nil} - /// Clears the value of `signature`. Subsequent reads from it will return its default value. - public mutating func clearSignature() {self._signature = nil} - - public var walletAddress: String = String() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _signature: Xmtp_V3_MessageContents_RecoverableEcdsaSignature? = nil -} - -/// RecoverableEcdsaSignature -public struct Xmtp_V3_MessageContents_RecoverableEcdsaSignature { - // 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. - - /// Includes recovery id as the last byte - public var bytes: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -/// EdDSA signature bytes matching RFC 8032 -public struct Xmtp_V3_MessageContents_EdDsaSignature { - // 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 bytes: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension Xmtp_V3_MessageContents_AssociationTextVersion: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_Eip191Association: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_RecoverableEcdsaSignature: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_EdDsaSignature: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "xmtp.v3.message_contents" - -extension Xmtp_V3_MessageContents_AssociationTextVersion: SwiftProtobuf._ProtoNameProviding { - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "ASSOCIATION_TEXT_VERSION_UNSPECIFIED"), - 1: .same(proto: "ASSOCIATION_TEXT_VERSION_1"), - ] -} - -extension Xmtp_V3_MessageContents_Eip191Association: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".Eip191Association" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "association_text_version"), - 2: .same(proto: "signature"), - 3: .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.decodeSingularEnumField(value: &self.associationTextVersion) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._signature) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.walletAddress) }() - 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.associationTextVersion != .unspecified { - try visitor.visitSingularEnumField(value: self.associationTextVersion, fieldNumber: 1) - } - try { if let v = self._signature { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - if !self.walletAddress.isEmpty { - try visitor.visitSingularStringField(value: self.walletAddress, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_Eip191Association, rhs: Xmtp_V3_MessageContents_Eip191Association) -> Bool { - if lhs.associationTextVersion != rhs.associationTextVersion {return false} - if lhs._signature != rhs._signature {return false} - if lhs.walletAddress != rhs.walletAddress {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_RecoverableEcdsaSignature: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".RecoverableEcdsaSignature" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "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.decodeSingularBytesField(value: &self.bytes) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.bytes.isEmpty { - try visitor.visitSingularBytesField(value: self.bytes, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_RecoverableEcdsaSignature, rhs: Xmtp_V3_MessageContents_RecoverableEcdsaSignature) -> Bool { - if lhs.bytes != rhs.bytes {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_EdDsaSignature: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".EdDsaSignature" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "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.decodeSingularBytesField(value: &self.bytes) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.bytes.isEmpty { - try visitor.visitSingularBytesField(value: self.bytes, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_EdDsaSignature, rhs: Xmtp_V3_MessageContents_EdDsaSignature) -> Bool { - if lhs.bytes != rhs.bytes {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Sources/XMTP/Proto/v3/message_contents/invite.pb.swift b/Sources/XMTP/Proto/v3/message_contents/invite.pb.swift deleted file mode 100644 index f5aebb4b..00000000 --- a/Sources/XMTP/Proto/v3/message_contents/invite.pb.swift +++ /dev/null @@ -1,241 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: v3/message_contents/invite.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -/// V3 invite message structure - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -/// InvitationV1 is the invitation message meant to be encrypted as -/// ciphertext in InvitationEnvelopeV1 and decrypted by the recipient using the -/// provided inviter `InstallationContactBundle` -public struct Xmtp_V3_MessageContents_InvitationV1 { - // 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. - - /// If the inviter contact bundle has the same wallet address as the current - /// user, the invitee is the other wallet address in the conversation. If the - /// inviter contact bundle has a different wallet address, the invitee wallet - /// address MUST be the wallet address of the recipient of the invite. - public var inviteeWalletAddress: String = String() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -/// InvitationEnvelopeV1 is the encrypted invitation message and the contact of -/// the sender -public struct Xmtp_V3_MessageContents_InvitationEnvelopeV1 { - // 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. - - /// This contains the public key that will be used to decrypt the ciphertext - public var inviter: Xmtp_V3_MessageContents_InstallationContactBundle { - get {return _inviter ?? Xmtp_V3_MessageContents_InstallationContactBundle()} - set {_inviter = newValue} - } - /// Returns true if `inviter` has been explicitly set. - public var hasInviter: Bool {return self._inviter != nil} - /// Clears the value of `inviter`. Subsequent reads from it will return its default value. - public mutating func clearInviter() {self._inviter = nil} - - /// Corresponds to an InvitationV1 message - public var ciphertext: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _inviter: Xmtp_V3_MessageContents_InstallationContactBundle? = nil -} - -/// Wrapper message type -public struct Xmtp_V3_MessageContents_InvitationEnvelope { - // 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_V3_MessageContents_InvitationEnvelope.OneOf_Version? = nil - - public var v1: Xmtp_V3_MessageContents_InvitationEnvelopeV1 { - get { - if case .v1(let v)? = version {return v} - return Xmtp_V3_MessageContents_InvitationEnvelopeV1() - } - set {version = .v1(newValue)} - } - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public enum OneOf_Version: Equatable { - case v1(Xmtp_V3_MessageContents_InvitationEnvelopeV1) - - #if !swift(>=4.1) - public static func ==(lhs: Xmtp_V3_MessageContents_InvitationEnvelope.OneOf_Version, rhs: Xmtp_V3_MessageContents_InvitationEnvelope.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() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension Xmtp_V3_MessageContents_InvitationV1: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_InvitationEnvelopeV1: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_InvitationEnvelope: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_InvitationEnvelope.OneOf_Version: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "xmtp.v3.message_contents" - -extension Xmtp_V3_MessageContents_InvitationV1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".InvitationV1" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "invitee_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.inviteeWalletAddress) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.inviteeWalletAddress.isEmpty { - try visitor.visitSingularStringField(value: self.inviteeWalletAddress, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_InvitationV1, rhs: Xmtp_V3_MessageContents_InvitationV1) -> Bool { - if lhs.inviteeWalletAddress != rhs.inviteeWalletAddress {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_InvitationEnvelopeV1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".InvitationEnvelopeV1" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "inviter"), - 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.decodeSingularMessageField(value: &self._inviter) }() - case 2: try { try decoder.decodeSingularBytesField(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 - try { if let v = self._inviter { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.ciphertext.isEmpty { - try visitor.visitSingularBytesField(value: self.ciphertext, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_InvitationEnvelopeV1, rhs: Xmtp_V3_MessageContents_InvitationEnvelopeV1) -> Bool { - if lhs._inviter != rhs._inviter {return false} - if lhs.ciphertext != rhs.ciphertext {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_InvitationEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".InvitationEnvelope" - 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_V3_MessageContents_InvitationEnvelopeV1? - 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_V3_MessageContents_InvitationEnvelope, rhs: Xmtp_V3_MessageContents_InvitationEnvelope) -> Bool { - if lhs.version != rhs.version {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Sources/XMTP/Proto/v3/message_contents/message.pb.swift b/Sources/XMTP/Proto/v3/message_contents/message.pb.swift deleted file mode 100644 index 2496b1c7..00000000 --- a/Sources/XMTP/Proto/v3/message_contents/message.pb.swift +++ /dev/null @@ -1,370 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: v3/message_contents/message.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -/// Structure for messages in v3 - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -/// The version used for the decrypted padlock message payload -public enum Xmtp_V3_MessageContents_PadlockMessagePayloadVersion: SwiftProtobuf.Enum { - public typealias RawValue = Int - case unspecified // = 0 - case one // = 1 - case UNRECOGNIZED(Int) - - public init() { - self = .unspecified - } - - public init?(rawValue: Int) { - switch rawValue { - case 0: self = .unspecified - case 1: self = .one - default: self = .UNRECOGNIZED(rawValue) - } - } - - public var rawValue: Int { - switch self { - case .unspecified: return 0 - case .one: return 1 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension Xmtp_V3_MessageContents_PadlockMessagePayloadVersion: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - public static let allCases: [Xmtp_V3_MessageContents_PadlockMessagePayloadVersion] = [ - .unspecified, - .one, - ] -} - -#endif // swift(>=4.2) - -/// Metadata that is encrypted via SealedSender and only visible to the recipient -/// Currently we do not actually encrypt this, actual implementation of -/// SealedSender will be added shortly. -public struct Xmtp_V3_MessageContents_PadlockMessageSealedMetadata { - // 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 senderUserAddress: String = String() - - public var senderInstallationID: String = String() - - public var recipientUserAddress: String = String() - - public var recipientInstallationID: String = String() - - public var isPrekeyMessage: Bool = false - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -/// Plaintext header included with messages, visible to all -/// Recipients can verify this header has not been tampered with. -/// Servers are unable to verify if the header has been tampered with. -public struct Xmtp_V3_MessageContents_PadlockMessageHeader { - // 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 sentNs: UInt64 = 0 - - /// PadlockMessageSealedMetadata - public var sealedMetadata: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -/// Encrypted body included with messages, only visible to recipients -/// When receiving a message: -/// 1. Decrypt the sealed metadata in the header via SealedSender -/// 2. Verify that you match the recipient_user_address and -/// recipient_installation_id. Verify that the sender_installation_id matches -/// the sender_user_address. -/// 2. Find the relevant session using the sender_user_address and -/// sender_installation_id in the unsealed metadata -/// 3. Use the session to decrypt the payload -/// 4. Verify that the header_signature in the decrypted payload was produced by -/// signing the header_bytes with the ed25519 key matching the -/// sender_installation_id -/// 5. Verify that both the sender_user and recipient_user are partipants of the -/// conversation referenced by convo_id -public struct Xmtp_V3_MessageContents_PadlockMessagePayload { - // 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 messageVersion: Xmtp_V3_MessageContents_PadlockMessagePayloadVersion = .unspecified - - /// Signs PadlockMessageHeader - public var headerSignature: Xmtp_V3_MessageContents_EdDsaSignature { - get {return _headerSignature ?? Xmtp_V3_MessageContents_EdDsaSignature()} - set {_headerSignature = newValue} - } - /// Returns true if `headerSignature` has been explicitly set. - public var hasHeaderSignature: Bool {return self._headerSignature != nil} - /// Clears the value of `headerSignature`. Subsequent reads from it will return its default value. - public mutating func clearHeaderSignature() {self._headerSignature = nil} - - public var convoID: String = String() - - /// EncodedContent - public var contentBytes: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _headerSignature: Xmtp_V3_MessageContents_EdDsaSignature? = nil -} - -/// Combines the plaintext header with the encrypted payload -public struct Xmtp_V3_MessageContents_PadlockMessageEnvelope { - // 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. - - /// PadlockMessageHeader - public var headerBytes: Data = Data() - - /// Encrypted PadlockMessagePayload - public var ciphertext: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension Xmtp_V3_MessageContents_PadlockMessagePayloadVersion: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_PadlockMessageSealedMetadata: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_PadlockMessageHeader: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_PadlockMessagePayload: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_PadlockMessageEnvelope: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "xmtp.v3.message_contents" - -extension Xmtp_V3_MessageContents_PadlockMessagePayloadVersion: SwiftProtobuf._ProtoNameProviding { - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "PADLOCK_MESSAGE_PAYLOAD_VERSION_UNSPECIFIED"), - 1: .same(proto: "PADLOCK_MESSAGE_PAYLOAD_VERSION_ONE"), - ] -} - -extension Xmtp_V3_MessageContents_PadlockMessageSealedMetadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".PadlockMessageSealedMetadata" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "sender_user_address"), - 2: .standard(proto: "sender_installation_id"), - 3: .standard(proto: "recipient_user_address"), - 4: .standard(proto: "recipient_installation_id"), - 5: .standard(proto: "is_prekey_message"), - ] - - 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.senderUserAddress) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.senderInstallationID) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.recipientUserAddress) }() - case 4: try { try decoder.decodeSingularStringField(value: &self.recipientInstallationID) }() - case 5: try { try decoder.decodeSingularBoolField(value: &self.isPrekeyMessage) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.senderUserAddress.isEmpty { - try visitor.visitSingularStringField(value: self.senderUserAddress, fieldNumber: 1) - } - if !self.senderInstallationID.isEmpty { - try visitor.visitSingularStringField(value: self.senderInstallationID, fieldNumber: 2) - } - if !self.recipientUserAddress.isEmpty { - try visitor.visitSingularStringField(value: self.recipientUserAddress, fieldNumber: 3) - } - if !self.recipientInstallationID.isEmpty { - try visitor.visitSingularStringField(value: self.recipientInstallationID, fieldNumber: 4) - } - if self.isPrekeyMessage != false { - try visitor.visitSingularBoolField(value: self.isPrekeyMessage, fieldNumber: 5) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_PadlockMessageSealedMetadata, rhs: Xmtp_V3_MessageContents_PadlockMessageSealedMetadata) -> Bool { - if lhs.senderUserAddress != rhs.senderUserAddress {return false} - if lhs.senderInstallationID != rhs.senderInstallationID {return false} - if lhs.recipientUserAddress != rhs.recipientUserAddress {return false} - if lhs.recipientInstallationID != rhs.recipientInstallationID {return false} - if lhs.isPrekeyMessage != rhs.isPrekeyMessage {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_PadlockMessageHeader: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".PadlockMessageHeader" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "sent_ns"), - 2: .standard(proto: "sealed_metadata"), - ] - - 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.sentNs) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.sealedMetadata) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if self.sentNs != 0 { - try visitor.visitSingularUInt64Field(value: self.sentNs, fieldNumber: 1) - } - if !self.sealedMetadata.isEmpty { - try visitor.visitSingularBytesField(value: self.sealedMetadata, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_PadlockMessageHeader, rhs: Xmtp_V3_MessageContents_PadlockMessageHeader) -> Bool { - if lhs.sentNs != rhs.sentNs {return false} - if lhs.sealedMetadata != rhs.sealedMetadata {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_PadlockMessagePayload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".PadlockMessagePayload" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "message_version"), - 2: .standard(proto: "header_signature"), - 3: .standard(proto: "convo_id"), - 4: .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.decodeSingularEnumField(value: &self.messageVersion) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._headerSignature) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.convoID) }() - case 4: 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.messageVersion != .unspecified { - try visitor.visitSingularEnumField(value: self.messageVersion, fieldNumber: 1) - } - try { if let v = self._headerSignature { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - if !self.convoID.isEmpty { - try visitor.visitSingularStringField(value: self.convoID, fieldNumber: 3) - } - if !self.contentBytes.isEmpty { - try visitor.visitSingularBytesField(value: self.contentBytes, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_PadlockMessagePayload, rhs: Xmtp_V3_MessageContents_PadlockMessagePayload) -> Bool { - if lhs.messageVersion != rhs.messageVersion {return false} - if lhs._headerSignature != rhs._headerSignature {return false} - if lhs.convoID != rhs.convoID {return false} - if lhs.contentBytes != rhs.contentBytes {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_PadlockMessageEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".PadlockMessageEnvelope" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 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.decodeSingularBytesField(value: &self.ciphertext) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.headerBytes.isEmpty { - try visitor.visitSingularBytesField(value: self.headerBytes, fieldNumber: 1) - } - if !self.ciphertext.isEmpty { - try visitor.visitSingularBytesField(value: self.ciphertext, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_PadlockMessageEnvelope, rhs: Xmtp_V3_MessageContents_PadlockMessageEnvelope) -> Bool { - if lhs.headerBytes != rhs.headerBytes {return false} - if lhs.ciphertext != rhs.ciphertext {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Sources/XMTP/Proto/v3/message_contents/public_key.pb.swift b/Sources/XMTP/Proto/v3/message_contents/public_key.pb.swift deleted file mode 100644 index c38a7bf1..00000000 --- a/Sources/XMTP/Proto/v3/message_contents/public_key.pb.swift +++ /dev/null @@ -1,658 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: v3/message_contents/public_key.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -/// Structure for representing public keys of different types, -/// including signatures used to authenticate the keys. - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -/// An unsigned public key used by libxmtp -public struct Xmtp_V3_MessageContents_VmacUnsignedPublicKey { - // 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 union: Xmtp_V3_MessageContents_VmacUnsignedPublicKey.OneOf_Union? = nil - - public var curve25519: Xmtp_V3_MessageContents_VmacUnsignedPublicKey.VodozemacCurve25519 { - get { - if case .curve25519(let v)? = union {return v} - return Xmtp_V3_MessageContents_VmacUnsignedPublicKey.VodozemacCurve25519() - } - set {union = .curve25519(newValue)} - } - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public enum OneOf_Union: Equatable { - case curve25519(Xmtp_V3_MessageContents_VmacUnsignedPublicKey.VodozemacCurve25519) - - #if !swift(>=4.1) - public static func ==(lhs: Xmtp_V3_MessageContents_VmacUnsignedPublicKey.OneOf_Union, rhs: Xmtp_V3_MessageContents_VmacUnsignedPublicKey.OneOf_Union) -> 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 (.curve25519, .curve25519): return { - guard case .curve25519(let l) = lhs, case .curve25519(let r) = rhs else { preconditionFailure() } - return l == r - }() - } - } - #endif - } - - /// A Vodozemac curve25519 key serialized via serde - /// (https://github.com/matrix-org/vodozemac/blob/ - /// 929bbaf325686435bdd0ed0d0cc45b0cbad3430d/src/types/curve25519.rs#L100) - public struct VodozemacCurve25519 { - // 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 bytes: Data = Data() - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - } - - public init() {} -} - -/// A key linked to an XMTP account (e.g. signed by a wallet) -/// The purpose of the key is encoded in the signature -public struct Xmtp_V3_MessageContents_VmacAccountLinkedKey { - // 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 key: Xmtp_V3_MessageContents_VmacUnsignedPublicKey { - get {return _key ?? Xmtp_V3_MessageContents_VmacUnsignedPublicKey()} - set {_key = newValue} - } - /// Returns true if `key` has been explicitly set. - public var hasKey: Bool {return self._key != nil} - /// Clears the value of `key`. Subsequent reads from it will return its default value. - public mutating func clearKey() {self._key = nil} - - public var association: Xmtp_V3_MessageContents_VmacAccountLinkedKey.OneOf_Association? = nil - - public var eip191: Xmtp_V3_MessageContents_Eip191Association { - get { - if case .eip191(let v)? = association {return v} - return Xmtp_V3_MessageContents_Eip191Association() - } - set {association = .eip191(newValue)} - } - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public enum OneOf_Association: Equatable { - case eip191(Xmtp_V3_MessageContents_Eip191Association) - - #if !swift(>=4.1) - public static func ==(lhs: Xmtp_V3_MessageContents_VmacAccountLinkedKey.OneOf_Association, rhs: Xmtp_V3_MessageContents_VmacAccountLinkedKey.OneOf_Association) -> 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 (.eip191, .eip191): return { - guard case .eip191(let l) = lhs, case .eip191(let r) = rhs else { preconditionFailure() } - return l == r - }() - } - } - #endif - } - - public init() {} - - fileprivate var _key: Xmtp_V3_MessageContents_VmacUnsignedPublicKey? = nil -} - -/// A key linked to an installation (e.g. signed by an installation identity key) -/// The purpose of the key is encoded in the signature -public struct Xmtp_V3_MessageContents_VmacInstallationLinkedKey { - // 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 key: Xmtp_V3_MessageContents_VmacUnsignedPublicKey { - get {return _key ?? Xmtp_V3_MessageContents_VmacUnsignedPublicKey()} - set {_key = newValue} - } - /// Returns true if `key` has been explicitly set. - public var hasKey: Bool {return self._key != nil} - /// Clears the value of `key`. Subsequent reads from it will return its default value. - public mutating func clearKey() {self._key = nil} - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _key: Xmtp_V3_MessageContents_VmacUnsignedPublicKey? = nil -} - -/// A bundle of one time keys uploaded by a client, to be used as -/// input to (X)3DH exchanges with it. The server is expected to serve -/// and delete one prekey to anyone who requests one. -/// In our initial prototype we will not actually use one-time prekeys, -/// defaulting to fallback keys. -public struct Xmtp_V3_MessageContents_VmacOneTimeKeyTopupBundle { - // 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 identityKey: Xmtp_V3_MessageContents_VmacAccountLinkedKey { - get {return _identityKey ?? Xmtp_V3_MessageContents_VmacAccountLinkedKey()} - set {_identityKey = newValue} - } - /// Returns true if `identityKey` has been explicitly set. - public var hasIdentityKey: Bool {return self._identityKey != nil} - /// Clears the value of `identityKey`. Subsequent reads from it will return its default value. - public mutating func clearIdentityKey() {self._identityKey = nil} - - public var oneTimeKeys: [Xmtp_V3_MessageContents_VmacInstallationLinkedKey] = [] - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _identityKey: Xmtp_V3_MessageContents_VmacAccountLinkedKey? = nil -} - -/// A fallback key uploaded by a client, which replaces any existing -/// fallback key. The server is expected to serve this prekey when -/// all one-time prekeys have been exhausted. -/// In our initial prototype we will always use the fallback key in place -/// of any one-time prekeys. -public struct Xmtp_V3_MessageContents_VmacFallbackKeyRotation { - // 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 identityKey: Xmtp_V3_MessageContents_VmacAccountLinkedKey { - get {return _identityKey ?? Xmtp_V3_MessageContents_VmacAccountLinkedKey()} - set {_identityKey = newValue} - } - /// Returns true if `identityKey` has been explicitly set. - public var hasIdentityKey: Bool {return self._identityKey != nil} - /// Clears the value of `identityKey`. Subsequent reads from it will return its default value. - public mutating func clearIdentityKey() {self._identityKey = nil} - - public var fallbackKey: Xmtp_V3_MessageContents_VmacInstallationLinkedKey { - get {return _fallbackKey ?? Xmtp_V3_MessageContents_VmacInstallationLinkedKey()} - set {_fallbackKey = newValue} - } - /// Returns true if `fallbackKey` has been explicitly set. - public var hasFallbackKey: Bool {return self._fallbackKey != nil} - /// Clears the value of `fallbackKey`. Subsequent reads from it will return its default value. - public mutating func clearFallbackKey() {self._fallbackKey = nil} - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _identityKey: Xmtp_V3_MessageContents_VmacAccountLinkedKey? = nil - fileprivate var _fallbackKey: Xmtp_V3_MessageContents_VmacInstallationLinkedKey? = nil -} - -/// A contact bundle served by the server to a requesting client -public struct Xmtp_V3_MessageContents_VmacInstallationPublicKeyBundleV1 { - // 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 identityKey: Xmtp_V3_MessageContents_VmacAccountLinkedKey { - get {return _identityKey ?? Xmtp_V3_MessageContents_VmacAccountLinkedKey()} - set {_identityKey = newValue} - } - /// Returns true if `identityKey` has been explicitly set. - public var hasIdentityKey: Bool {return self._identityKey != nil} - /// Clears the value of `identityKey`. Subsequent reads from it will return its default value. - public mutating func clearIdentityKey() {self._identityKey = nil} - - public var fallbackKey: Xmtp_V3_MessageContents_VmacInstallationLinkedKey { - get {return _fallbackKey ?? Xmtp_V3_MessageContents_VmacInstallationLinkedKey()} - set {_fallbackKey = newValue} - } - /// Returns true if `fallbackKey` has been explicitly set. - public var hasFallbackKey: Bool {return self._fallbackKey != nil} - /// Clears the value of `fallbackKey`. Subsequent reads from it will return its default value. - public mutating func clearFallbackKey() {self._fallbackKey = nil} - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _identityKey: Xmtp_V3_MessageContents_VmacAccountLinkedKey? = nil - fileprivate var _fallbackKey: Xmtp_V3_MessageContents_VmacInstallationLinkedKey? = nil -} - -/// A wrapper for versions of the installation contact bundle to allow -/// upgradeability -public struct Xmtp_V3_MessageContents_InstallationContactBundle { - // 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_V3_MessageContents_InstallationContactBundle.OneOf_Version? = nil - - public var v1: Xmtp_V3_MessageContents_VmacInstallationPublicKeyBundleV1 { - get { - if case .v1(let v)? = version {return v} - return Xmtp_V3_MessageContents_VmacInstallationPublicKeyBundleV1() - } - set {version = .v1(newValue)} - } - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public enum OneOf_Version: Equatable { - case v1(Xmtp_V3_MessageContents_VmacInstallationPublicKeyBundleV1) - - #if !swift(>=4.1) - public static func ==(lhs: Xmtp_V3_MessageContents_InstallationContactBundle.OneOf_Version, rhs: Xmtp_V3_MessageContents_InstallationContactBundle.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() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension Xmtp_V3_MessageContents_VmacUnsignedPublicKey: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_VmacUnsignedPublicKey.OneOf_Union: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_VmacUnsignedPublicKey.VodozemacCurve25519: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_VmacAccountLinkedKey: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_VmacAccountLinkedKey.OneOf_Association: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_VmacInstallationLinkedKey: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_VmacOneTimeKeyTopupBundle: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_VmacFallbackKeyRotation: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_VmacInstallationPublicKeyBundleV1: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_InstallationContactBundle: @unchecked Sendable {} -extension Xmtp_V3_MessageContents_InstallationContactBundle.OneOf_Version: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "xmtp.v3.message_contents" - -extension Xmtp_V3_MessageContents_VmacUnsignedPublicKey: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".VmacUnsignedPublicKey" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "created_ns"), - 2: .same(proto: "curve25519"), - ] - - 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 { - var v: Xmtp_V3_MessageContents_VmacUnsignedPublicKey.VodozemacCurve25519? - var hadOneofValue = false - if let current = self.union { - hadOneofValue = true - if case .curve25519(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.union = .curve25519(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.createdNs != 0 { - try visitor.visitSingularUInt64Field(value: self.createdNs, fieldNumber: 1) - } - try { if case .curve25519(let v)? = self.union { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_VmacUnsignedPublicKey, rhs: Xmtp_V3_MessageContents_VmacUnsignedPublicKey) -> Bool { - if lhs.createdNs != rhs.createdNs {return false} - if lhs.union != rhs.union {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_VmacUnsignedPublicKey.VodozemacCurve25519: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = Xmtp_V3_MessageContents_VmacUnsignedPublicKey.protoMessageName + ".VodozemacCurve25519" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "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.decodeSingularBytesField(value: &self.bytes) }() - default: break - } - } - } - - public func traverse(visitor: inout V) throws { - if !self.bytes.isEmpty { - try visitor.visitSingularBytesField(value: self.bytes, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_VmacUnsignedPublicKey.VodozemacCurve25519, rhs: Xmtp_V3_MessageContents_VmacUnsignedPublicKey.VodozemacCurve25519) -> Bool { - if lhs.bytes != rhs.bytes {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_VmacAccountLinkedKey: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".VmacAccountLinkedKey" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "key"), - 2: .standard(proto: "eip_191"), - ] - - 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._key) }() - case 2: try { - var v: Xmtp_V3_MessageContents_Eip191Association? - var hadOneofValue = false - if let current = self.association { - hadOneofValue = true - if case .eip191(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.association = .eip191(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 let v = self._key { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if case .eip191(let v)? = self.association { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_VmacAccountLinkedKey, rhs: Xmtp_V3_MessageContents_VmacAccountLinkedKey) -> Bool { - if lhs._key != rhs._key {return false} - if lhs.association != rhs.association {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_VmacInstallationLinkedKey: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".VmacInstallationLinkedKey" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "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.decodeSingularMessageField(value: &self._key) }() - 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._key { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_VmacInstallationLinkedKey, rhs: Xmtp_V3_MessageContents_VmacInstallationLinkedKey) -> Bool { - if lhs._key != rhs._key {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_VmacOneTimeKeyTopupBundle: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".VmacOneTimeKeyTopupBundle" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "identity_key"), - 2: .standard(proto: "one_time_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.decodeSingularMessageField(value: &self._identityKey) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.oneTimeKeys) }() - 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._identityKey { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.oneTimeKeys.isEmpty { - try visitor.visitRepeatedMessageField(value: self.oneTimeKeys, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_VmacOneTimeKeyTopupBundle, rhs: Xmtp_V3_MessageContents_VmacOneTimeKeyTopupBundle) -> Bool { - if lhs._identityKey != rhs._identityKey {return false} - if lhs.oneTimeKeys != rhs.oneTimeKeys {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_VmacFallbackKeyRotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".VmacFallbackKeyRotation" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "identity_key"), - 2: .standard(proto: "fallback_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.decodeSingularMessageField(value: &self._identityKey) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._fallbackKey) }() - 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._identityKey { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if let v = self._fallbackKey { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_VmacFallbackKeyRotation, rhs: Xmtp_V3_MessageContents_VmacFallbackKeyRotation) -> Bool { - if lhs._identityKey != rhs._identityKey {return false} - if lhs._fallbackKey != rhs._fallbackKey {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_VmacInstallationPublicKeyBundleV1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".VmacInstallationPublicKeyBundleV1" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "identity_key"), - 2: .standard(proto: "fallback_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.decodeSingularMessageField(value: &self._identityKey) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._fallbackKey) }() - 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._identityKey { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if let v = self._fallbackKey { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Xmtp_V3_MessageContents_VmacInstallationPublicKeyBundleV1, rhs: Xmtp_V3_MessageContents_VmacInstallationPublicKeyBundleV1) -> Bool { - if lhs._identityKey != rhs._identityKey {return false} - if lhs._fallbackKey != rhs._fallbackKey {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Xmtp_V3_MessageContents_InstallationContactBundle: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".InstallationContactBundle" - 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_V3_MessageContents_VmacInstallationPublicKeyBundleV1? - 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_V3_MessageContents_InstallationContactBundle, rhs: Xmtp_V3_MessageContents_InstallationContactBundle) -> Bool { - if lhs.version != rhs.version {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -}