From b860dce7f95bcdb5a0f0671732060a5a079f30e5 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 6 Jun 2018 23:57:59 -0600 Subject: [PATCH 1/7] Swift protos for Envelope --- Podfile.lock | 6 +- Pods | 2 +- Signal.xcodeproj/project.pbxproj | 4 + Signal/src/Jobs/MessageFetcherJob.swift | 52 +- .../ViewControllers/DebugUI/DebugUIMessages.m | 59 +- SignalServiceKit.podspec | 9 +- SignalServiceKit/protobuf/Makefile | 11 +- .../protobuf/OWSFingerprintProtos.proto | 7 +- .../protobuf/OWSProvisioningProtos.proto | 7 +- .../protobuf/OWSSignalServiceProtos.proto | 10 +- .../protobuf/OWSSignaliOSProtos.proto | 10 +- SignalServiceKit/protobuf/README.md | 30 +- .../protobuf/WebSocketResources.proto | 10 +- .../Messages/Interactions/TSErrorMessage.h | 11 +- .../Messages/Interactions/TSErrorMessage.m | 11 +- .../TSErrorMessage_privateConstructor.h | 8 +- .../Messages/Interactions/TSQuotedMessage.h | 1 - ...SInvalidIdentityKeyReceivingErrorMessage.h | 11 +- ...SInvalidIdentityKeyReceivingErrorMessage.m | 50 +- .../src/Messages/OWSBatchMessageProcessor.h | 2 +- .../src/Messages/OWSBatchMessageProcessor.m | 41 +- .../src/Messages/OWSMessageDecrypter.h | 4 +- .../src/Messages/OWSMessageDecrypter.m | 29 +- .../src/Messages/OWSMessageHandler.h | 10 +- .../src/Messages/OWSMessageHandler.m | 17 +- .../src/Messages/OWSMessageManager.h | 4 +- .../src/Messages/OWSMessageManager.m | 61 +- .../src/Messages/OWSMessageReceiver.h | 3 +- .../src/Messages/OWSMessageReceiver.m | 40 +- .../src/Network/WebSockets/TSSocketManager.m | 5 +- .../Protos/OWSSignalServiceProtos.pb.swift | 4199 +++++++++++++++++ .../Protos/ProtoWrappers/SSKEnvelope.swift | 149 + 32 files changed, 4612 insertions(+), 261 deletions(-) create mode 100644 SignalServiceKit/src/Protos/OWSSignalServiceProtos.pb.swift create mode 100644 SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift diff --git a/Podfile.lock b/Podfile.lock index e4840b241b..c6e0f22f9a 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -60,6 +60,7 @@ PODS: - Reachability - SAMKeychain - SocketRocket + - SwiftProtobuf - YapDatabase/SQLCipher - SocketRocket (0.5.1) - SQLCipher (3.4.2): @@ -68,6 +69,7 @@ PODS: - SQLCipher/standard (3.4.2): - SQLCipher/common - SSZipArchive (2.1.2) + - SwiftProtobuf (1.0.3) - YapDatabase/SQLCipher (3.0.2): - YapDatabase/SQLCipher/Core (= 3.0.2) - YapDatabase/SQLCipher/Extensions (= 3.0.2) @@ -161,6 +163,7 @@ SPEC REPOS: - Reachability - SAMKeychain - SSZipArchive + - SwiftProtobuf - YYImage EXTERNAL SOURCES: @@ -223,10 +226,11 @@ SPEC CHECKSUMS: PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c - SignalServiceKit: eaaf6404e61fc05c71f91246327e2d487e0e1833 + SignalServiceKit: a16410721705f896905c65ad718424fa20728e7d SocketRocket: dbb1554b8fc288ef8ef370d6285aeca7361be31e SQLCipher: f9fcf29b2e59ced7defc2a2bdd0ebe79b40d4990 SSZipArchive: d4009d2ce5520a421f231fd97028cc0e2667eed8 + SwiftProtobuf: 5ccc0e4054e37c75800e5744acb2aa80bb72b39c YapDatabase: 299a32de9d350d37a9ac5b0532609d87d5d2a5de YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54 diff --git a/Pods b/Pods index 4ede6c138c..2474b814b3 160000 --- a/Pods +++ b/Pods @@ -1 +1 @@ -Subproject commit 4ede6c138ce6b5fd7279c9dcbbcece4018b03d57 +Subproject commit 2474b814b3108d9684effcdfe460c5ff42d3cbbe diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 4e0f5c13d2..67a4943a82 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -2998,6 +2998,7 @@ "${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework", "${BUILT_PRODUCTS_DIR}/SignalServiceKit/SignalServiceKit.framework", "${BUILT_PRODUCTS_DIR}/SocketRocket/SocketRocket.framework", + "${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework", "${BUILT_PRODUCTS_DIR}/YYImage/YYImage.framework", "${BUILT_PRODUCTS_DIR}/YapDatabase/YapDatabase.framework", "${BUILT_PRODUCTS_DIR}/libPhoneNumber-iOS/libPhoneNumber_iOS.framework", @@ -3021,6 +3022,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SignalServiceKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YapDatabase.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libPhoneNumber_iOS.framework", @@ -3070,6 +3072,7 @@ "${BUILT_PRODUCTS_DIR}/SQLCipher/SQLCipher.framework", "${BUILT_PRODUCTS_DIR}/SignalServiceKit/SignalServiceKit.framework", "${BUILT_PRODUCTS_DIR}/SocketRocket/SocketRocket.framework", + "${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework", "${BUILT_PRODUCTS_DIR}/YYImage/YYImage.framework", "${BUILT_PRODUCTS_DIR}/YapDatabase/YapDatabase.framework", "${BUILT_PRODUCTS_DIR}/libPhoneNumber-iOS/libPhoneNumber_iOS.framework", @@ -3091,6 +3094,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SQLCipher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SignalServiceKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YapDatabase.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libPhoneNumber_iOS.framework", diff --git a/Signal/src/Jobs/MessageFetcherJob.swift b/Signal/src/Jobs/MessageFetcherJob.swift index 37c68eba0b..8a8d45d99a 100644 --- a/Signal/src/Jobs/MessageFetcherJob.swift +++ b/Signal/src/Jobs/MessageFetcherJob.swift @@ -38,10 +38,15 @@ public class MessageFetcherJob: NSObject { Logger.info("\(self.logTag) fetching messages via REST.") - let promise = self.fetchUndeliveredMessages().then { (envelopes: [OWSSignalServiceProtosEnvelope], more: Bool) -> Promise in + let promise = self.fetchUndeliveredMessages().then { (envelopes: [SSKEnvelope], more: Bool) -> Promise in for envelope in envelopes { Logger.info("\(self.logTag) received envelope.") - self.messageReceiver.handleReceivedEnvelope(envelope) + do { + let envelopeData = try envelope.serializedData() + self.messageReceiver.handleReceivedEnvelopeData(envelopeData) + } catch { + owsFail("\(self.logTag) in \(#function) failed to serialize envelope") + } self.acknowledgeDelivery(envelope: envelope) } @@ -80,7 +85,7 @@ public class MessageFetcherJob: NSObject { timer = nil } - private func parseMessagesResponse(responseObject: Any?) -> (envelopes: [OWSSignalServiceProtosEnvelope], more: Bool)? { + private func parseMessagesResponse(responseObject: Any?) -> (envelopes: [SSKEnvelope], more: Bool)? { guard let responseObject = responseObject else { Logger.error("\(self.logTag) response object was surpringly nil") return nil @@ -113,56 +118,57 @@ public class MessageFetcherJob: NSObject { ) } - private func buildEnvelope(messageDict: [String: Any]) -> OWSSignalServiceProtosEnvelope? { - let builder = OWSSignalServiceProtosEnvelopeBuilder() + private func buildEnvelope(messageDict: [String: Any]) -> SSKEnvelope? { guard let typeInt = messageDict["type"] as? Int32 else { Logger.error("\(self.logTag) message body didn't have type") return nil } - guard let type = OWSSignalServiceProtosEnvelopeType(rawValue: typeInt) else { + guard let type: SSKEnvelope.SSKEnvelopeType = SSKEnvelope.SSKEnvelopeType(rawValue: typeInt) else { Logger.error("\(self.logTag) message body type was invalid") return nil } - builder.setType(type) guard let timestamp = messageDict["timestamp"] as? UInt64 else { Logger.error("\(self.logTag) message body didn't have timestamp") return nil } - builder.setTimestamp(timestamp) guard let source = messageDict["source"] as? String else { Logger.error("\(self.logTag) message body didn't have source") return nil } - builder.setSource(source) guard let sourceDevice = messageDict["sourceDevice"] as? UInt32 else { Logger.error("\(self.logTag) message body didn't have sourceDevice") return nil } - builder.setSourceDevice(sourceDevice) - if let encodedLegacyMessage = messageDict["message"] as? String { - Logger.debug("\(self.logTag) message body had legacyMessage") - if let legacyMessage = Data(base64Encoded: encodedLegacyMessage) { - builder.setLegacyMessage(legacyMessage) + let legacyMessage: Data? = { + if let encodedLegacyMessage = messageDict["message"] as? String { + Logger.debug("\(self.logTag) message body had legacyMessage") + if let legacyMessage = Data(base64Encoded: encodedLegacyMessage) { + return legacyMessage + } } - } + return nil + }() - if let encodedContent = messageDict["content"] as? String { - Logger.debug("\(self.logTag) message body had content") - if let content = Data(base64Encoded: encodedContent) { - builder.setContent(content) + let content: Data? = { + if let encodedContent = messageDict["content"] as? String { + Logger.debug("\(self.logTag) message body had content") + if let content = Data(base64Encoded: encodedContent) { + return content + } } - } + return nil + }() - return builder.build() + return SSKEnvelope(timestamp: timestamp, source: source, sourceDevice: sourceDevice, type: type, content: content, legacyMessage: legacyMessage) } - private func fetchUndeliveredMessages() -> Promise<(envelopes: [OWSSignalServiceProtosEnvelope], more: Bool)> { + private func fetchUndeliveredMessages() -> Promise<(envelopes: [SSKEnvelope], more: Bool)> { return Promise { fulfill, reject in let request = OWSRequestFactory.getMessagesRequest() self.networkManager.makeRequest( @@ -186,7 +192,7 @@ public class MessageFetcherJob: NSObject { } } - private func acknowledgeDelivery(envelope: OWSSignalServiceProtosEnvelope) { + private func acknowledgeDelivery(envelope: SSKEnvelope) { let request = OWSRequestFactory.acknowledgeMessageDeliveryRequest(withSource: envelope.source, timestamp: envelope.timestamp) self.networkManager.makeRequest(request, success: { (_: URLSessionDataTask?, _: Any?) -> Void in diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index 2241d9d2d8..6d9e0c7be4 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -3372,23 +3372,32 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac completion:nil]; } -+ (OWSSignalServiceProtosEnvelope *)createEnvelopeForThread:(TSThread *)thread ++ (SSKEnvelope *)createEnvelopeForThread:(TSThread *)thread { OWSAssert(thread); - OWSSignalServiceProtosEnvelopeBuilder *builder = [OWSSignalServiceProtosEnvelopeBuilder new]; + uint64_t timestamp = [NSDate ows_millisecondTimeStamp]; + NSString *source = ^{ + if ([thread isKindOfClass:[TSGroupThread class]]) { + TSGroupThread *gThread = (TSGroupThread *)thread; + return gThread.groupModel.groupMemberIds[0]; + } else if ([thread isKindOfClass:[TSContactThread class]]) { + TSContactThread *contactThread = (TSContactThread *)thread; + return contactThread.contactIdentifier; + } else { + OWSFail(@"%@ failure: unknown thread type", self.logTag); + return @"unknown-source-id"; + } + }(); - [builder setTimestamp:[NSDate ows_millisecondTimeStamp]]; + SSKEnvelope *envelope = [[SSKEnvelope alloc] initWithTimestamp:timestamp + source:source + sourceDevice:1 + type:SSKEnvelopeTypeCiphertext + content:nil + legacyMessage:nil]; - if ([thread isKindOfClass:[TSGroupThread class]]) { - TSGroupThread *gThread = (TSGroupThread *)thread; - [builder setSource:gThread.groupModel.groupMemberIds[0]]; - } else if ([thread isKindOfClass:[TSContactThread class]]) { - TSContactThread *contactThread = (TSContactThread *)thread; - [builder setSource:contactThread.contactIdentifier]; - } - - return [builder build]; + return envelope; } + (NSArray *)unsavedSystemMessagesInThread:(TSThread *)thread @@ -3542,9 +3551,6 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac withTransaction:transaction]]; [result addObject:[TSErrorMessage invalidVersionWithEnvelope:[self createEnvelopeForThread:thread] withTransaction:transaction]]; - [result addObject:[TSInvalidIdentityKeyReceivingErrorMessage - untrustedKeyWithEnvelope:[self createEnvelopeForThread:thread] - withTransaction:transaction]]; [result addObject:[TSErrorMessage corruptedMessageWithEnvelope:[self createEnvelopeForThread:thread] withTransaction:transaction]]; @@ -3871,15 +3877,22 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac recipientId = @"+12345678901"; } - OWSSignalServiceProtosEnvelopeBuilder *envelopeBuilder = [OWSSignalServiceProtosEnvelopeBuilder new]; - [envelopeBuilder setType:OWSSignalServiceProtosEnvelopeTypeCiphertext]; - [envelopeBuilder setSource:recipientId]; - [envelopeBuilder setSourceDevice:1]; - [envelopeBuilder setTimestamp:[NSDate ows_millisecondTimeStamp]]; - [envelopeBuilder setContent:plaintextData]; + uint64_t timestamp = [NSDate ows_millisecondTimeStamp]; + NSString *source = recipientId; + uint32_t sourceDevice = 1; + SSKEnvelopeType envelopeType = SSKEnvelopeTypeCiphertext; + NSData *content = plaintextData; - NSData *envelopeData = [envelopeBuilder build].data; - OWSAssert(envelopeData); + SSKEnvelope *envelope = [[SSKEnvelope alloc] initWithTimestamp:timestamp + source:source + sourceDevice:sourceDevice + type:envelopeType + content:content + legacyMessage:nil]; + + NSError *error; + NSData *_Nullable envelopeData = [envelope serializedDataAndReturnError:&error]; + OWSAssert(!error && envelopeData); [OWSPrimaryStorage.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { [[OWSBatchMessageProcessor sharedInstance] enqueueEnvelopeData:envelopeData diff --git a/SignalServiceKit.podspec b/SignalServiceKit.podspec index b4035c791b..2a8b7db6d2 100644 --- a/SignalServiceKit.podspec +++ b/SignalServiceKit.podspec @@ -49,11 +49,12 @@ An Objective-C library for communicating with the Signal messaging service. s.dependency 'GRKOpenSSLFramework' s.dependency 'SAMKeychain' s.dependency 'Reachability' + s.dependency 'SwiftProtobuf' - # Avoid PromiseKit 5/6 for now. - # From the maintainer: - # > PromiseKit 5 has been released, but is not yet fully documented, - # > so we advise sticking with version 4 for the time being. + # Avoid PromiseKit 5/6 for now. + # From the maintainer: + # > PromiseKit 5 has been released, but is not yet fully documented, + # > so we advise sticking with version 4 for the time being. s.dependency 'PromiseKit', "~> 4.0" end diff --git a/SignalServiceKit/protobuf/Makefile b/SignalServiceKit/protobuf/Makefile index bf443e24bd..484e3f406f 100644 --- a/SignalServiceKit/protobuf/Makefile +++ b/SignalServiceKit/protobuf/Makefile @@ -1,25 +1,22 @@ # See README.md in this dir for prerequisite setup. PROTOC=protoc \ - --plugin=/usr/local/bin/protoc-gen-objc \ - --proto_path="${HOME}/src/signal/protobuf-objc/src/compiler/" \ - --proto_path="${HOME}/src/signal/protobuf-objc/src/compiler/google/protobuf/" \ --proto_path='./' all: signal_service_proto provisioning_protos fingerprint_protos websocket_protos signal_service_proto: OWSSignalServiceProtos.proto - $(PROTOC) --objc_out=../src/Messages/ \ + $(PROTOC) --swift_out=../src/Protos/ \ OWSSignalServiceProtos.proto provisioning_protos: OWSProvisioningProtos.proto - $(PROTOC) --objc_out=../src/Devices/ \ + $(PROTOC) --swift_out=../src/Protos/ \ OWSProvisioningProtos.proto fingerprint_protos: OWSFingerprintProtos.proto - $(PROTOC) --objc_out=../src/Security/ \ + $(PROTOC) --swift_out=../src/Protos/ \ OWSFingerprintProtos.proto websocket_protos: WebSocketResources.proto - $(PROTOC) --objc_out=../src/Network/WebSockets/ \ + $(PROTOC) --swift_out=../src/Protos/ \ WebSocketResources.proto diff --git a/SignalServiceKit/protobuf/OWSFingerprintProtos.proto b/SignalServiceKit/protobuf/OWSFingerprintProtos.proto index b6cd3b3a59..8f82b73c6b 100644 --- a/SignalServiceKit/protobuf/OWSFingerprintProtos.proto +++ b/SignalServiceKit/protobuf/OWSFingerprintProtos.proto @@ -1,11 +1,12 @@ +// iOS - since we use a modern proto-compiler, we must specify +// the legacy proto format. +syntax = "proto2"; + package textsecure; option java_package = "org.whispersystems.libsignal.fingerprint"; option java_outer_classname = "FingerprintProtos"; -import "objectivec-descriptor.proto"; -option (google.protobuf.objectivec_file_options).class_prefix = "OWSFingerprintProtos"; - message LogicalFingerprint { optional bytes identityData = 1; // optional bytes identifier = 2; diff --git a/SignalServiceKit/protobuf/OWSProvisioningProtos.proto b/SignalServiceKit/protobuf/OWSProvisioningProtos.proto index 67ca48ca06..7e7bddd799 100644 --- a/SignalServiceKit/protobuf/OWSProvisioningProtos.proto +++ b/SignalServiceKit/protobuf/OWSProvisioningProtos.proto @@ -4,14 +4,15 @@ * Licensed according to the LICENSE file in this repository. */ +// iOS - since we use a modern proto-compiler, we must specify +// the legacy proto format. +syntax = "proto2"; + package signalservice; option java_package = "org.whispersystems.signalservice.internal.push"; option java_outer_classname = "ProvisioningProtos"; -import "objectivec-descriptor.proto"; -option (google.protobuf.objectivec_file_options).class_prefix = "OWSProvisioningProtos"; - message ProvisionEnvelope { optional bytes publicKey = 1; optional bytes body = 2; // Encrypted ProvisionMessage diff --git a/SignalServiceKit/protobuf/OWSSignalServiceProtos.proto b/SignalServiceKit/protobuf/OWSSignalServiceProtos.proto index de40d78bae..cebe5945b9 100644 --- a/SignalServiceKit/protobuf/OWSSignalServiceProtos.proto +++ b/SignalServiceKit/protobuf/OWSSignalServiceProtos.proto @@ -4,15 +4,15 @@ * Licensed according to the LICENSE file in this repository. */ -package signalservice; +// iOS - since we use a modern proto-compiler, we must specify +// the legacy proto format. +syntax = "proto2"; + +package SignalService; option java_package = "org.whispersystems.signalservice.internal.push"; option java_outer_classname = "SignalServiceProtos"; -// Signal-iOS -import "objectivec-descriptor.proto"; -option (google.protobuf.objectivec_file_options).class_prefix = "OWSSignalServiceProtos"; - message Envelope { enum Type { UNKNOWN = 0; diff --git a/SignalServiceKit/protobuf/OWSSignaliOSProtos.proto b/SignalServiceKit/protobuf/OWSSignaliOSProtos.proto index 901b598dc9..c1caee53eb 100644 --- a/SignalServiceKit/protobuf/OWSSignaliOSProtos.proto +++ b/SignalServiceKit/protobuf/OWSSignaliOSProtos.proto @@ -4,11 +4,11 @@ * Licensed according to the LICENSE file in this repository. */ -package signalios; +// iOS - since we use a modern proto-compiler, we must specify +// the legacy proto format. +syntax = "proto2"; -// Signal-iOS -import "objectivec-descriptor.proto"; -option (google.protobuf.objectivec_file_options).class_prefix = "OWSSignaliOSProtos"; +package signalios; message BackupSnapshot { @@ -26,4 +26,4 @@ message BackupSnapshot } repeated BackupEntity entity = 1; -} \ No newline at end of file +} diff --git a/SignalServiceKit/protobuf/README.md b/SignalServiceKit/protobuf/README.md index c78eb9b876..1718ff7bbc 100644 --- a/SignalServiceKit/protobuf/README.md +++ b/SignalServiceKit/protobuf/README.md @@ -1,38 +1,22 @@ # SignalServiceKit Protobufs These protobuf definitions are copied from Signal-Android, but modified -to include a conventional ObjC classnames. - -e.g. - - import "objectivec-descriptor.proto"; - option (google.protobuf.objectivec_file_options).class_prefix = "OWSFingerprintProtos"; +to match some iOS conventions. ## Prequisites -Install protobuf 2.6, the objc plugin doesn't currently work with -protobuf 3.0 +Install Apple's `swift-protobuf` (*not* the similarly named `protobuf-swift`) - brew install protobuf@2.6 - # Beware if you are depending on protobuf 3.0 elsewhere - brew link --force protobuf@2.6 + brew install swift-protobuf -Install the objc plugin to $SignalServiceKitRoot/.. +This should install an up to date protobuf package as a dependency. Note that +since we use the legacy proto2 format, we need to specify this in our .proto +files. -e.g. I have SignalServiceKit installed to ~/src/WhisperSystems/SignalServiceKit - -So I run - - cd ~/src/WhisperSystems - git clone https://github.com/alexeyxo/protobuf-objc - -Follow the install instructions at https://github.com/alexeyxo/protobuf-objc + syntax = "proto2"; ## Building Protobuf -After changes are made to any proto, generate the ObjC classes by -running: - cd ~/src/WhisperSystems/SignalServiceKit/protobuf make diff --git a/SignalServiceKit/protobuf/WebSocketResources.proto b/SignalServiceKit/protobuf/WebSocketResources.proto index ad4c135b6b..d054301a1e 100644 --- a/SignalServiceKit/protobuf/WebSocketResources.proto +++ b/SignalServiceKit/protobuf/WebSocketResources.proto @@ -4,15 +4,15 @@ * Licensed according to the LICENSE file in this repository. */ +// iOS - since we use a modern proto-compiler, we must specify +// the legacy proto format. +syntax = "proto2"; + package signalservice; option java_package = "org.whispersystems.signalservice.internal.websocket"; option java_outer_classname = "WebSocketProtos"; -// Signal-iOS -import "objectivec-descriptor.proto"; -option (google.protobuf.objectivec_file_options).class_prefix = "WebSocketResources"; - message WebSocketRequestMessage { optional string verb = 1; @@ -42,4 +42,4 @@ message WebSocketMessage optional Type type = 1; optional WebSocketRequestMessage request = 2; optional WebSocketResponseMessage response = 3; -} \ No newline at end of file +} diff --git a/SignalServiceKit/src/Messages/Interactions/TSErrorMessage.h b/SignalServiceKit/src/Messages/Interactions/TSErrorMessage.h index 040b941ef1..031101ff79 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSErrorMessage.h +++ b/SignalServiceKit/src/Messages/Interactions/TSErrorMessage.h @@ -3,11 +3,12 @@ // #import "OWSReadTracking.h" -#import "OWSSignalServiceProtos.pb.h" #import "TSMessage.h" NS_ASSUME_NONNULL_BEGIN +@class SSKEnvelope; + typedef NS_ENUM(int32_t, TSErrorMessageType) { TSErrorMessageNoSession, // DEPRECATED: We no longer create TSErrorMessageWrongTrustedIdentityKey, but @@ -54,18 +55,18 @@ typedef NS_ENUM(int32_t, TSErrorMessageType) { inThread:(nullable TSThread *)thread failedMessageType:(TSErrorMessageType)errorMessageType; -+ (instancetype)corruptedMessageWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope ++ (instancetype)corruptedMessageWithEnvelope:(SSKEnvelope *)envelope withTransaction:(YapDatabaseReadWriteTransaction *)transaction; + (instancetype)corruptedMessageInUnknownThread; -+ (instancetype)invalidVersionWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope ++ (instancetype)invalidVersionWithEnvelope:(SSKEnvelope *)envelope withTransaction:(YapDatabaseReadWriteTransaction *)transaction; -+ (instancetype)invalidKeyExceptionWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope ++ (instancetype)invalidKeyExceptionWithEnvelope:(SSKEnvelope *)envelope withTransaction:(YapDatabaseReadWriteTransaction *)transaction; -+ (instancetype)missingSessionWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope ++ (instancetype)missingSessionWithEnvelope:(SSKEnvelope *)envelope withTransaction:(YapDatabaseReadWriteTransaction *)transaction; + (instancetype)nonblockingIdentityChangeInThread:(TSThread *)thread recipientId:(NSString *)recipientId; diff --git a/SignalServiceKit/src/Messages/Interactions/TSErrorMessage.m b/SignalServiceKit/src/Messages/Interactions/TSErrorMessage.m index ccb97a143e..8613f42200 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSErrorMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/TSErrorMessage.m @@ -9,6 +9,7 @@ #import "TSContactThread.h" #import "TSErrorMessage_privateConstructor.h" #import "TextSecureKitEnv.h" +#import #import NS_ASSUME_NONNULL_BEGIN @@ -83,7 +84,7 @@ NSUInteger TSErrorMessageSchemaVersion = 1; return [self initWithTimestamp:timestamp inThread:thread failedMessageType:errorMessageType recipientId:nil]; } -- (instancetype)initWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (instancetype)initWithEnvelope:(SSKEnvelope *)envelope withTransaction:(YapDatabaseReadWriteTransaction *)transaction failedMessageType:(TSErrorMessageType)errorMessageType { @@ -145,7 +146,7 @@ NSUInteger TSErrorMessageSchemaVersion = 1; } } -+ (instancetype)corruptedMessageWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope ++ (instancetype)corruptedMessageWithEnvelope:(SSKEnvelope *)envelope withTransaction:(YapDatabaseReadWriteTransaction *)transaction { return [[self alloc] initWithEnvelope:envelope @@ -158,7 +159,7 @@ NSUInteger TSErrorMessageSchemaVersion = 1; return [[self alloc] initWithFailedMessageType:TSErrorMessageInvalidMessage]; } -+ (instancetype)invalidVersionWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope ++ (instancetype)invalidVersionWithEnvelope:(SSKEnvelope *)envelope withTransaction:(YapDatabaseReadWriteTransaction *)transaction { return [[self alloc] initWithEnvelope:envelope @@ -166,7 +167,7 @@ NSUInteger TSErrorMessageSchemaVersion = 1; failedMessageType:TSErrorMessageInvalidVersion]; } -+ (instancetype)invalidKeyExceptionWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope ++ (instancetype)invalidKeyExceptionWithEnvelope:(SSKEnvelope *)envelope withTransaction:(YapDatabaseReadWriteTransaction *)transaction { return [[self alloc] initWithEnvelope:envelope @@ -174,7 +175,7 @@ NSUInteger TSErrorMessageSchemaVersion = 1; failedMessageType:TSErrorMessageInvalidKeyException]; } -+ (instancetype)missingSessionWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope ++ (instancetype)missingSessionWithEnvelope:(SSKEnvelope *)envelope withTransaction:(YapDatabaseReadWriteTransaction *)transaction { return diff --git a/SignalServiceKit/src/Messages/Interactions/TSErrorMessage_privateConstructor.h b/SignalServiceKit/src/Messages/Interactions/TSErrorMessage_privateConstructor.h index 43ba58c217..e2336d800c 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSErrorMessage_privateConstructor.h +++ b/SignalServiceKit/src/Messages/Interactions/TSErrorMessage_privateConstructor.h @@ -1,9 +1,5 @@ // -// TSErrorMessage_privateConstructor.h -// Signal -// -// Created by Frederic Jacobs on 31/12/14. -// Copyright (c) 2014 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "TSErrorMessage.h" @@ -14,7 +10,7 @@ inThread:(TSThread *)thread failedMessageType:(TSErrorMessageType)errorMessageType NS_DESIGNATED_INITIALIZER; -@property NSData *envelopeData; +@property (atomic, nullable) NSData *envelopeData; @property NSDictionary *pendingOutgoingMessage; diff --git a/SignalServiceKit/src/Messages/Interactions/TSQuotedMessage.h b/SignalServiceKit/src/Messages/Interactions/TSQuotedMessage.h index 49d973fecb..3105c2de02 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSQuotedMessage.h +++ b/SignalServiceKit/src/Messages/Interactions/TSQuotedMessage.h @@ -8,7 +8,6 @@ NS_ASSUME_NONNULL_BEGIN @class OWSSignalServiceProtosDataMessage; -@class OWSSignalServiceProtosEnvelope; @class TSAttachment; @class TSAttachmentStream; @class TSQuotedMessage; diff --git a/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.h b/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.h index 20a33f8e3d..fd919d10c9 100644 --- a/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.h +++ b/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.h @@ -1,20 +1,15 @@ // -// TSInvalidIdentityKeyErrorMessage.h -// Signal -// -// Created by Frederic Jacobs on 31/12/14. -// Copyright (c) 2014 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "TSInvalidIdentityKeyErrorMessage.h" NS_ASSUME_NONNULL_BEGIN +// DEPRECATED - we no longer create new instances of this class (as of mid-2017); However, existing instances may +// exist, so we should keep this class around to honor their old behavior. @interface TSInvalidIdentityKeyReceivingErrorMessage : TSInvalidIdentityKeyErrorMessage -+ (instancetype)untrustedKeyWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope - withTransaction:(YapDatabaseReadWriteTransaction *)transaction; - @end NS_ASSUME_NONNULL_END diff --git a/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m b/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m index 790e612b30..5747c5d5cf 100644 --- a/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m +++ b/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m @@ -14,6 +14,7 @@ #import "TSErrorMessage_privateConstructor.h" #import #import +#import #import NS_ASSUME_NONNULL_BEGIN @@ -27,46 +28,20 @@ NS_ASSUME_NONNULL_BEGIN @implementation TSInvalidIdentityKeyReceivingErrorMessage { // Not using a property declaration in order to exclude from DB serialization - OWSSignalServiceProtosEnvelope *_envelope; + SSKEnvelope *_Nullable _envelope; } @synthesize envelopeData = _envelopeData; -+ (instancetype)untrustedKeyWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope - withTransaction:(YapDatabaseReadWriteTransaction *)transaction -{ - TSContactThread *contactThread = - [TSContactThread getOrCreateThreadWithContactId:envelope.source transaction:transaction]; - TSInvalidIdentityKeyReceivingErrorMessage *errorMessage = - [[self alloc] initForUnknownIdentityKeyWithTimestamp:envelope.timestamp - inThread:contactThread - incomingEnvelope:envelope]; - return errorMessage; -} - -- (instancetype)initForUnknownIdentityKeyWithTimestamp:(uint64_t)timestamp - inThread:(TSThread *)thread - incomingEnvelope:(OWSSignalServiceProtosEnvelope *)envelope -{ - self = [self initWithTimestamp:timestamp inThread:thread failedMessageType:TSErrorMessageWrongTrustedIdentityKey]; - if (!self) { - return self; - } - - _envelopeData = envelope.data; - _authorId = envelope.source; - - return self; -} - -- (OWSSignalServiceProtosEnvelope *)envelope +- (nullable SSKEnvelope *)envelope { if (!_envelope) { - @try { - _envelope = [OWSSignalServiceProtosEnvelope parseFromData:self.envelopeData]; - } @catch (NSException *exception) { - OWSProdLogAndFail(@"%@ Could not parse proto: %@", self.logTag, exception.debugDescription); - // TODO: Add analytics. + NSError *error; + SSKEnvelope *_Nullable envelope = [[SSKEnvelope alloc] initWithSerializedData:self.envelopeData error:&error]; + if (error || envelope == nil) { + OWSProdLogAndFail(@"%@ Could not parse proto: %@", self.logTag, error); + } else { + _envelope = envelope; } } return _envelope; @@ -94,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN [self.thread receivedMessagesForInvalidKey:newKey]; for (TSInvalidIdentityKeyReceivingErrorMessage *errorMessage in messagesToDecrypt) { - [[OWSMessageReceiver sharedInstance] handleReceivedEnvelope:errorMessage.envelope]; + [[OWSMessageReceiver sharedInstance] handleReceivedEnvelopeData:errorMessage.envelopeData]; // Here we remove the existing error message because handleReceivedEnvelope will either // 1.) succeed and create a new successful message in the thread or... @@ -110,13 +85,12 @@ NS_ASSUME_NONNULL_BEGIN return nil; } - if (self.envelope.type != OWSSignalServiceProtosEnvelopeTypePrekeyBundle) { + if (self.envelope.type != SSKEnvelopeTypePrekeyBundle) { DDLogError(@"Refusing to attempt key extraction from an envelope which isn't a prekey bundle"); return nil; } - // DEPRECATED - Remove after all clients have been upgraded. - NSData *pkwmData = self.envelope.hasContent ? self.envelope.content : self.envelope.legacyMessage; + NSData *pkwmData = self.envelope.content; if (!pkwmData) { DDLogError(@"Ignoring acceptNewIdentityKey for empty message"); return nil; diff --git a/SignalServiceKit/src/Messages/OWSBatchMessageProcessor.h b/SignalServiceKit/src/Messages/OWSBatchMessageProcessor.h index b4b3743b7f..ee533acc61 100644 --- a/SignalServiceKit/src/Messages/OWSBatchMessageProcessor.h +++ b/SignalServiceKit/src/Messages/OWSBatchMessageProcessor.h @@ -4,8 +4,8 @@ NS_ASSUME_NONNULL_BEGIN -@class OWSSignalServiceProtosEnvelope; @class OWSStorage; +@class SSKEnvelope; @class YapDatabaseReadWriteTransaction; // This class is used to write incoming (decrypted, unprocessed) diff --git a/SignalServiceKit/src/Messages/OWSBatchMessageProcessor.m b/SignalServiceKit/src/Messages/OWSBatchMessageProcessor.m index 7c875f7dc1..c74089bf0a 100644 --- a/SignalServiceKit/src/Messages/OWSBatchMessageProcessor.m +++ b/SignalServiceKit/src/Messages/OWSBatchMessageProcessor.m @@ -19,6 +19,7 @@ #import "TSYapDatabaseObject.h" #import "TextSecureKitEnv.h" #import "Threading.h" +#import #import #import #import @@ -28,8 +29,6 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Persisted data model -@class OWSSignalServiceProtosEnvelope; - @interface OWSMessageContentJob : TSYapDatabaseObject @property (nonatomic, readonly) NSDate *createdAt; @@ -40,7 +39,8 @@ NS_ASSUME_NONNULL_BEGIN plaintextData:(NSData *_Nullable)plaintextData NS_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER; - (instancetype)initWithUniqueId:(NSString *_Nullable)uniqueId NS_UNAVAILABLE; -- (OWSSignalServiceProtosEnvelope *)envelopeProto; + +@property (nonatomic, readonly, nullable) SSKEnvelope *envelope; @end @@ -74,9 +74,17 @@ NS_ASSUME_NONNULL_BEGIN return [super initWithCoder:coder]; } -- (OWSSignalServiceProtosEnvelope *)envelopeProto +- (nullable SSKEnvelope *)envelope { - return [OWSSignalServiceProtosEnvelope parseFromData:self.envelopeData]; + NSError *error; + SSKEnvelope *_Nullable result = [[SSKEnvelope alloc] initWithSerializedData:self.envelopeData error:&error]; + + if (error) { + OWSProdLogAndFail(@"%@ paring SSKEnvelope failed with error: %@", self.logTag, error); + return nil; + } + + return result; } @end @@ -378,16 +386,27 @@ NSString *const OWSMessageContentJobFinderExtensionGroup = @"OWSMessageContentJo NSMutableArray *processedJobs = [NSMutableArray new]; [self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { for (OWSMessageContentJob *job in jobs) { - @try { - [self.messagesManager processEnvelope:job.envelopeProto - plaintextData:job.plaintextData - transaction:transaction]; - } @catch (NSException *exception) { - OWSProdLogAndFail(@"%@ Received an invalid envelope: %@", self.logTag, exception.debugDescription); + + void (^reportFailure)(YapDatabaseReadWriteTransaction *transaction) = ^( + YapDatabaseReadWriteTransaction *transaction) { // TODO: Add analytics. TSErrorMessage *errorMessage = [TSErrorMessage corruptedMessageInUnknownThread]; [[TextSecureKitEnv sharedEnv].notificationsManager notifyUserForThreadlessErrorMessage:errorMessage transaction:transaction]; + }; + + @try { + SSKEnvelope *_Nullable envelope = job.envelope; + if (!envelope) { + reportFailure(transaction); + } else { + [self.messagesManager processEnvelope:envelope + plaintextData:job.plaintextData + transaction:transaction]; + } + } @catch (NSException *exception) { + OWSProdLogAndFail(@"%@ Received an invalid envelope: %@", self.logTag, exception.debugDescription); + reportFailure(transaction); } [processedJobs addObject:job]; diff --git a/SignalServiceKit/src/Messages/OWSMessageDecrypter.h b/SignalServiceKit/src/Messages/OWSMessageDecrypter.h index 494e900211..c037456e82 100644 --- a/SignalServiceKit/src/Messages/OWSMessageDecrypter.h +++ b/SignalServiceKit/src/Messages/OWSMessageDecrypter.h @@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN -@class OWSSignalServiceProtosEnvelope; +@class SSKEnvelope; @class YapDatabaseReadWriteTransaction; typedef void (^DecryptSuccessBlock)(NSData *_Nullable plaintextData, YapDatabaseReadWriteTransaction *transaction); @@ -22,7 +22,7 @@ typedef void (^DecryptFailureBlock)(void); // // Exactly one of successBlock & failureBlock will be called, // once. -- (void)decryptEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)decryptEnvelope:(SSKEnvelope *)envelope successBlock:(DecryptSuccessBlock)successBlock failureBlock:(DecryptFailureBlock)failureBlock; diff --git a/SignalServiceKit/src/Messages/OWSMessageDecrypter.m b/SignalServiceKit/src/Messages/OWSMessageDecrypter.m index 78698d0562..794d59414d 100644 --- a/SignalServiceKit/src/Messages/OWSMessageDecrypter.m +++ b/SignalServiceKit/src/Messages/OWSMessageDecrypter.m @@ -22,6 +22,7 @@ #import "TextSecureKitEnv.h" #import #import +#import NS_ASSUME_NONNULL_BEGIN @@ -80,7 +81,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Blocking -- (BOOL)isEnvelopeBlocked:(OWSSignalServiceProtosEnvelope *)envelope +- (BOOL)isEnvelopeBlocked:(SSKEnvelope *)envelope { OWSAssert(envelope); @@ -89,7 +90,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Decryption -- (void)decryptEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)decryptEnvelope:(SSKEnvelope *)envelope successBlock:(DecryptSuccessBlock)successBlockParameter failureBlock:(DecryptFailureBlock)failureBlockParameter { @@ -128,7 +129,7 @@ NS_ASSUME_NONNULL_BEGIN } switch (envelope.type) { - case OWSSignalServiceProtosEnvelopeTypeCiphertext: { + case SSKEnvelopeTypeCiphertext: { [self decryptSecureMessage:envelope successBlock:^(NSData *_Nullable plaintextData, YapDatabaseReadWriteTransaction *transaction) { DDLogDebug(@"%@ decrypted secure message.", self.logTag); @@ -145,7 +146,7 @@ NS_ASSUME_NONNULL_BEGIN // Return to avoid double-acknowledging. return; } - case OWSSignalServiceProtosEnvelopeTypePrekeyBundle: { + case SSKEnvelopeTypePrekeyBundle: { [self decryptPreKeyBundle:envelope successBlock:^(NSData *_Nullable plaintextData, YapDatabaseReadWriteTransaction *transaction) { DDLogDebug(@"%@ decrypted pre-key whisper message", self.logTag); @@ -164,9 +165,9 @@ NS_ASSUME_NONNULL_BEGIN return; } // These message types don't have a payload to decrypt. - case OWSSignalServiceProtosEnvelopeTypeReceipt: - case OWSSignalServiceProtosEnvelopeTypeKeyExchange: - case OWSSignalServiceProtosEnvelopeTypeUnknown: { + case SSKEnvelopeTypeReceipt: + case SSKEnvelopeTypeKeyExchange: + case SSKEnvelopeTypeUnknown: { [self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { successBlock(nil, transaction); }]; @@ -192,7 +193,7 @@ NS_ASSUME_NONNULL_BEGIN failureBlock(); } -- (void)decryptSecureMessage:(OWSSignalServiceProtosEnvelope *)envelope +- (void)decryptSecureMessage:(SSKEnvelope *)envelope successBlock:(DecryptSuccessBlock)successBlock failureBlock:(void (^)(NSError *_Nullable error))failureBlock { @@ -209,7 +210,7 @@ NS_ASSUME_NONNULL_BEGIN failureBlock:failureBlock]; } -- (void)decryptPreKeyBundle:(OWSSignalServiceProtosEnvelope *)envelope +- (void)decryptPreKeyBundle:(SSKEnvelope *)envelope successBlock:(DecryptSuccessBlock)successBlock failureBlock:(void (^)(NSError *_Nullable error))failureBlock { @@ -229,7 +230,7 @@ NS_ASSUME_NONNULL_BEGIN failureBlock:failureBlock]; } -- (void)decryptEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)decryptEnvelope:(SSKEnvelope *)envelope cipherTypeName:(NSString *)cipherTypeName cipherMessageBlock:(id (^_Nonnull)(NSData *))cipherMessageBlock successBlock:(DecryptSuccessBlock)successBlock @@ -245,8 +246,8 @@ NS_ASSUME_NONNULL_BEGIN NSString *recipientId = envelope.source; int deviceId = envelope.sourceDevice; - // DEPRECATED - Remove after all clients have been upgraded. - NSData *encryptedData = envelope.hasContent ? envelope.content : envelope.legacyMessage; + // DEPRECATED - Remove `legacyMessage` after all clients have been upgraded. + NSData *encryptedData = envelope.content ?: envelope.legacyMessage; if (!encryptedData) { OWSProdFail([OWSAnalyticsEvents messageManagerErrorMessageEnvelopeHasNoContent]); failureBlock(nil); @@ -278,7 +279,7 @@ NS_ASSUME_NONNULL_BEGIN }]; } -- (void)processException:(NSException *)exception envelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)processException:(NSException *)exception envelope:(SSKEnvelope *)envelope { DDLogError(@"%@ Got exception: %@ of type: %@ with reason: %@", self.logTag, @@ -325,7 +326,7 @@ NS_ASSUME_NONNULL_BEGIN } - (void)notifyUserForErrorMessage:(TSErrorMessage *)errorMessage - envelope:(OWSSignalServiceProtosEnvelope *)envelope + envelope:(SSKEnvelope *)envelope transaction:(YapDatabaseReadWriteTransaction *)transaction { TSThread *contactThread = [TSContactThread getOrCreateThreadWithContactId:envelope.source transaction:transaction]; diff --git a/SignalServiceKit/src/Messages/OWSMessageHandler.h b/SignalServiceKit/src/Messages/OWSMessageHandler.h index cb8967b5ba..588eb75870 100644 --- a/SignalServiceKit/src/Messages/OWSMessageHandler.h +++ b/SignalServiceKit/src/Messages/OWSMessageHandler.h @@ -1,19 +1,19 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // NS_ASSUME_NONNULL_BEGIN @class OWSSignalServiceProtosContent; @class OWSSignalServiceProtosDataMessage; -@class OWSSignalServiceProtosEnvelope; +@class SSKEnvelope; -NSString *envelopeAddress(OWSSignalServiceProtosEnvelope *envelope); +NSString *envelopeAddress(SSKEnvelope *envelope); @interface OWSMessageHandler : NSObject -- (NSString *)descriptionForEnvelopeType:(OWSSignalServiceProtosEnvelope *)envelope; -- (NSString *)descriptionForEnvelope:(OWSSignalServiceProtosEnvelope *)envelope; +- (NSString *)descriptionForEnvelopeType:(SSKEnvelope *)envelope; +- (NSString *)descriptionForEnvelope:(SSKEnvelope *)envelope; - (NSString *)descriptionForContent:(OWSSignalServiceProtosContent *)content; - (NSString *)descriptionForDataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage; diff --git a/SignalServiceKit/src/Messages/OWSMessageHandler.m b/SignalServiceKit/src/Messages/OWSMessageHandler.m index 0f6d603c3b..e152c05761 100644 --- a/SignalServiceKit/src/Messages/OWSMessageHandler.m +++ b/SignalServiceKit/src/Messages/OWSMessageHandler.m @@ -4,35 +4,36 @@ #import "OWSMessageHandler.h" #import "OWSSignalServiceProtos.pb.h" +#import NS_ASSUME_NONNULL_BEGIN // used in log formatting -NSString *envelopeAddress(OWSSignalServiceProtosEnvelope *envelope) +NSString *envelopeAddress(SSKEnvelope *envelope) { return [NSString stringWithFormat:@"%@.%d", envelope.source, (unsigned int)envelope.sourceDevice]; } @implementation OWSMessageHandler -- (NSString *)descriptionForEnvelopeType:(OWSSignalServiceProtosEnvelope *)envelope +- (NSString *)descriptionForEnvelopeType:(SSKEnvelope *)envelope { OWSAssert(envelope != nil); switch (envelope.type) { - case OWSSignalServiceProtosEnvelopeTypeReceipt: + case SSKEnvelopeTypeReceipt: return @"DeliveryReceipt"; - case OWSSignalServiceProtosEnvelopeTypeUnknown: + case SSKEnvelopeTypeUnknown: // Shouldn't happen OWSProdFail([OWSAnalyticsEvents messageManagerErrorEnvelopeTypeUnknown]); return @"Unknown"; - case OWSSignalServiceProtosEnvelopeTypeCiphertext: + case SSKEnvelopeTypeCiphertext: return @"SignalEncryptedMessage"; - case OWSSignalServiceProtosEnvelopeTypeKeyExchange: + case SSKEnvelopeTypeKeyExchange: // Unsupported OWSProdFail([OWSAnalyticsEvents messageManagerErrorEnvelopeTypeKeyExchange]); return @"KeyExchange"; - case OWSSignalServiceProtosEnvelopeTypePrekeyBundle: + case SSKEnvelopeTypePrekeyBundle: return @"PreKeyEncryptedMessage"; default: // Shouldn't happen @@ -41,7 +42,7 @@ NSString *envelopeAddress(OWSSignalServiceProtosEnvelope *envelope) } } -- (NSString *)descriptionForEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (NSString *)descriptionForEnvelope:(SSKEnvelope *)envelope { OWSAssert(envelope != nil); diff --git a/SignalServiceKit/src/Messages/OWSMessageManager.h b/SignalServiceKit/src/Messages/OWSMessageManager.h index 723d04dd96..18b386a7b4 100644 --- a/SignalServiceKit/src/Messages/OWSMessageManager.h +++ b/SignalServiceKit/src/Messages/OWSMessageManager.h @@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN -@class OWSSignalServiceProtosEnvelope; +@class SSKEnvelope; @class TSThread; @class YapDatabaseReadWriteTransaction; @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN + (instancetype)sharedManager; // processEnvelope: can be called from any thread. -- (void)processEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)processEnvelope:(SSKEnvelope *)envelope plaintextData:(NSData *_Nullable)plaintextData transaction:(YapDatabaseReadWriteTransaction *)transaction; diff --git a/SignalServiceKit/src/Messages/OWSMessageManager.m b/SignalServiceKit/src/Messages/OWSMessageManager.m index 47989a9cdb..09db8cdc94 100644 --- a/SignalServiceKit/src/Messages/OWSMessageManager.m +++ b/SignalServiceKit/src/Messages/OWSMessageManager.m @@ -47,6 +47,7 @@ #import "TSOutgoingMessage.h" #import "TSQuotedMessage.h" #import "TextSecureKitEnv.h" +#import #import NS_ASSUME_NONNULL_BEGIN @@ -157,7 +158,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Blocking -- (BOOL)isEnvelopeBlocked:(OWSSignalServiceProtosEnvelope *)envelope +- (BOOL)isEnvelopeBlocked:(SSKEnvelope *)envelope { OWSAssert(envelope); @@ -166,7 +167,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - message handling -- (void)processEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)processEnvelope:(SSKEnvelope *)envelope plaintextData:(NSData *_Nullable)plaintextData transaction:(YapDatabaseReadWriteTransaction *)transaction { @@ -188,8 +189,8 @@ NS_ASSUME_NONNULL_BEGIN OWSAssert(![self isEnvelopeBlocked:envelope]); switch (envelope.type) { - case OWSSignalServiceProtosEnvelopeTypeCiphertext: - case OWSSignalServiceProtosEnvelopeTypePrekeyBundle: + case SSKEnvelopeTypeCiphertext: + case SSKEnvelopeTypePrekeyBundle: if (plaintextData) { [self handleEnvelope:envelope plaintextData:plaintextData transaction:transaction]; } else { @@ -197,15 +198,15 @@ NS_ASSUME_NONNULL_BEGIN @"%@ missing decrypted data for envelope: %@", self.logTag, [self descriptionForEnvelope:envelope]); } break; - case OWSSignalServiceProtosEnvelopeTypeReceipt: + case SSKEnvelopeTypeReceipt: OWSAssert(!plaintextData); [self handleDeliveryReceipt:envelope transaction:transaction]; break; // Other messages are just dismissed for now. - case OWSSignalServiceProtosEnvelopeTypeKeyExchange: + case SSKEnvelopeTypeKeyExchange: DDLogWarn(@"Received Key Exchange Message, not supported"); break; - case OWSSignalServiceProtosEnvelopeTypeUnknown: + case SSKEnvelopeTypeUnknown: DDLogWarn(@"Received an unknown message type"); break; default: @@ -214,7 +215,7 @@ NS_ASSUME_NONNULL_BEGIN } } -- (void)handleDeliveryReceipt:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleDeliveryReceipt:(SSKEnvelope *)envelope transaction:(YapDatabaseReadWriteTransaction *)transaction { OWSAssert(envelope); @@ -271,16 +272,16 @@ NS_ASSUME_NONNULL_BEGIN } } -- (void)handleEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleEnvelope:(SSKEnvelope *)envelope plaintextData:(NSData *)plaintextData transaction:(YapDatabaseReadWriteTransaction *)transaction { OWSAssert(envelope); OWSAssert(plaintextData); OWSAssert(transaction); - OWSAssert(envelope.hasTimestamp && envelope.timestamp > 0); - OWSAssert(envelope.hasSource && envelope.source.length > 0); - OWSAssert(envelope.hasSourceDevice && envelope.sourceDevice > 0); + OWSAssert(envelope.timestamp > 0); + OWSAssert(envelope.source.length > 0); + OWSAssert(envelope.sourceDevice > 0); BOOL duplicateEnvelope = [self.incomingMessageFinder existsMessageWithTimestamp:envelope.timestamp sourceId:envelope.source @@ -294,7 +295,7 @@ NS_ASSUME_NONNULL_BEGIN return; } - if (envelope.hasContent) { + if (envelope.content != nil) { OWSSignalServiceProtosContent *content = [OWSSignalServiceProtosContent parseFromData:plaintextData]; DDLogInfo(@"%@ handling content: ", self.logTag, [self descriptionForContent:content]); @@ -313,7 +314,7 @@ NS_ASSUME_NONNULL_BEGIN } else { DDLogWarn(@"%@ Ignoring envelope. Content with no known payload", self.logTag); } - } else if (envelope.hasLegacyMessage) { // DEPRECATED - Remove after all clients have been upgraded. + } else if (envelope.legacyMessage != nil) { // DEPRECATED - Remove after all clients have been upgraded. OWSSignalServiceProtosDataMessage *dataMessage = [OWSSignalServiceProtosDataMessage parseFromData:plaintextData]; DDLogInfo( @@ -321,11 +322,11 @@ NS_ASSUME_NONNULL_BEGIN [self handleIncomingEnvelope:envelope withDataMessage:dataMessage transaction:transaction]; } else { - OWSProdInfoWEnvelope([OWSAnalyticsEvents messageManagerErrorEnvelopeNoActionablePayload], envelope); + DDLogWarn(@"%@ Ignoring envelope with neither Content nor LegacyMessage", self.logTag); } } -- (void)handleIncomingEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleIncomingEnvelope:(SSKEnvelope *)envelope withDataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage transaction:(YapDatabaseReadWriteTransaction *)transaction { @@ -394,7 +395,7 @@ NS_ASSUME_NONNULL_BEGIN } - (void)sendGroupInfoRequest:(NSData *)groupId - envelope:(OWSSignalServiceProtosEnvelope *)envelope + envelope:(SSKEnvelope *)envelope transaction:(YapDatabaseReadWriteTransaction *)transaction { OWSAssert(groupId.length > 0); @@ -428,7 +429,7 @@ NS_ASSUME_NONNULL_BEGIN return [TextSecureKitEnv sharedEnv].profileManager; } -- (void)handleIncomingEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleIncomingEnvelope:(SSKEnvelope *)envelope withReceiptMessage:(OWSSignalServiceProtosReceiptMessage *)receiptMessage transaction:(YapDatabaseReadWriteTransaction *)transaction { @@ -463,7 +464,7 @@ NS_ASSUME_NONNULL_BEGIN } } -- (void)handleIncomingEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleIncomingEnvelope:(SSKEnvelope *)envelope withCallMessage:(OWSSignalServiceProtosCallMessage *)callMessage { OWSAssert(envelope); @@ -498,7 +499,7 @@ NS_ASSUME_NONNULL_BEGIN }); } -- (void)handleReceivedGroupAvatarUpdateWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleReceivedGroupAvatarUpdateWithEnvelope:(SSKEnvelope *)envelope dataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage transaction:(YapDatabaseReadWriteTransaction *)transaction { @@ -536,7 +537,7 @@ NS_ASSUME_NONNULL_BEGIN }]; } -- (void)handleReceivedMediaWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleReceivedMediaWithEnvelope:(SSKEnvelope *)envelope dataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage transaction:(YapDatabaseReadWriteTransaction *)transaction { @@ -584,7 +585,7 @@ NS_ASSUME_NONNULL_BEGIN }]; } -- (void)handleIncomingEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleIncomingEnvelope:(SSKEnvelope *)envelope withSyncMessage:(OWSSignalServiceProtosSyncMessage *)syncMessage transaction:(YapDatabaseReadWriteTransaction *)transaction { @@ -719,7 +720,7 @@ NS_ASSUME_NONNULL_BEGIN } } -- (void)handleEndSessionMessageWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleEndSessionMessageWithEnvelope:(SSKEnvelope *)envelope dataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage transaction:(YapDatabaseReadWriteTransaction *)transaction { @@ -736,7 +737,7 @@ NS_ASSUME_NONNULL_BEGIN [self.primaryStorage deleteAllSessionsForContact:envelope.source protocolContext:transaction]; } -- (void)handleExpirationTimerUpdateMessageWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleExpirationTimerUpdateMessageWithEnvelope:(SSKEnvelope *)envelope dataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage transaction:(YapDatabaseReadWriteTransaction *)transaction { @@ -779,7 +780,7 @@ NS_ASSUME_NONNULL_BEGIN [message saveWithTransaction:transaction]; } -- (void)handleProfileKeyMessageWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleProfileKeyMessageWithEnvelope:(SSKEnvelope *)envelope dataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage { OWSAssert(envelope); @@ -804,7 +805,7 @@ NS_ASSUME_NONNULL_BEGIN [profileManager setProfileKeyData:profileKey forRecipientId:recipientId]; } -- (void)handleReceivedTextMessageWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleReceivedTextMessageWithEnvelope:(SSKEnvelope *)envelope dataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage transaction:(YapDatabaseReadWriteTransaction *)transaction { @@ -845,7 +846,7 @@ NS_ASSUME_NONNULL_BEGIN } } -- (void)handleGroupInfoRequest:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleGroupInfoRequest:(SSKEnvelope *)envelope dataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage transaction:(YapDatabaseReadWriteTransaction *)transaction { @@ -901,7 +902,7 @@ NS_ASSUME_NONNULL_BEGIN [self sendGroupUpdateForThread:gThread message:message]; } -- (TSIncomingMessage *_Nullable)handleReceivedEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (TSIncomingMessage *_Nullable)handleReceivedEnvelope:(SSKEnvelope *)envelope withDataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage attachmentIds:(NSArray *)attachmentIds transaction:(YapDatabaseReadWriteTransaction *)transaction @@ -1083,7 +1084,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)finalizeIncomingMessage:(TSIncomingMessage *)incomingMessage thread:(TSThread *)thread - envelope:(OWSSignalServiceProtosEnvelope *)envelope + envelope:(SSKEnvelope *)envelope transaction:(YapDatabaseReadWriteTransaction *)transaction { OWSAssert(thread); @@ -1203,7 +1204,7 @@ NS_ASSUME_NONNULL_BEGIN * Group or Contact thread for message, creating a new contact thread if necessary, * but never creating a new group thread. */ -- (nullable TSThread *)threadForEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (nullable TSThread *)threadForEnvelope:(SSKEnvelope *)envelope dataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage transaction:(YapDatabaseReadWriteTransaction *)transaction { diff --git a/SignalServiceKit/src/Messages/OWSMessageReceiver.h b/SignalServiceKit/src/Messages/OWSMessageReceiver.h index ad7a0d957a..a68f55bfe5 100644 --- a/SignalServiceKit/src/Messages/OWSMessageReceiver.h +++ b/SignalServiceKit/src/Messages/OWSMessageReceiver.h @@ -4,7 +4,6 @@ NS_ASSUME_NONNULL_BEGIN -@class OWSSignalServiceProtosEnvelope; @class OWSStorage; // This class is used to write incoming (encrypted, unprocessed) @@ -18,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *)databaseExtensionName; + (void)asyncRegisterDatabaseExtension:(OWSStorage *)storage; -- (void)handleReceivedEnvelope:(OWSSignalServiceProtosEnvelope *)envelope; +- (void)handleReceivedEnvelopeData:(NSData *)envelopeData; - (void)handleAnyUnprocessedEnvelopesAsync; @end diff --git a/SignalServiceKit/src/Messages/OWSMessageReceiver.m b/SignalServiceKit/src/Messages/OWSMessageReceiver.m index 0d4bfbaaad..fae06d88d7 100644 --- a/SignalServiceKit/src/Messages/OWSMessageReceiver.m +++ b/SignalServiceKit/src/Messages/OWSMessageReceiver.m @@ -19,6 +19,7 @@ #import "TSYapDatabaseObject.h" #import "TextSecureKitEnv.h" #import "Threading.h" +#import #import #import #import @@ -30,11 +31,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) NSDate *createdAt; @property (nonatomic, readonly) NSData *envelopeData; +@property (nonatomic, readonly, nullable) SSKEnvelope *envelopeProto; -- (instancetype)initWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithEnvelopeData:(NSData *)envelopeData NS_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER; - (instancetype)initWithUniqueId:(NSString *_Nullable)uniqueId NS_UNAVAILABLE; -- (OWSSignalServiceProtosEnvelope *)envelopeProto; @end @@ -47,16 +48,16 @@ NS_ASSUME_NONNULL_BEGIN return @"OWSMessageProcessingJob"; } -- (instancetype)initWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (instancetype)initWithEnvelopeData:(NSData *)envelopeData { - OWSAssert(envelope); + OWSAssert(envelopeData); self = [super initWithUniqueId:[NSUUID new].UUIDString]; if (!self) { return self; } - _envelopeData = envelope.data; + _envelopeData = envelopeData; _createdAt = [NSDate new]; return self; @@ -67,9 +68,16 @@ NS_ASSUME_NONNULL_BEGIN return [super initWithCoder:coder]; } -- (OWSSignalServiceProtosEnvelope *)envelopeProto +- (nullable SSKEnvelope *)envelopeProto { - return [OWSSignalServiceProtosEnvelope parseFromData:self.envelopeData]; + NSError *error; + SSKEnvelope *_Nullable envelope = [[SSKEnvelope alloc] initWithSerializedData:self.envelopeData error:&error]; + if (error || envelope == nil) { + OWSFail(@"%@ failed to parase envelope with error: %@", self.logTag, error); + return nil; + } + + return envelope; } @end @@ -123,10 +131,10 @@ NSString *const OWSMessageDecryptJobFinderExtensionGroup = @"OWSMessageProcessin return job; } -- (void)addJobForEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)addJobForEnvelopeData:(NSData *)envelopeData { [self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { - OWSMessageDecryptJob *job = [[OWSMessageDecryptJob alloc] initWithEnvelope:envelope]; + OWSMessageDecryptJob *job = [[OWSMessageDecryptJob alloc] initWithEnvelopeData:envelopeData]; [job saveWithTransaction:transaction]; }]; } @@ -265,9 +273,9 @@ NSString *const OWSMessageDecryptJobFinderExtensionGroup = @"OWSMessageProcessin return queue; } -- (void)enqueueEnvelopeForProcessing:(OWSSignalServiceProtosEnvelope *)envelope +- (void)enqueueEnvelopeData:(NSData *)envelopeData { - [self.finder addJobForEnvelope:envelope]; + [self.finder addJobForEnvelopeData:envelopeData]; } - (void)drainQueue @@ -319,7 +327,7 @@ NSString *const OWSMessageDecryptJobFinderExtensionGroup = @"OWSMessageProcessin AssertOnDispatchQueue(self.serialQueue); OWSAssert(job); - OWSSignalServiceProtosEnvelope *_Nullable envelope = nil; + SSKEnvelope *_Nullable envelope = nil; @try { envelope = job.envelopeProto; } @catch (NSException *exception) { @@ -441,11 +449,11 @@ NSString *const OWSMessageDecryptJobFinderExtensionGroup = @"OWSMessageProcessin [self.processingQueue drainQueue]; } -- (void)handleReceivedEnvelope:(OWSSignalServiceProtosEnvelope *)envelope +- (void)handleReceivedEnvelopeData:(NSData *)envelopeData { // Drop any too-large messages on the floor. Well behaving clients should never send them. NSUInteger kMaxEnvelopeByteCount = 250 * 1024; - if (envelope.serializedSize > kMaxEnvelopeByteCount) { + if (envelopeData.length > kMaxEnvelopeByteCount) { OWSProdError([OWSAnalyticsEvents messageReceiverErrorOversizeMessage]); return; } @@ -453,11 +461,11 @@ NSString *const OWSMessageDecryptJobFinderExtensionGroup = @"OWSMessageProcessin // Take note of any messages larger than we expect, but still process them. // This likely indicates a misbehaving sending client. NSUInteger kLargeEnvelopeWarningByteCount = 25 * 1024; - if (envelope.serializedSize > kLargeEnvelopeWarningByteCount) { + if (envelopeData.length > kLargeEnvelopeWarningByteCount) { OWSProdError([OWSAnalyticsEvents messageReceiverErrorLargeMessage]); } - [self.processingQueue enqueueEnvelopeForProcessing:envelope]; + [self.processingQueue enqueueEnvelopeData:envelopeData]; [self.processingQueue drainQueue]; } diff --git a/SignalServiceKit/src/Network/WebSockets/TSSocketManager.m b/SignalServiceKit/src/Network/WebSockets/TSSocketManager.m index c3310d1303..123354af66 100644 --- a/SignalServiceKit/src/Network/WebSockets/TSSocketManager.m +++ b/SignalServiceKit/src/Network/WebSockets/TSSocketManager.m @@ -747,10 +747,7 @@ NSString *const kNSNotification_SocketManagerStateDidChange = @"kNSNotification_ return; } - OWSSignalServiceProtosEnvelope *envelope = - [OWSSignalServiceProtosEnvelope parseFromData:decryptedPayload]; - - [self.messageReceiver handleReceivedEnvelope:envelope]; + [self.messageReceiver handleReceivedEnvelopeData:decryptedPayload]; } @catch (NSException *exception) { OWSProdLogAndFail(@"%@ Received an invalid envelope: %@", self.logTag, exception.debugDescription); // TODO: Add analytics. diff --git a/SignalServiceKit/src/Protos/OWSSignalServiceProtos.pb.swift b/SignalServiceKit/src/Protos/OWSSignalServiceProtos.pb.swift new file mode 100644 index 0000000000..f5c5cefdb7 --- /dev/null +++ b/SignalServiceKit/src/Protos/OWSSignalServiceProtos.pb.swift @@ -0,0 +1,4199 @@ +// DO NOT EDIT. +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: OWSSignalServiceProtos.proto +// +// For information on using the generated types, please see the documenation: +// https://github.com/apple/swift-protobuf/ + +//* +// Copyright (C) 2014-2016 Open Whisper Systems +// +// Licensed according to the LICENSE file in this repository. + +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 your 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 +} + +struct SignalService_Envelope { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: SignalService_Envelope.TypeEnum { + get {return _type ?? .unknown} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var source: String { + get {return _source ?? String()} + set {_source = newValue} + } + /// Returns true if `source` has been explicitly set. + var hasSource: Bool {return self._source != nil} + /// Clears the value of `source`. Subsequent reads from it will return its default value. + mutating func clearSource() {self._source = nil} + + var sourceDevice: UInt32 { + get {return _sourceDevice ?? 0} + set {_sourceDevice = newValue} + } + /// Returns true if `sourceDevice` has been explicitly set. + var hasSourceDevice: Bool {return self._sourceDevice != nil} + /// Clears the value of `sourceDevice`. Subsequent reads from it will return its default value. + mutating func clearSourceDevice() {self._sourceDevice = nil} + + var relay: String { + get {return _relay ?? String()} + set {_relay = newValue} + } + /// Returns true if `relay` has been explicitly set. + var hasRelay: Bool {return self._relay != nil} + /// Clears the value of `relay`. Subsequent reads from it will return its default value. + mutating func clearRelay() {self._relay = nil} + + var timestamp: UInt64 { + get {return _timestamp ?? 0} + set {_timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return self._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {self._timestamp = nil} + + /// Contains an encrypted DataMessage + var legacyMessage: Data { + get {return _legacyMessage ?? SwiftProtobuf.Internal.emptyData} + set {_legacyMessage = newValue} + } + /// Returns true if `legacyMessage` has been explicitly set. + var hasLegacyMessage: Bool {return self._legacyMessage != nil} + /// Clears the value of `legacyMessage`. Subsequent reads from it will return its default value. + mutating func clearLegacyMessage() {self._legacyMessage = nil} + + /// Contains an encrypted Content + var content: Data { + get {return _content ?? SwiftProtobuf.Internal.emptyData} + set {_content = newValue} + } + /// Returns true if `content` has been explicitly set. + var hasContent: Bool {return self._content != nil} + /// Clears the value of `content`. Subsequent reads from it will return its default value. + mutating func clearContent() {self._content = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case ciphertext // = 1 + case keyExchange // = 2 + case prekeyBundle // = 3 + case receipt // = 5 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .ciphertext + case 2: self = .keyExchange + case 3: self = .prekeyBundle + case 5: self = .receipt + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .ciphertext: return 1 + case .keyExchange: return 2 + case .prekeyBundle: return 3 + case .receipt: return 5 + } + } + + } + + init() {} + + fileprivate var _type: SignalService_Envelope.TypeEnum? = nil + fileprivate var _source: String? = nil + fileprivate var _sourceDevice: UInt32? = nil + fileprivate var _relay: String? = nil + fileprivate var _timestamp: UInt64? = nil + fileprivate var _legacyMessage: Data? = nil + fileprivate var _content: Data? = nil +} + +struct SignalService_Content { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var dataMessage: SignalService_DataMessage { + get {return _storage._dataMessage ?? SignalService_DataMessage()} + set {_uniqueStorage()._dataMessage = newValue} + } + /// Returns true if `dataMessage` has been explicitly set. + var hasDataMessage: Bool {return _storage._dataMessage != nil} + /// Clears the value of `dataMessage`. Subsequent reads from it will return its default value. + mutating func clearDataMessage() {_storage._dataMessage = nil} + + var syncMessage: SignalService_SyncMessage { + get {return _storage._syncMessage ?? SignalService_SyncMessage()} + set {_uniqueStorage()._syncMessage = newValue} + } + /// Returns true if `syncMessage` has been explicitly set. + var hasSyncMessage: Bool {return _storage._syncMessage != nil} + /// Clears the value of `syncMessage`. Subsequent reads from it will return its default value. + mutating func clearSyncMessage() {_storage._syncMessage = nil} + + var callMessage: SignalService_CallMessage { + get {return _storage._callMessage ?? SignalService_CallMessage()} + set {_uniqueStorage()._callMessage = newValue} + } + /// Returns true if `callMessage` has been explicitly set. + var hasCallMessage: Bool {return _storage._callMessage != nil} + /// Clears the value of `callMessage`. Subsequent reads from it will return its default value. + mutating func clearCallMessage() {_storage._callMessage = nil} + + var nullMessage: SignalService_NullMessage { + get {return _storage._nullMessage ?? SignalService_NullMessage()} + set {_uniqueStorage()._nullMessage = newValue} + } + /// Returns true if `nullMessage` has been explicitly set. + var hasNullMessage: Bool {return _storage._nullMessage != nil} + /// Clears the value of `nullMessage`. Subsequent reads from it will return its default value. + mutating func clearNullMessage() {_storage._nullMessage = nil} + + var receiptMessage: SignalService_ReceiptMessage { + get {return _storage._receiptMessage ?? SignalService_ReceiptMessage()} + set {_uniqueStorage()._receiptMessage = newValue} + } + /// Returns true if `receiptMessage` has been explicitly set. + var hasReceiptMessage: Bool {return _storage._receiptMessage != nil} + /// Clears the value of `receiptMessage`. Subsequent reads from it will return its default value. + mutating func clearReceiptMessage() {_storage._receiptMessage = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct SignalService_CallMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var offer: SignalService_CallMessage.Offer { + get {return _storage._offer ?? SignalService_CallMessage.Offer()} + set {_uniqueStorage()._offer = newValue} + } + /// Returns true if `offer` has been explicitly set. + var hasOffer: Bool {return _storage._offer != nil} + /// Clears the value of `offer`. Subsequent reads from it will return its default value. + mutating func clearOffer() {_storage._offer = nil} + + var answer: SignalService_CallMessage.Answer { + get {return _storage._answer ?? SignalService_CallMessage.Answer()} + set {_uniqueStorage()._answer = newValue} + } + /// Returns true if `answer` has been explicitly set. + var hasAnswer: Bool {return _storage._answer != nil} + /// Clears the value of `answer`. Subsequent reads from it will return its default value. + mutating func clearAnswer() {_storage._answer = nil} + + var iceUpdate: [SignalService_CallMessage.IceUpdate] { + get {return _storage._iceUpdate} + set {_uniqueStorage()._iceUpdate = newValue} + } + + var hangup: SignalService_CallMessage.Hangup { + get {return _storage._hangup ?? SignalService_CallMessage.Hangup()} + set {_uniqueStorage()._hangup = newValue} + } + /// Returns true if `hangup` has been explicitly set. + var hasHangup: Bool {return _storage._hangup != nil} + /// Clears the value of `hangup`. Subsequent reads from it will return its default value. + mutating func clearHangup() {_storage._hangup = nil} + + var busy: SignalService_CallMessage.Busy { + get {return _storage._busy ?? SignalService_CallMessage.Busy()} + set {_uniqueStorage()._busy = newValue} + } + /// Returns true if `busy` has been explicitly set. + var hasBusy: Bool {return _storage._busy != nil} + /// Clears the value of `busy`. Subsequent reads from it will return its default value. + mutating func clearBusy() {_storage._busy = nil} + + /// Signal-iOS sends profile key with call messages + /// for earlier discovery + var profileKey: Data { + get {return _storage._profileKey ?? SwiftProtobuf.Internal.emptyData} + set {_uniqueStorage()._profileKey = newValue} + } + /// Returns true if `profileKey` has been explicitly set. + var hasProfileKey: Bool {return _storage._profileKey != nil} + /// Clears the value of `profileKey`. Subsequent reads from it will return its default value. + mutating func clearProfileKey() {_storage._profileKey = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Offer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + /// Signal-iOS renamed the description field to avoid + /// conflicts with [NSObject description]. + var sessionDescription: String { + get {return _sessionDescription ?? String()} + set {_sessionDescription = newValue} + } + /// Returns true if `sessionDescription` has been explicitly set. + var hasSessionDescription: Bool {return self._sessionDescription != nil} + /// Clears the value of `sessionDescription`. Subsequent reads from it will return its default value. + mutating func clearSessionDescription() {self._sessionDescription = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: UInt64? = nil + fileprivate var _sessionDescription: String? = nil + } + + struct Answer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + /// Signal-iOS renamed the description field to avoid + /// conflicts with [NSObject description]. + var sessionDescription: String { + get {return _sessionDescription ?? String()} + set {_sessionDescription = newValue} + } + /// Returns true if `sessionDescription` has been explicitly set. + var hasSessionDescription: Bool {return self._sessionDescription != nil} + /// Clears the value of `sessionDescription`. Subsequent reads from it will return its default value. + mutating func clearSessionDescription() {self._sessionDescription = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: UInt64? = nil + fileprivate var _sessionDescription: String? = nil + } + + struct IceUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var sdpMid: String { + get {return _sdpMid ?? String()} + set {_sdpMid = newValue} + } + /// Returns true if `sdpMid` has been explicitly set. + var hasSdpMid: Bool {return self._sdpMid != nil} + /// Clears the value of `sdpMid`. Subsequent reads from it will return its default value. + mutating func clearSdpMid() {self._sdpMid = nil} + + var sdpMlineIndex: UInt32 { + get {return _sdpMlineIndex ?? 0} + set {_sdpMlineIndex = newValue} + } + /// Returns true if `sdpMlineIndex` has been explicitly set. + var hasSdpMlineIndex: Bool {return self._sdpMlineIndex != nil} + /// Clears the value of `sdpMlineIndex`. Subsequent reads from it will return its default value. + mutating func clearSdpMlineIndex() {self._sdpMlineIndex = nil} + + var sdp: String { + get {return _sdp ?? String()} + set {_sdp = newValue} + } + /// Returns true if `sdp` has been explicitly set. + var hasSdp: Bool {return self._sdp != nil} + /// Clears the value of `sdp`. Subsequent reads from it will return its default value. + mutating func clearSdp() {self._sdp = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: UInt64? = nil + fileprivate var _sdpMid: String? = nil + fileprivate var _sdpMlineIndex: UInt32? = nil + fileprivate var _sdp: String? = nil + } + + struct Busy { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: UInt64? = nil + } + + struct Hangup { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: UInt64? = nil + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct SignalService_DataMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var body: String { + get {return _storage._body ?? String()} + set {_uniqueStorage()._body = newValue} + } + /// Returns true if `body` has been explicitly set. + var hasBody: Bool {return _storage._body != nil} + /// Clears the value of `body`. Subsequent reads from it will return its default value. + mutating func clearBody() {_storage._body = nil} + + var attachments: [SignalService_AttachmentPointer] { + get {return _storage._attachments} + set {_uniqueStorage()._attachments = newValue} + } + + var group: SignalService_GroupContext { + get {return _storage._group ?? SignalService_GroupContext()} + set {_uniqueStorage()._group = newValue} + } + /// Returns true if `group` has been explicitly set. + var hasGroup: Bool {return _storage._group != nil} + /// Clears the value of `group`. Subsequent reads from it will return its default value. + mutating func clearGroup() {_storage._group = nil} + + var flags: UInt32 { + get {return _storage._flags ?? 0} + set {_uniqueStorage()._flags = newValue} + } + /// Returns true if `flags` has been explicitly set. + var hasFlags: Bool {return _storage._flags != nil} + /// Clears the value of `flags`. Subsequent reads from it will return its default value. + mutating func clearFlags() {_storage._flags = nil} + + var expireTimer: UInt32 { + get {return _storage._expireTimer ?? 0} + set {_uniqueStorage()._expireTimer = newValue} + } + /// Returns true if `expireTimer` has been explicitly set. + var hasExpireTimer: Bool {return _storage._expireTimer != nil} + /// Clears the value of `expireTimer`. Subsequent reads from it will return its default value. + mutating func clearExpireTimer() {_storage._expireTimer = nil} + + var profileKey: Data { + get {return _storage._profileKey ?? SwiftProtobuf.Internal.emptyData} + set {_uniqueStorage()._profileKey = newValue} + } + /// Returns true if `profileKey` has been explicitly set. + var hasProfileKey: Bool {return _storage._profileKey != nil} + /// Clears the value of `profileKey`. Subsequent reads from it will return its default value. + mutating func clearProfileKey() {_storage._profileKey = nil} + + var timestamp: UInt64 { + get {return _storage._timestamp ?? 0} + set {_uniqueStorage()._timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return _storage._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {_storage._timestamp = nil} + + var quote: SignalService_DataMessage.Quote { + get {return _storage._quote ?? SignalService_DataMessage.Quote()} + set {_uniqueStorage()._quote = newValue} + } + /// Returns true if `quote` has been explicitly set. + var hasQuote: Bool {return _storage._quote != nil} + /// Clears the value of `quote`. Subsequent reads from it will return its default value. + mutating func clearQuote() {_storage._quote = nil} + + var contact: [SignalService_DataMessage.Contact] { + get {return _storage._contact} + set {_uniqueStorage()._contact = newValue} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Flags: SwiftProtobuf.Enum { + typealias RawValue = Int + case endSession // = 1 + case expirationTimerUpdate // = 2 + case profileKeyUpdate // = 4 + + init() { + self = .endSession + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .endSession + case 2: self = .expirationTimerUpdate + case 4: self = .profileKeyUpdate + default: return nil + } + } + + var rawValue: Int { + switch self { + case .endSession: return 1 + case .expirationTimerUpdate: return 2 + case .profileKeyUpdate: return 4 + } + } + + } + + struct Quote { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var author: String { + get {return _author ?? String()} + set {_author = newValue} + } + /// Returns true if `author` has been explicitly set. + var hasAuthor: Bool {return self._author != nil} + /// Clears the value of `author`. Subsequent reads from it will return its default value. + mutating func clearAuthor() {self._author = nil} + + var text: String { + get {return _text ?? String()} + set {_text = newValue} + } + /// Returns true if `text` has been explicitly set. + var hasText: Bool {return self._text != nil} + /// Clears the value of `text`. Subsequent reads from it will return its default value. + mutating func clearText() {self._text = nil} + + var attachments: [SignalService_DataMessage.Quote.QuotedAttachment] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct QuotedAttachment { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var contentType: String { + get {return _storage._contentType ?? String()} + set {_uniqueStorage()._contentType = newValue} + } + /// Returns true if `contentType` has been explicitly set. + var hasContentType: Bool {return _storage._contentType != nil} + /// Clears the value of `contentType`. Subsequent reads from it will return its default value. + mutating func clearContentType() {_storage._contentType = nil} + + var fileName: String { + get {return _storage._fileName ?? String()} + set {_uniqueStorage()._fileName = newValue} + } + /// Returns true if `fileName` has been explicitly set. + var hasFileName: Bool {return _storage._fileName != nil} + /// Clears the value of `fileName`. Subsequent reads from it will return its default value. + mutating func clearFileName() {_storage._fileName = nil} + + var thumbnail: SignalService_AttachmentPointer { + get {return _storage._thumbnail ?? SignalService_AttachmentPointer()} + set {_uniqueStorage()._thumbnail = newValue} + } + /// Returns true if `thumbnail` has been explicitly set. + var hasThumbnail: Bool {return _storage._thumbnail != nil} + /// Clears the value of `thumbnail`. Subsequent reads from it will return its default value. + mutating func clearThumbnail() {_storage._thumbnail = nil} + + var flags: UInt32 { + get {return _storage._flags ?? 0} + set {_uniqueStorage()._flags = newValue} + } + /// Returns true if `flags` has been explicitly set. + var hasFlags: Bool {return _storage._flags != nil} + /// Clears the value of `flags`. Subsequent reads from it will return its default value. + mutating func clearFlags() {_storage._flags = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Flags: SwiftProtobuf.Enum { + typealias RawValue = Int + case voiceMessage // = 1 + + init() { + self = .voiceMessage + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .voiceMessage + default: return nil + } + } + + var rawValue: Int { + switch self { + case .voiceMessage: return 1 + } + } + + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance + } + + init() {} + + fileprivate var _id: UInt64? = nil + fileprivate var _author: String? = nil + fileprivate var _text: String? = nil + } + + struct Contact { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: SignalService_DataMessage.Contact.Name { + get {return _storage._name ?? SignalService_DataMessage.Contact.Name()} + set {_uniqueStorage()._name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return _storage._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {_storage._name = nil} + + var number: [SignalService_DataMessage.Contact.Phone] { + get {return _storage._number} + set {_uniqueStorage()._number = newValue} + } + + var email: [SignalService_DataMessage.Contact.Email] { + get {return _storage._email} + set {_uniqueStorage()._email = newValue} + } + + var address: [SignalService_DataMessage.Contact.PostalAddress] { + get {return _storage._address} + set {_uniqueStorage()._address = newValue} + } + + var avatar: SignalService_DataMessage.Contact.Avatar { + get {return _storage._avatar ?? SignalService_DataMessage.Contact.Avatar()} + set {_uniqueStorage()._avatar = newValue} + } + /// Returns true if `avatar` has been explicitly set. + var hasAvatar: Bool {return _storage._avatar != nil} + /// Clears the value of `avatar`. Subsequent reads from it will return its default value. + mutating func clearAvatar() {_storage._avatar = nil} + + var organization: String { + get {return _storage._organization ?? String()} + set {_uniqueStorage()._organization = newValue} + } + /// Returns true if `organization` has been explicitly set. + var hasOrganization: Bool {return _storage._organization != nil} + /// Clears the value of `organization`. Subsequent reads from it will return its default value. + mutating func clearOrganization() {_storage._organization = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Name { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var givenName: String { + get {return _givenName ?? String()} + set {_givenName = newValue} + } + /// Returns true if `givenName` has been explicitly set. + var hasGivenName: Bool {return self._givenName != nil} + /// Clears the value of `givenName`. Subsequent reads from it will return its default value. + mutating func clearGivenName() {self._givenName = nil} + + var familyName: String { + get {return _familyName ?? String()} + set {_familyName = newValue} + } + /// Returns true if `familyName` has been explicitly set. + var hasFamilyName: Bool {return self._familyName != nil} + /// Clears the value of `familyName`. Subsequent reads from it will return its default value. + mutating func clearFamilyName() {self._familyName = nil} + + var prefix: String { + get {return _prefix ?? String()} + set {_prefix = newValue} + } + /// Returns true if `prefix` has been explicitly set. + var hasPrefix: Bool {return self._prefix != nil} + /// Clears the value of `prefix`. Subsequent reads from it will return its default value. + mutating func clearPrefix() {self._prefix = nil} + + var suffix: String { + get {return _suffix ?? String()} + set {_suffix = newValue} + } + /// Returns true if `suffix` has been explicitly set. + var hasSuffix: Bool {return self._suffix != nil} + /// Clears the value of `suffix`. Subsequent reads from it will return its default value. + mutating func clearSuffix() {self._suffix = nil} + + var middleName: String { + get {return _middleName ?? String()} + set {_middleName = newValue} + } + /// Returns true if `middleName` has been explicitly set. + var hasMiddleName: Bool {return self._middleName != nil} + /// Clears the value of `middleName`. Subsequent reads from it will return its default value. + mutating func clearMiddleName() {self._middleName = nil} + + var displayName: String { + get {return _displayName ?? String()} + set {_displayName = newValue} + } + /// Returns true if `displayName` has been explicitly set. + var hasDisplayName: Bool {return self._displayName != nil} + /// Clears the value of `displayName`. Subsequent reads from it will return its default value. + mutating func clearDisplayName() {self._displayName = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _givenName: String? = nil + fileprivate var _familyName: String? = nil + fileprivate var _prefix: String? = nil + fileprivate var _suffix: String? = nil + fileprivate var _middleName: String? = nil + fileprivate var _displayName: String? = nil + } + + struct Phone { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var value: String { + get {return _value ?? String()} + set {_value = newValue} + } + /// Returns true if `value` has been explicitly set. + var hasValue: Bool {return self._value != nil} + /// Clears the value of `value`. Subsequent reads from it will return its default value. + mutating func clearValue() {self._value = nil} + + var type: SignalService_DataMessage.Contact.Phone.TypeEnum { + get {return _type ?? .home} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var label: String { + get {return _label ?? String()} + set {_label = newValue} + } + /// Returns true if `label` has been explicitly set. + var hasLabel: Bool {return self._label != nil} + /// Clears the value of `label`. Subsequent reads from it will return its default value. + mutating func clearLabel() {self._label = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case home // = 1 + case mobile // = 2 + case work // = 3 + case custom // = 4 + + init() { + self = .home + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .home + case 2: self = .mobile + case 3: self = .work + case 4: self = .custom + default: return nil + } + } + + var rawValue: Int { + switch self { + case .home: return 1 + case .mobile: return 2 + case .work: return 3 + case .custom: return 4 + } + } + + } + + init() {} + + fileprivate var _value: String? = nil + fileprivate var _type: SignalService_DataMessage.Contact.Phone.TypeEnum? = nil + fileprivate var _label: String? = nil + } + + struct Email { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var value: String { + get {return _value ?? String()} + set {_value = newValue} + } + /// Returns true if `value` has been explicitly set. + var hasValue: Bool {return self._value != nil} + /// Clears the value of `value`. Subsequent reads from it will return its default value. + mutating func clearValue() {self._value = nil} + + var type: SignalService_DataMessage.Contact.Email.TypeEnum { + get {return _type ?? .home} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var label: String { + get {return _label ?? String()} + set {_label = newValue} + } + /// Returns true if `label` has been explicitly set. + var hasLabel: Bool {return self._label != nil} + /// Clears the value of `label`. Subsequent reads from it will return its default value. + mutating func clearLabel() {self._label = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case home // = 1 + case mobile // = 2 + case work // = 3 + case custom // = 4 + + init() { + self = .home + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .home + case 2: self = .mobile + case 3: self = .work + case 4: self = .custom + default: return nil + } + } + + var rawValue: Int { + switch self { + case .home: return 1 + case .mobile: return 2 + case .work: return 3 + case .custom: return 4 + } + } + + } + + init() {} + + fileprivate var _value: String? = nil + fileprivate var _type: SignalService_DataMessage.Contact.Email.TypeEnum? = nil + fileprivate var _label: String? = nil + } + + struct PostalAddress { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: SignalService_DataMessage.Contact.PostalAddress.TypeEnum { + get {return _type ?? .home} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var label: String { + get {return _label ?? String()} + set {_label = newValue} + } + /// Returns true if `label` has been explicitly set. + var hasLabel: Bool {return self._label != nil} + /// Clears the value of `label`. Subsequent reads from it will return its default value. + mutating func clearLabel() {self._label = nil} + + var street: String { + get {return _street ?? String()} + set {_street = newValue} + } + /// Returns true if `street` has been explicitly set. + var hasStreet: Bool {return self._street != nil} + /// Clears the value of `street`. Subsequent reads from it will return its default value. + mutating func clearStreet() {self._street = nil} + + var pobox: String { + get {return _pobox ?? String()} + set {_pobox = newValue} + } + /// Returns true if `pobox` has been explicitly set. + var hasPobox: Bool {return self._pobox != nil} + /// Clears the value of `pobox`. Subsequent reads from it will return its default value. + mutating func clearPobox() {self._pobox = nil} + + var neighborhood: String { + get {return _neighborhood ?? String()} + set {_neighborhood = newValue} + } + /// Returns true if `neighborhood` has been explicitly set. + var hasNeighborhood: Bool {return self._neighborhood != nil} + /// Clears the value of `neighborhood`. Subsequent reads from it will return its default value. + mutating func clearNeighborhood() {self._neighborhood = nil} + + var city: String { + get {return _city ?? String()} + set {_city = newValue} + } + /// Returns true if `city` has been explicitly set. + var hasCity: Bool {return self._city != nil} + /// Clears the value of `city`. Subsequent reads from it will return its default value. + mutating func clearCity() {self._city = nil} + + var region: String { + get {return _region ?? String()} + set {_region = newValue} + } + /// Returns true if `region` has been explicitly set. + var hasRegion: Bool {return self._region != nil} + /// Clears the value of `region`. Subsequent reads from it will return its default value. + mutating func clearRegion() {self._region = nil} + + var postcode: String { + get {return _postcode ?? String()} + set {_postcode = newValue} + } + /// Returns true if `postcode` has been explicitly set. + var hasPostcode: Bool {return self._postcode != nil} + /// Clears the value of `postcode`. Subsequent reads from it will return its default value. + mutating func clearPostcode() {self._postcode = nil} + + var country: String { + get {return _country ?? String()} + set {_country = newValue} + } + /// Returns true if `country` has been explicitly set. + var hasCountry: Bool {return self._country != nil} + /// Clears the value of `country`. Subsequent reads from it will return its default value. + mutating func clearCountry() {self._country = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case home // = 1 + case work // = 2 + case custom // = 3 + + init() { + self = .home + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .home + case 2: self = .work + case 3: self = .custom + default: return nil + } + } + + var rawValue: Int { + switch self { + case .home: return 1 + case .work: return 2 + case .custom: return 3 + } + } + + } + + init() {} + + fileprivate var _type: SignalService_DataMessage.Contact.PostalAddress.TypeEnum? = nil + fileprivate var _label: String? = nil + fileprivate var _street: String? = nil + fileprivate var _pobox: String? = nil + fileprivate var _neighborhood: String? = nil + fileprivate var _city: String? = nil + fileprivate var _region: String? = nil + fileprivate var _postcode: String? = nil + fileprivate var _country: String? = nil + } + + struct Avatar { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var avatar: SignalService_AttachmentPointer { + get {return _storage._avatar ?? SignalService_AttachmentPointer()} + set {_uniqueStorage()._avatar = newValue} + } + /// Returns true if `avatar` has been explicitly set. + var hasAvatar: Bool {return _storage._avatar != nil} + /// Clears the value of `avatar`. Subsequent reads from it will return its default value. + mutating func clearAvatar() {_storage._avatar = nil} + + var isProfile: Bool { + get {return _storage._isProfile ?? false} + set {_uniqueStorage()._isProfile = newValue} + } + /// Returns true if `isProfile` has been explicitly set. + var hasIsProfile: Bool {return _storage._isProfile != nil} + /// Clears the value of `isProfile`. Subsequent reads from it will return its default value. + mutating func clearIsProfile() {_storage._isProfile = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct SignalService_NullMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var padding: Data { + get {return _padding ?? SwiftProtobuf.Internal.emptyData} + set {_padding = newValue} + } + /// Returns true if `padding` has been explicitly set. + var hasPadding: Bool {return self._padding != nil} + /// Clears the value of `padding`. Subsequent reads from it will return its default value. + mutating func clearPadding() {self._padding = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _padding: Data? = nil +} + +struct SignalService_ReceiptMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: SignalService_ReceiptMessage.TypeEnum { + get {return _type ?? .delivery} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var timestamp: [UInt64] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case delivery // = 0 + case read // = 1 + + init() { + self = .delivery + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .delivery + case 1: self = .read + default: return nil + } + } + + var rawValue: Int { + switch self { + case .delivery: return 0 + case .read: return 1 + } + } + + } + + init() {} + + fileprivate var _type: SignalService_ReceiptMessage.TypeEnum? = nil +} + +struct SignalService_Verified { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var destination: String { + get {return _destination ?? String()} + set {_destination = newValue} + } + /// Returns true if `destination` has been explicitly set. + var hasDestination: Bool {return self._destination != nil} + /// Clears the value of `destination`. Subsequent reads from it will return its default value. + mutating func clearDestination() {self._destination = nil} + + var identityKey: Data { + get {return _identityKey ?? SwiftProtobuf.Internal.emptyData} + set {_identityKey = newValue} + } + /// Returns true if `identityKey` has been explicitly set. + var hasIdentityKey: Bool {return self._identityKey != nil} + /// Clears the value of `identityKey`. Subsequent reads from it will return its default value. + mutating func clearIdentityKey() {self._identityKey = nil} + + var state: SignalService_Verified.State { + get {return _state ?? .default} + set {_state = newValue} + } + /// Returns true if `state` has been explicitly set. + var hasState: Bool {return self._state != nil} + /// Clears the value of `state`. Subsequent reads from it will return its default value. + mutating func clearState() {self._state = nil} + + var nullMessage: Data { + get {return _nullMessage ?? SwiftProtobuf.Internal.emptyData} + set {_nullMessage = newValue} + } + /// Returns true if `nullMessage` has been explicitly set. + var hasNullMessage: Bool {return self._nullMessage != nil} + /// Clears the value of `nullMessage`. Subsequent reads from it will return its default value. + mutating func clearNullMessage() {self._nullMessage = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum State: SwiftProtobuf.Enum { + typealias RawValue = Int + case `default` // = 0 + case verified // = 1 + case unverified // = 2 + + init() { + self = .default + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .default + case 1: self = .verified + case 2: self = .unverified + default: return nil + } + } + + var rawValue: Int { + switch self { + case .default: return 0 + case .verified: return 1 + case .unverified: return 2 + } + } + + } + + init() {} + + fileprivate var _destination: String? = nil + fileprivate var _identityKey: Data? = nil + fileprivate var _state: SignalService_Verified.State? = nil + fileprivate var _nullMessage: Data? = nil +} + +struct SignalService_SyncMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var sent: SignalService_SyncMessage.Sent { + get {return _storage._sent ?? SignalService_SyncMessage.Sent()} + set {_uniqueStorage()._sent = newValue} + } + /// Returns true if `sent` has been explicitly set. + var hasSent: Bool {return _storage._sent != nil} + /// Clears the value of `sent`. Subsequent reads from it will return its default value. + mutating func clearSent() {_storage._sent = nil} + + var contacts: SignalService_SyncMessage.Contacts { + get {return _storage._contacts ?? SignalService_SyncMessage.Contacts()} + set {_uniqueStorage()._contacts = newValue} + } + /// Returns true if `contacts` has been explicitly set. + var hasContacts: Bool {return _storage._contacts != nil} + /// Clears the value of `contacts`. Subsequent reads from it will return its default value. + mutating func clearContacts() {_storage._contacts = nil} + + var groups: SignalService_SyncMessage.Groups { + get {return _storage._groups ?? SignalService_SyncMessage.Groups()} + set {_uniqueStorage()._groups = newValue} + } + /// Returns true if `groups` has been explicitly set. + var hasGroups: Bool {return _storage._groups != nil} + /// Clears the value of `groups`. Subsequent reads from it will return its default value. + mutating func clearGroups() {_storage._groups = nil} + + var request: SignalService_SyncMessage.Request { + get {return _storage._request ?? SignalService_SyncMessage.Request()} + set {_uniqueStorage()._request = newValue} + } + /// Returns true if `request` has been explicitly set. + var hasRequest: Bool {return _storage._request != nil} + /// Clears the value of `request`. Subsequent reads from it will return its default value. + mutating func clearRequest() {_storage._request = nil} + + var read: [SignalService_SyncMessage.Read] { + get {return _storage._read} + set {_uniqueStorage()._read = newValue} + } + + var blocked: SignalService_SyncMessage.Blocked { + get {return _storage._blocked ?? SignalService_SyncMessage.Blocked()} + set {_uniqueStorage()._blocked = newValue} + } + /// Returns true if `blocked` has been explicitly set. + var hasBlocked: Bool {return _storage._blocked != nil} + /// Clears the value of `blocked`. Subsequent reads from it will return its default value. + mutating func clearBlocked() {_storage._blocked = nil} + + var verified: SignalService_Verified { + get {return _storage._verified ?? SignalService_Verified()} + set {_uniqueStorage()._verified = newValue} + } + /// Returns true if `verified` has been explicitly set. + var hasVerified: Bool {return _storage._verified != nil} + /// Clears the value of `verified`. Subsequent reads from it will return its default value. + mutating func clearVerified() {_storage._verified = nil} + + var configuration: SignalService_SyncMessage.Configuration { + get {return _storage._configuration ?? SignalService_SyncMessage.Configuration()} + set {_uniqueStorage()._configuration = newValue} + } + /// Returns true if `configuration` has been explicitly set. + var hasConfiguration: Bool {return _storage._configuration != nil} + /// Clears the value of `configuration`. Subsequent reads from it will return its default value. + mutating func clearConfiguration() {_storage._configuration = nil} + + var padding: Data { + get {return _storage._padding ?? SwiftProtobuf.Internal.emptyData} + set {_uniqueStorage()._padding = newValue} + } + /// Returns true if `padding` has been explicitly set. + var hasPadding: Bool {return _storage._padding != nil} + /// Clears the value of `padding`. Subsequent reads from it will return its default value. + mutating func clearPadding() {_storage._padding = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Sent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var destination: String { + get {return _storage._destination ?? String()} + set {_uniqueStorage()._destination = newValue} + } + /// Returns true if `destination` has been explicitly set. + var hasDestination: Bool {return _storage._destination != nil} + /// Clears the value of `destination`. Subsequent reads from it will return its default value. + mutating func clearDestination() {_storage._destination = nil} + + var timestamp: UInt64 { + get {return _storage._timestamp ?? 0} + set {_uniqueStorage()._timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return _storage._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {_storage._timestamp = nil} + + var message: SignalService_DataMessage { + get {return _storage._message ?? SignalService_DataMessage()} + set {_uniqueStorage()._message = newValue} + } + /// Returns true if `message` has been explicitly set. + var hasMessage: Bool {return _storage._message != nil} + /// Clears the value of `message`. Subsequent reads from it will return its default value. + mutating func clearMessage() {_storage._message = nil} + + var expirationStartTimestamp: UInt64 { + get {return _storage._expirationStartTimestamp ?? 0} + set {_uniqueStorage()._expirationStartTimestamp = newValue} + } + /// Returns true if `expirationStartTimestamp` has been explicitly set. + var hasExpirationStartTimestamp: Bool {return _storage._expirationStartTimestamp != nil} + /// Clears the value of `expirationStartTimestamp`. Subsequent reads from it will return its default value. + mutating func clearExpirationStartTimestamp() {_storage._expirationStartTimestamp = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance + } + + struct Contacts { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var blob: SignalService_AttachmentPointer { + get {return _storage._blob ?? SignalService_AttachmentPointer()} + set {_uniqueStorage()._blob = newValue} + } + /// Returns true if `blob` has been explicitly set. + var hasBlob: Bool {return _storage._blob != nil} + /// Clears the value of `blob`. Subsequent reads from it will return its default value. + mutating func clearBlob() {_storage._blob = nil} + + /// Signal-iOS renamed this property. + var isComplete: Bool { + get {return _storage._isComplete ?? false} + set {_uniqueStorage()._isComplete = newValue} + } + /// Returns true if `isComplete` has been explicitly set. + var hasIsComplete: Bool {return _storage._isComplete != nil} + /// Clears the value of `isComplete`. Subsequent reads from it will return its default value. + mutating func clearIsComplete() {_storage._isComplete = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance + } + + struct Groups { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var blob: SignalService_AttachmentPointer { + get {return _storage._blob ?? SignalService_AttachmentPointer()} + set {_uniqueStorage()._blob = newValue} + } + /// Returns true if `blob` has been explicitly set. + var hasBlob: Bool {return _storage._blob != nil} + /// Clears the value of `blob`. Subsequent reads from it will return its default value. + mutating func clearBlob() {_storage._blob = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance + } + + struct Blocked { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var numbers: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + struct Request { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: SignalService_SyncMessage.Request.TypeEnum { + get {return _type ?? .unknown} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case contacts // = 1 + case groups // = 2 + case blocked // = 3 + case configuration // = 4 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .contacts + case 2: self = .groups + case 3: self = .blocked + case 4: self = .configuration + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .contacts: return 1 + case .groups: return 2 + case .blocked: return 3 + case .configuration: return 4 + } + } + + } + + init() {} + + fileprivate var _type: SignalService_SyncMessage.Request.TypeEnum? = nil + } + + struct Read { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var sender: String { + get {return _sender ?? String()} + set {_sender = newValue} + } + /// Returns true if `sender` has been explicitly set. + var hasSender: Bool {return self._sender != nil} + /// Clears the value of `sender`. Subsequent reads from it will return its default value. + mutating func clearSender() {self._sender = nil} + + var timestamp: UInt64 { + get {return _timestamp ?? 0} + set {_timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return self._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {self._timestamp = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _sender: String? = nil + fileprivate var _timestamp: UInt64? = nil + } + + struct Configuration { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var readReceipts: Bool { + get {return _readReceipts ?? false} + set {_readReceipts = newValue} + } + /// Returns true if `readReceipts` has been explicitly set. + var hasReadReceipts: Bool {return self._readReceipts != nil} + /// Clears the value of `readReceipts`. Subsequent reads from it will return its default value. + mutating func clearReadReceipts() {self._readReceipts = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _readReceipts: Bool? = nil + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct SignalService_AttachmentPointer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: UInt64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var contentType: String { + get {return _contentType ?? String()} + set {_contentType = newValue} + } + /// Returns true if `contentType` has been explicitly set. + var hasContentType: Bool {return self._contentType != nil} + /// Clears the value of `contentType`. Subsequent reads from it will return its default value. + mutating func clearContentType() {self._contentType = nil} + + var key: Data { + get {return _key ?? SwiftProtobuf.Internal.emptyData} + set {_key = newValue} + } + /// Returns true if `key` has been explicitly set. + var hasKey: Bool {return self._key != nil} + /// Clears the value of `key`. Subsequent reads from it will return its default value. + mutating func clearKey() {self._key = nil} + + var size: UInt32 { + get {return _size ?? 0} + set {_size = newValue} + } + /// Returns true if `size` has been explicitly set. + var hasSize: Bool {return self._size != nil} + /// Clears the value of `size`. Subsequent reads from it will return its default value. + mutating func clearSize() {self._size = nil} + + var thumbnail: Data { + get {return _thumbnail ?? SwiftProtobuf.Internal.emptyData} + set {_thumbnail = newValue} + } + /// Returns true if `thumbnail` has been explicitly set. + var hasThumbnail: Bool {return self._thumbnail != nil} + /// Clears the value of `thumbnail`. Subsequent reads from it will return its default value. + mutating func clearThumbnail() {self._thumbnail = nil} + + var digest: Data { + get {return _digest ?? SwiftProtobuf.Internal.emptyData} + set {_digest = newValue} + } + /// Returns true if `digest` has been explicitly set. + var hasDigest: Bool {return self._digest != nil} + /// Clears the value of `digest`. Subsequent reads from it will return its default value. + mutating func clearDigest() {self._digest = nil} + + var fileName: String { + get {return _fileName ?? String()} + set {_fileName = newValue} + } + /// Returns true if `fileName` has been explicitly set. + var hasFileName: Bool {return self._fileName != nil} + /// Clears the value of `fileName`. Subsequent reads from it will return its default value. + mutating func clearFileName() {self._fileName = nil} + + var flags: UInt32 { + get {return _flags ?? 0} + set {_flags = newValue} + } + /// Returns true if `flags` has been explicitly set. + var hasFlags: Bool {return self._flags != nil} + /// Clears the value of `flags`. Subsequent reads from it will return its default value. + mutating func clearFlags() {self._flags = nil} + + var width: UInt32 { + get {return _width ?? 0} + set {_width = newValue} + } + /// Returns true if `width` has been explicitly set. + var hasWidth: Bool {return self._width != nil} + /// Clears the value of `width`. Subsequent reads from it will return its default value. + mutating func clearWidth() {self._width = nil} + + var height: UInt32 { + get {return _height ?? 0} + set {_height = newValue} + } + /// Returns true if `height` has been explicitly set. + var hasHeight: Bool {return self._height != nil} + /// Clears the value of `height`. Subsequent reads from it will return its default value. + mutating func clearHeight() {self._height = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Flags: SwiftProtobuf.Enum { + typealias RawValue = Int + case voiceMessage // = 1 + + init() { + self = .voiceMessage + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .voiceMessage + default: return nil + } + } + + var rawValue: Int { + switch self { + case .voiceMessage: return 1 + } + } + + } + + init() {} + + fileprivate var _id: UInt64? = nil + fileprivate var _contentType: String? = nil + fileprivate var _key: Data? = nil + fileprivate var _size: UInt32? = nil + fileprivate var _thumbnail: Data? = nil + fileprivate var _digest: Data? = nil + fileprivate var _fileName: String? = nil + fileprivate var _flags: UInt32? = nil + fileprivate var _width: UInt32? = nil + fileprivate var _height: UInt32? = nil +} + +struct SignalService_GroupContext { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: Data { + get {return _storage._id ?? SwiftProtobuf.Internal.emptyData} + set {_uniqueStorage()._id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return _storage._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {_storage._id = nil} + + var type: SignalService_GroupContext.TypeEnum { + get {return _storage._type ?? .unknown} + set {_uniqueStorage()._type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return _storage._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {_storage._type = nil} + + var name: String { + get {return _storage._name ?? String()} + set {_uniqueStorage()._name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return _storage._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {_storage._name = nil} + + var members: [String] { + get {return _storage._members} + set {_uniqueStorage()._members = newValue} + } + + var avatar: SignalService_AttachmentPointer { + get {return _storage._avatar ?? SignalService_AttachmentPointer()} + set {_uniqueStorage()._avatar = newValue} + } + /// Returns true if `avatar` has been explicitly set. + var hasAvatar: Bool {return _storage._avatar != nil} + /// Clears the value of `avatar`. Subsequent reads from it will return its default value. + mutating func clearAvatar() {_storage._avatar = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case update // = 1 + case deliver // = 2 + case quit // = 3 + case requestInfo // = 4 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .update + case 2: self = .deliver + case 3: self = .quit + case 4: self = .requestInfo + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .update: return 1 + case .deliver: return 2 + case .quit: return 3 + case .requestInfo: return 4 + } + } + + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct SignalService_ContactDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var number: String { + get {return _storage._number ?? String()} + set {_uniqueStorage()._number = newValue} + } + /// Returns true if `number` has been explicitly set. + var hasNumber: Bool {return _storage._number != nil} + /// Clears the value of `number`. Subsequent reads from it will return its default value. + mutating func clearNumber() {_storage._number = nil} + + var name: String { + get {return _storage._name ?? String()} + set {_uniqueStorage()._name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return _storage._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {_storage._name = nil} + + var avatar: SignalService_ContactDetails.Avatar { + get {return _storage._avatar ?? SignalService_ContactDetails.Avatar()} + set {_uniqueStorage()._avatar = newValue} + } + /// Returns true if `avatar` has been explicitly set. + var hasAvatar: Bool {return _storage._avatar != nil} + /// Clears the value of `avatar`. Subsequent reads from it will return its default value. + mutating func clearAvatar() {_storage._avatar = nil} + + var color: String { + get {return _storage._color ?? String()} + set {_uniqueStorage()._color = newValue} + } + /// Returns true if `color` has been explicitly set. + var hasColor: Bool {return _storage._color != nil} + /// Clears the value of `color`. Subsequent reads from it will return its default value. + mutating func clearColor() {_storage._color = nil} + + var verified: SignalService_Verified { + get {return _storage._verified ?? SignalService_Verified()} + set {_uniqueStorage()._verified = newValue} + } + /// Returns true if `verified` has been explicitly set. + var hasVerified: Bool {return _storage._verified != nil} + /// Clears the value of `verified`. Subsequent reads from it will return its default value. + mutating func clearVerified() {_storage._verified = nil} + + var profileKey: Data { + get {return _storage._profileKey ?? SwiftProtobuf.Internal.emptyData} + set {_uniqueStorage()._profileKey = newValue} + } + /// Returns true if `profileKey` has been explicitly set. + var hasProfileKey: Bool {return _storage._profileKey != nil} + /// Clears the value of `profileKey`. Subsequent reads from it will return its default value. + mutating func clearProfileKey() {_storage._profileKey = nil} + + var blocked: Bool { + get {return _storage._blocked ?? false} + set {_uniqueStorage()._blocked = newValue} + } + /// Returns true if `blocked` has been explicitly set. + var hasBlocked: Bool {return _storage._blocked != nil} + /// Clears the value of `blocked`. Subsequent reads from it will return its default value. + mutating func clearBlocked() {_storage._blocked = nil} + + var expireTimer: UInt32 { + get {return _storage._expireTimer ?? 0} + set {_uniqueStorage()._expireTimer = newValue} + } + /// Returns true if `expireTimer` has been explicitly set. + var hasExpireTimer: Bool {return _storage._expireTimer != nil} + /// Clears the value of `expireTimer`. Subsequent reads from it will return its default value. + mutating func clearExpireTimer() {_storage._expireTimer = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Avatar { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var contentType: String { + get {return _contentType ?? String()} + set {_contentType = newValue} + } + /// Returns true if `contentType` has been explicitly set. + var hasContentType: Bool {return self._contentType != nil} + /// Clears the value of `contentType`. Subsequent reads from it will return its default value. + mutating func clearContentType() {self._contentType = nil} + + var length: UInt32 { + get {return _length ?? 0} + set {_length = newValue} + } + /// Returns true if `length` has been explicitly set. + var hasLength: Bool {return self._length != nil} + /// Clears the value of `length`. Subsequent reads from it will return its default value. + mutating func clearLength() {self._length = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _contentType: String? = nil + fileprivate var _length: UInt32? = nil + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct SignalService_GroupDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: Data { + get {return _storage._id ?? SwiftProtobuf.Internal.emptyData} + set {_uniqueStorage()._id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return _storage._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {_storage._id = nil} + + var name: String { + get {return _storage._name ?? String()} + set {_uniqueStorage()._name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return _storage._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {_storage._name = nil} + + var members: [String] { + get {return _storage._members} + set {_uniqueStorage()._members = newValue} + } + + var avatar: SignalService_GroupDetails.Avatar { + get {return _storage._avatar ?? SignalService_GroupDetails.Avatar()} + set {_uniqueStorage()._avatar = newValue} + } + /// Returns true if `avatar` has been explicitly set. + var hasAvatar: Bool {return _storage._avatar != nil} + /// Clears the value of `avatar`. Subsequent reads from it will return its default value. + mutating func clearAvatar() {_storage._avatar = nil} + + var active: Bool { + get {return _storage._active ?? true} + set {_uniqueStorage()._active = newValue} + } + /// Returns true if `active` has been explicitly set. + var hasActive: Bool {return _storage._active != nil} + /// Clears the value of `active`. Subsequent reads from it will return its default value. + mutating func clearActive() {_storage._active = nil} + + var expireTimer: UInt32 { + get {return _storage._expireTimer ?? 0} + set {_uniqueStorage()._expireTimer = newValue} + } + /// Returns true if `expireTimer` has been explicitly set. + var hasExpireTimer: Bool {return _storage._expireTimer != nil} + /// Clears the value of `expireTimer`. Subsequent reads from it will return its default value. + mutating func clearExpireTimer() {_storage._expireTimer = nil} + + var color: String { + get {return _storage._color ?? String()} + set {_uniqueStorage()._color = newValue} + } + /// Returns true if `color` has been explicitly set. + var hasColor: Bool {return _storage._color != nil} + /// Clears the value of `color`. Subsequent reads from it will return its default value. + mutating func clearColor() {_storage._color = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Avatar { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var contentType: String { + get {return _contentType ?? String()} + set {_contentType = newValue} + } + /// Returns true if `contentType` has been explicitly set. + var hasContentType: Bool {return self._contentType != nil} + /// Clears the value of `contentType`. Subsequent reads from it will return its default value. + mutating func clearContentType() {self._contentType = nil} + + var length: UInt32 { + get {return _length ?? 0} + set {_length = newValue} + } + /// Returns true if `length` has been explicitly set. + var hasLength: Bool {return self._length != nil} + /// Clears the value of `length`. Subsequent reads from it will return its default value. + mutating func clearLength() {self._length = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _contentType: String? = nil + fileprivate var _length: UInt32? = nil + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "SignalService" + +extension SignalService_Envelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Envelope" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "source"), + 7: .same(proto: "sourceDevice"), + 3: .same(proto: "relay"), + 5: .same(proto: "timestamp"), + 6: .same(proto: "legacyMessage"), + 8: .same(proto: "content"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._type) + case 2: try decoder.decodeSingularStringField(value: &self._source) + case 3: try decoder.decodeSingularStringField(value: &self._relay) + case 5: try decoder.decodeSingularUInt64Field(value: &self._timestamp) + case 6: try decoder.decodeSingularBytesField(value: &self._legacyMessage) + case 7: try decoder.decodeSingularUInt32Field(value: &self._sourceDevice) + case 8: try decoder.decodeSingularBytesField(value: &self._content) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if let v = self._source { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._relay { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._timestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 5) + } + if let v = self._legacyMessage { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + if let v = self._sourceDevice { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 7) + } + if let v = self._content { + try visitor.visitSingularBytesField(value: v, fieldNumber: 8) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_Envelope) -> Bool { + if self._type != other._type {return false} + if self._source != other._source {return false} + if self._sourceDevice != other._sourceDevice {return false} + if self._relay != other._relay {return false} + if self._timestamp != other._timestamp {return false} + if self._legacyMessage != other._legacyMessage {return false} + if self._content != other._content {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_Envelope.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "CIPHERTEXT"), + 2: .same(proto: "KEY_EXCHANGE"), + 3: .same(proto: "PREKEY_BUNDLE"), + 5: .same(proto: "RECEIPT"), + ] +} + +extension SignalService_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Content" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "dataMessage"), + 2: .same(proto: "syncMessage"), + 3: .same(proto: "callMessage"), + 4: .same(proto: "nullMessage"), + 5: .same(proto: "receiptMessage"), + ] + + fileprivate class _StorageClass { + var _dataMessage: SignalService_DataMessage? = nil + var _syncMessage: SignalService_SyncMessage? = nil + var _callMessage: SignalService_CallMessage? = nil + var _nullMessage: SignalService_NullMessage? = nil + var _receiptMessage: SignalService_ReceiptMessage? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _dataMessage = source._dataMessage + _syncMessage = source._syncMessage + _callMessage = source._callMessage + _nullMessage = source._nullMessage + _receiptMessage = source._receiptMessage + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._dataMessage) + case 2: try decoder.decodeSingularMessageField(value: &_storage._syncMessage) + case 3: try decoder.decodeSingularMessageField(value: &_storage._callMessage) + case 4: try decoder.decodeSingularMessageField(value: &_storage._nullMessage) + case 5: try decoder.decodeSingularMessageField(value: &_storage._receiptMessage) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._dataMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = _storage._syncMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if let v = _storage._callMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = _storage._nullMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if let v = _storage._receiptMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_Content) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._dataMessage != other_storage._dataMessage {return false} + if _storage._syncMessage != other_storage._syncMessage {return false} + if _storage._callMessage != other_storage._callMessage {return false} + if _storage._nullMessage != other_storage._nullMessage {return false} + if _storage._receiptMessage != other_storage._receiptMessage {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_CallMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CallMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "offer"), + 2: .same(proto: "answer"), + 3: .same(proto: "iceUpdate"), + 4: .same(proto: "hangup"), + 5: .same(proto: "busy"), + 6: .same(proto: "profileKey"), + ] + + fileprivate class _StorageClass { + var _offer: SignalService_CallMessage.Offer? = nil + var _answer: SignalService_CallMessage.Answer? = nil + var _iceUpdate: [SignalService_CallMessage.IceUpdate] = [] + var _hangup: SignalService_CallMessage.Hangup? = nil + var _busy: SignalService_CallMessage.Busy? = nil + var _profileKey: Data? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _offer = source._offer + _answer = source._answer + _iceUpdate = source._iceUpdate + _hangup = source._hangup + _busy = source._busy + _profileKey = source._profileKey + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._offer) + case 2: try decoder.decodeSingularMessageField(value: &_storage._answer) + case 3: try decoder.decodeRepeatedMessageField(value: &_storage._iceUpdate) + case 4: try decoder.decodeSingularMessageField(value: &_storage._hangup) + case 5: try decoder.decodeSingularMessageField(value: &_storage._busy) + case 6: try decoder.decodeSingularBytesField(value: &_storage._profileKey) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._offer { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = _storage._answer { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if !_storage._iceUpdate.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._iceUpdate, fieldNumber: 3) + } + if let v = _storage._hangup { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if let v = _storage._busy { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if let v = _storage._profileKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_CallMessage) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._offer != other_storage._offer {return false} + if _storage._answer != other_storage._answer {return false} + if _storage._iceUpdate != other_storage._iceUpdate {return false} + if _storage._hangup != other_storage._hangup {return false} + if _storage._busy != other_storage._busy {return false} + if _storage._profileKey != other_storage._profileKey {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_CallMessage.Offer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_CallMessage.protoMessageName + ".Offer" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "sessionDescription"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._sessionDescription) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + if let v = self._sessionDescription { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_CallMessage.Offer) -> Bool { + if self._id != other._id {return false} + if self._sessionDescription != other._sessionDescription {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_CallMessage.Answer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_CallMessage.protoMessageName + ".Answer" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "sessionDescription"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._sessionDescription) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + if let v = self._sessionDescription { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_CallMessage.Answer) -> Bool { + if self._id != other._id {return false} + if self._sessionDescription != other._sessionDescription {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_CallMessage.IceUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_CallMessage.protoMessageName + ".IceUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "sdpMid"), + 3: .same(proto: "sdpMLineIndex"), + 4: .same(proto: "sdp"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._sdpMid) + case 3: try decoder.decodeSingularUInt32Field(value: &self._sdpMlineIndex) + case 4: try decoder.decodeSingularStringField(value: &self._sdp) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + if let v = self._sdpMid { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._sdpMlineIndex { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 3) + } + if let v = self._sdp { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_CallMessage.IceUpdate) -> Bool { + if self._id != other._id {return false} + if self._sdpMid != other._sdpMid {return false} + if self._sdpMlineIndex != other._sdpMlineIndex {return false} + if self._sdp != other._sdp {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_CallMessage.Busy: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_CallMessage.protoMessageName + ".Busy" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_CallMessage.Busy) -> Bool { + if self._id != other._id {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_CallMessage.Hangup: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_CallMessage.protoMessageName + ".Hangup" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_CallMessage.Hangup) -> Bool { + if self._id != other._id {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DataMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "body"), + 2: .same(proto: "attachments"), + 3: .same(proto: "group"), + 4: .same(proto: "flags"), + 5: .same(proto: "expireTimer"), + 6: .same(proto: "profileKey"), + 7: .same(proto: "timestamp"), + 8: .same(proto: "quote"), + 9: .same(proto: "contact"), + ] + + fileprivate class _StorageClass { + var _body: String? = nil + var _attachments: [SignalService_AttachmentPointer] = [] + var _group: SignalService_GroupContext? = nil + var _flags: UInt32? = nil + var _expireTimer: UInt32? = nil + var _profileKey: Data? = nil + var _timestamp: UInt64? = nil + var _quote: SignalService_DataMessage.Quote? = nil + var _contact: [SignalService_DataMessage.Contact] = [] + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _body = source._body + _attachments = source._attachments + _group = source._group + _flags = source._flags + _expireTimer = source._expireTimer + _profileKey = source._profileKey + _timestamp = source._timestamp + _quote = source._quote + _contact = source._contact + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &_storage._body) + case 2: try decoder.decodeRepeatedMessageField(value: &_storage._attachments) + case 3: try decoder.decodeSingularMessageField(value: &_storage._group) + case 4: try decoder.decodeSingularUInt32Field(value: &_storage._flags) + case 5: try decoder.decodeSingularUInt32Field(value: &_storage._expireTimer) + case 6: try decoder.decodeSingularBytesField(value: &_storage._profileKey) + case 7: try decoder.decodeSingularUInt64Field(value: &_storage._timestamp) + case 8: try decoder.decodeSingularMessageField(value: &_storage._quote) + case 9: try decoder.decodeRepeatedMessageField(value: &_storage._contact) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._body { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if !_storage._attachments.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._attachments, fieldNumber: 2) + } + if let v = _storage._group { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = _storage._flags { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 4) + } + if let v = _storage._expireTimer { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 5) + } + if let v = _storage._profileKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + if let v = _storage._timestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 7) + } + if let v = _storage._quote { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } + if !_storage._contact.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._contact, fieldNumber: 9) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_DataMessage) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._body != other_storage._body {return false} + if _storage._attachments != other_storage._attachments {return false} + if _storage._group != other_storage._group {return false} + if _storage._flags != other_storage._flags {return false} + if _storage._expireTimer != other_storage._expireTimer {return false} + if _storage._profileKey != other_storage._profileKey {return false} + if _storage._timestamp != other_storage._timestamp {return false} + if _storage._quote != other_storage._quote {return false} + if _storage._contact != other_storage._contact {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_DataMessage.Flags: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "END_SESSION"), + 2: .same(proto: "EXPIRATION_TIMER_UPDATE"), + 4: .same(proto: "PROFILE_KEY_UPDATE"), + ] +} + +extension SignalService_DataMessage.Quote: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_DataMessage.protoMessageName + ".Quote" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "author"), + 3: .same(proto: "text"), + 4: .same(proto: "attachments"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._author) + case 3: try decoder.decodeSingularStringField(value: &self._text) + case 4: try decoder.decodeRepeatedMessageField(value: &self.attachments) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + if let v = self._author { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._text { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if !self.attachments.isEmpty { + try visitor.visitRepeatedMessageField(value: self.attachments, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Quote) -> Bool { + if self._id != other._id {return false} + if self._author != other._author {return false} + if self._text != other._text {return false} + if self.attachments != other.attachments {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_DataMessage.Quote.QuotedAttachment: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_DataMessage.Quote.protoMessageName + ".QuotedAttachment" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "contentType"), + 2: .same(proto: "fileName"), + 3: .same(proto: "thumbnail"), + 4: .same(proto: "flags"), + ] + + fileprivate class _StorageClass { + var _contentType: String? = nil + var _fileName: String? = nil + var _thumbnail: SignalService_AttachmentPointer? = nil + var _flags: UInt32? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _contentType = source._contentType + _fileName = source._fileName + _thumbnail = source._thumbnail + _flags = source._flags + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &_storage._contentType) + case 2: try decoder.decodeSingularStringField(value: &_storage._fileName) + case 3: try decoder.decodeSingularMessageField(value: &_storage._thumbnail) + case 4: try decoder.decodeSingularUInt32Field(value: &_storage._flags) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._contentType { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = _storage._fileName { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = _storage._thumbnail { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = _storage._flags { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 4) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Quote.QuotedAttachment) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._contentType != other_storage._contentType {return false} + if _storage._fileName != other_storage._fileName {return false} + if _storage._thumbnail != other_storage._thumbnail {return false} + if _storage._flags != other_storage._flags {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_DataMessage.Quote.QuotedAttachment.Flags: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "VOICE_MESSAGE"), + ] +} + +extension SignalService_DataMessage.Contact: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_DataMessage.protoMessageName + ".Contact" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 3: .same(proto: "number"), + 4: .same(proto: "email"), + 5: .same(proto: "address"), + 6: .same(proto: "avatar"), + 7: .same(proto: "organization"), + ] + + fileprivate class _StorageClass { + var _name: SignalService_DataMessage.Contact.Name? = nil + var _number: [SignalService_DataMessage.Contact.Phone] = [] + var _email: [SignalService_DataMessage.Contact.Email] = [] + var _address: [SignalService_DataMessage.Contact.PostalAddress] = [] + var _avatar: SignalService_DataMessage.Contact.Avatar? = nil + var _organization: String? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _name = source._name + _number = source._number + _email = source._email + _address = source._address + _avatar = source._avatar + _organization = source._organization + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._name) + case 3: try decoder.decodeRepeatedMessageField(value: &_storage._number) + case 4: try decoder.decodeRepeatedMessageField(value: &_storage._email) + case 5: try decoder.decodeRepeatedMessageField(value: &_storage._address) + case 6: try decoder.decodeSingularMessageField(value: &_storage._avatar) + case 7: try decoder.decodeSingularStringField(value: &_storage._organization) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._name { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !_storage._number.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._number, fieldNumber: 3) + } + if !_storage._email.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._email, fieldNumber: 4) + } + if !_storage._address.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._address, fieldNumber: 5) + } + if let v = _storage._avatar { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } + if let v = _storage._organization { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._name != other_storage._name {return false} + if _storage._number != other_storage._number {return false} + if _storage._email != other_storage._email {return false} + if _storage._address != other_storage._address {return false} + if _storage._avatar != other_storage._avatar {return false} + if _storage._organization != other_storage._organization {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_DataMessage.Contact.Name: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_DataMessage.Contact.protoMessageName + ".Name" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "givenName"), + 2: .same(proto: "familyName"), + 3: .same(proto: "prefix"), + 4: .same(proto: "suffix"), + 5: .same(proto: "middleName"), + 6: .same(proto: "displayName"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._givenName) + case 2: try decoder.decodeSingularStringField(value: &self._familyName) + case 3: try decoder.decodeSingularStringField(value: &self._prefix) + case 4: try decoder.decodeSingularStringField(value: &self._suffix) + case 5: try decoder.decodeSingularStringField(value: &self._middleName) + case 6: try decoder.decodeSingularStringField(value: &self._displayName) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._givenName { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._familyName { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._prefix { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._suffix { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } + if let v = self._middleName { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } + if let v = self._displayName { + try visitor.visitSingularStringField(value: v, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact.Name) -> Bool { + if self._givenName != other._givenName {return false} + if self._familyName != other._familyName {return false} + if self._prefix != other._prefix {return false} + if self._suffix != other._suffix {return false} + if self._middleName != other._middleName {return false} + if self._displayName != other._displayName {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_DataMessage.Contact.Phone: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_DataMessage.Contact.protoMessageName + ".Phone" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .same(proto: "type"), + 3: .same(proto: "label"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._value) + case 2: try decoder.decodeSingularEnumField(value: &self._type) + case 3: try decoder.decodeSingularStringField(value: &self._label) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._value { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } + if let v = self._label { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact.Phone) -> Bool { + if self._value != other._value {return false} + if self._type != other._type {return false} + if self._label != other._label {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_DataMessage.Contact.Phone.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "HOME"), + 2: .same(proto: "MOBILE"), + 3: .same(proto: "WORK"), + 4: .same(proto: "CUSTOM"), + ] +} + +extension SignalService_DataMessage.Contact.Email: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_DataMessage.Contact.protoMessageName + ".Email" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .same(proto: "type"), + 3: .same(proto: "label"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._value) + case 2: try decoder.decodeSingularEnumField(value: &self._type) + case 3: try decoder.decodeSingularStringField(value: &self._label) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._value { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } + if let v = self._label { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact.Email) -> Bool { + if self._value != other._value {return false} + if self._type != other._type {return false} + if self._label != other._label {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_DataMessage.Contact.Email.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "HOME"), + 2: .same(proto: "MOBILE"), + 3: .same(proto: "WORK"), + 4: .same(proto: "CUSTOM"), + ] +} + +extension SignalService_DataMessage.Contact.PostalAddress: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_DataMessage.Contact.protoMessageName + ".PostalAddress" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "label"), + 3: .same(proto: "street"), + 4: .same(proto: "pobox"), + 5: .same(proto: "neighborhood"), + 6: .same(proto: "city"), + 7: .same(proto: "region"), + 8: .same(proto: "postcode"), + 9: .same(proto: "country"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._type) + case 2: try decoder.decodeSingularStringField(value: &self._label) + case 3: try decoder.decodeSingularStringField(value: &self._street) + case 4: try decoder.decodeSingularStringField(value: &self._pobox) + case 5: try decoder.decodeSingularStringField(value: &self._neighborhood) + case 6: try decoder.decodeSingularStringField(value: &self._city) + case 7: try decoder.decodeSingularStringField(value: &self._region) + case 8: try decoder.decodeSingularStringField(value: &self._postcode) + case 9: try decoder.decodeSingularStringField(value: &self._country) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if let v = self._label { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._street { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._pobox { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } + if let v = self._neighborhood { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } + if let v = self._city { + try visitor.visitSingularStringField(value: v, fieldNumber: 6) + } + if let v = self._region { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } + if let v = self._postcode { + try visitor.visitSingularStringField(value: v, fieldNumber: 8) + } + if let v = self._country { + try visitor.visitSingularStringField(value: v, fieldNumber: 9) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact.PostalAddress) -> Bool { + if self._type != other._type {return false} + if self._label != other._label {return false} + if self._street != other._street {return false} + if self._pobox != other._pobox {return false} + if self._neighborhood != other._neighborhood {return false} + if self._city != other._city {return false} + if self._region != other._region {return false} + if self._postcode != other._postcode {return false} + if self._country != other._country {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_DataMessage.Contact.PostalAddress.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "HOME"), + 2: .same(proto: "WORK"), + 3: .same(proto: "CUSTOM"), + ] +} + +extension SignalService_DataMessage.Contact.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_DataMessage.Contact.protoMessageName + ".Avatar" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "avatar"), + 2: .same(proto: "isProfile"), + ] + + fileprivate class _StorageClass { + var _avatar: SignalService_AttachmentPointer? = nil + var _isProfile: Bool? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _avatar = source._avatar + _isProfile = source._isProfile + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._avatar) + case 2: try decoder.decodeSingularBoolField(value: &_storage._isProfile) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._avatar { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = _storage._isProfile { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact.Avatar) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._avatar != other_storage._avatar {return false} + if _storage._isProfile != other_storage._isProfile {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_NullMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NullMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "padding"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self._padding) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._padding { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_NullMessage) -> Bool { + if self._padding != other._padding {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_ReceiptMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ReceiptMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "timestamp"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._type) + case 2: try decoder.decodeRepeatedUInt64Field(value: &self.timestamp) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if !self.timestamp.isEmpty { + try visitor.visitRepeatedUInt64Field(value: self.timestamp, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_ReceiptMessage) -> Bool { + if self._type != other._type {return false} + if self.timestamp != other.timestamp {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_ReceiptMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "DELIVERY"), + 1: .same(proto: "READ"), + ] +} + +extension SignalService_Verified: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Verified" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "destination"), + 2: .same(proto: "identityKey"), + 3: .same(proto: "state"), + 4: .same(proto: "nullMessage"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._destination) + case 2: try decoder.decodeSingularBytesField(value: &self._identityKey) + case 3: try decoder.decodeSingularEnumField(value: &self._state) + case 4: try decoder.decodeSingularBytesField(value: &self._nullMessage) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._destination { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._identityKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } + if let v = self._state { + try visitor.visitSingularEnumField(value: v, fieldNumber: 3) + } + if let v = self._nullMessage { + try visitor.visitSingularBytesField(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_Verified) -> Bool { + if self._destination != other._destination {return false} + if self._identityKey != other._identityKey {return false} + if self._state != other._state {return false} + if self._nullMessage != other._nullMessage {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_Verified.State: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "DEFAULT"), + 1: .same(proto: "VERIFIED"), + 2: .same(proto: "UNVERIFIED"), + ] +} + +extension SignalService_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SyncMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "sent"), + 2: .same(proto: "contacts"), + 3: .same(proto: "groups"), + 4: .same(proto: "request"), + 5: .same(proto: "read"), + 6: .same(proto: "blocked"), + 7: .same(proto: "verified"), + 9: .same(proto: "configuration"), + 8: .same(proto: "padding"), + ] + + fileprivate class _StorageClass { + var _sent: SignalService_SyncMessage.Sent? = nil + var _contacts: SignalService_SyncMessage.Contacts? = nil + var _groups: SignalService_SyncMessage.Groups? = nil + var _request: SignalService_SyncMessage.Request? = nil + var _read: [SignalService_SyncMessage.Read] = [] + var _blocked: SignalService_SyncMessage.Blocked? = nil + var _verified: SignalService_Verified? = nil + var _configuration: SignalService_SyncMessage.Configuration? = nil + var _padding: Data? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _sent = source._sent + _contacts = source._contacts + _groups = source._groups + _request = source._request + _read = source._read + _blocked = source._blocked + _verified = source._verified + _configuration = source._configuration + _padding = source._padding + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._sent) + case 2: try decoder.decodeSingularMessageField(value: &_storage._contacts) + case 3: try decoder.decodeSingularMessageField(value: &_storage._groups) + case 4: try decoder.decodeSingularMessageField(value: &_storage._request) + case 5: try decoder.decodeRepeatedMessageField(value: &_storage._read) + case 6: try decoder.decodeSingularMessageField(value: &_storage._blocked) + case 7: try decoder.decodeSingularMessageField(value: &_storage._verified) + case 8: try decoder.decodeSingularBytesField(value: &_storage._padding) + case 9: try decoder.decodeSingularMessageField(value: &_storage._configuration) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._sent { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = _storage._contacts { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if let v = _storage._groups { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = _storage._request { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if !_storage._read.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._read, fieldNumber: 5) + } + if let v = _storage._blocked { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } + if let v = _storage._verified { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } + if let v = _storage._padding { + try visitor.visitSingularBytesField(value: v, fieldNumber: 8) + } + if let v = _storage._configuration { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._sent != other_storage._sent {return false} + if _storage._contacts != other_storage._contacts {return false} + if _storage._groups != other_storage._groups {return false} + if _storage._request != other_storage._request {return false} + if _storage._read != other_storage._read {return false} + if _storage._blocked != other_storage._blocked {return false} + if _storage._verified != other_storage._verified {return false} + if _storage._configuration != other_storage._configuration {return false} + if _storage._padding != other_storage._padding {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_SyncMessage.Sent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Sent" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "destination"), + 2: .same(proto: "timestamp"), + 3: .same(proto: "message"), + 4: .same(proto: "expirationStartTimestamp"), + ] + + fileprivate class _StorageClass { + var _destination: String? = nil + var _timestamp: UInt64? = nil + var _message: SignalService_DataMessage? = nil + var _expirationStartTimestamp: UInt64? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _destination = source._destination + _timestamp = source._timestamp + _message = source._message + _expirationStartTimestamp = source._expirationStartTimestamp + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &_storage._destination) + case 2: try decoder.decodeSingularUInt64Field(value: &_storage._timestamp) + case 3: try decoder.decodeSingularMessageField(value: &_storage._message) + case 4: try decoder.decodeSingularUInt64Field(value: &_storage._expirationStartTimestamp) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._destination { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = _storage._timestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 2) + } + if let v = _storage._message { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = _storage._expirationStartTimestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 4) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Sent) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._destination != other_storage._destination {return false} + if _storage._timestamp != other_storage._timestamp {return false} + if _storage._message != other_storage._message {return false} + if _storage._expirationStartTimestamp != other_storage._expirationStartTimestamp {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_SyncMessage.Contacts: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Contacts" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "blob"), + 2: .same(proto: "isComplete"), + ] + + fileprivate class _StorageClass { + var _blob: SignalService_AttachmentPointer? = nil + var _isComplete: Bool? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _blob = source._blob + _isComplete = source._isComplete + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._blob) + case 2: try decoder.decodeSingularBoolField(value: &_storage._isComplete) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._blob { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = _storage._isComplete { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Contacts) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._blob != other_storage._blob {return false} + if _storage._isComplete != other_storage._isComplete {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_SyncMessage.Groups: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Groups" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "blob"), + ] + + fileprivate class _StorageClass { + var _blob: SignalService_AttachmentPointer? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _blob = source._blob + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._blob) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._blob { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Groups) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._blob != other_storage._blob {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_SyncMessage.Blocked: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Blocked" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "numbers"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedStringField(value: &self.numbers) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.numbers.isEmpty { + try visitor.visitRepeatedStringField(value: self.numbers, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Blocked) -> Bool { + if self.numbers != other.numbers {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_SyncMessage.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Request" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._type) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Request) -> Bool { + if self._type != other._type {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_SyncMessage.Request.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "CONTACTS"), + 2: .same(proto: "GROUPS"), + 3: .same(proto: "BLOCKED"), + 4: .same(proto: "CONFIGURATION"), + ] +} + +extension SignalService_SyncMessage.Read: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Read" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "sender"), + 2: .same(proto: "timestamp"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._sender) + case 2: try decoder.decodeSingularUInt64Field(value: &self._timestamp) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._sender { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._timestamp { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Read) -> Bool { + if self._sender != other._sender {return false} + if self._timestamp != other._timestamp {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_SyncMessage.Configuration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Configuration" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "readReceipts"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self._readReceipts) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._readReceipts { + try visitor.visitSingularBoolField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Configuration) -> Bool { + if self._readReceipts != other._readReceipts {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_AttachmentPointer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AttachmentPointer" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "contentType"), + 3: .same(proto: "key"), + 4: .same(proto: "size"), + 5: .same(proto: "thumbnail"), + 6: .same(proto: "digest"), + 7: .same(proto: "fileName"), + 8: .same(proto: "flags"), + 9: .same(proto: "width"), + 10: .same(proto: "height"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularFixed64Field(value: &self._id) + case 2: try decoder.decodeSingularStringField(value: &self._contentType) + case 3: try decoder.decodeSingularBytesField(value: &self._key) + case 4: try decoder.decodeSingularUInt32Field(value: &self._size) + case 5: try decoder.decodeSingularBytesField(value: &self._thumbnail) + case 6: try decoder.decodeSingularBytesField(value: &self._digest) + case 7: try decoder.decodeSingularStringField(value: &self._fileName) + case 8: try decoder.decodeSingularUInt32Field(value: &self._flags) + case 9: try decoder.decodeSingularUInt32Field(value: &self._width) + case 10: try decoder.decodeSingularUInt32Field(value: &self._height) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._id { + try visitor.visitSingularFixed64Field(value: v, fieldNumber: 1) + } + if let v = self._contentType { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._key { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } + if let v = self._size { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 4) + } + if let v = self._thumbnail { + try visitor.visitSingularBytesField(value: v, fieldNumber: 5) + } + if let v = self._digest { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + if let v = self._fileName { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } + if let v = self._flags { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 8) + } + if let v = self._width { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 9) + } + if let v = self._height { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 10) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_AttachmentPointer) -> Bool { + if self._id != other._id {return false} + if self._contentType != other._contentType {return false} + if self._key != other._key {return false} + if self._size != other._size {return false} + if self._thumbnail != other._thumbnail {return false} + if self._digest != other._digest {return false} + if self._fileName != other._fileName {return false} + if self._flags != other._flags {return false} + if self._width != other._width {return false} + if self._height != other._height {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_AttachmentPointer.Flags: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "VOICE_MESSAGE"), + ] +} + +extension SignalService_GroupContext: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GroupContext" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "type"), + 3: .same(proto: "name"), + 4: .same(proto: "members"), + 5: .same(proto: "avatar"), + ] + + fileprivate class _StorageClass { + var _id: Data? = nil + var _type: SignalService_GroupContext.TypeEnum? = nil + var _name: String? = nil + var _members: [String] = [] + var _avatar: SignalService_AttachmentPointer? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _id = source._id + _type = source._type + _name = source._name + _members = source._members + _avatar = source._avatar + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &_storage._id) + case 2: try decoder.decodeSingularEnumField(value: &_storage._type) + case 3: try decoder.decodeSingularStringField(value: &_storage._name) + case 4: try decoder.decodeRepeatedStringField(value: &_storage._members) + case 5: try decoder.decodeSingularMessageField(value: &_storage._avatar) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._id { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + if let v = _storage._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } + if let v = _storage._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if !_storage._members.isEmpty { + try visitor.visitRepeatedStringField(value: _storage._members, fieldNumber: 4) + } + if let v = _storage._avatar { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_GroupContext) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._id != other_storage._id {return false} + if _storage._type != other_storage._type {return false} + if _storage._name != other_storage._name {return false} + if _storage._members != other_storage._members {return false} + if _storage._avatar != other_storage._avatar {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_GroupContext.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "UPDATE"), + 2: .same(proto: "DELIVER"), + 3: .same(proto: "QUIT"), + 4: .same(proto: "REQUEST_INFO"), + ] +} + +extension SignalService_ContactDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ContactDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "number"), + 2: .same(proto: "name"), + 3: .same(proto: "avatar"), + 4: .same(proto: "color"), + 5: .same(proto: "verified"), + 6: .same(proto: "profileKey"), + 7: .same(proto: "blocked"), + 8: .same(proto: "expireTimer"), + ] + + fileprivate class _StorageClass { + var _number: String? = nil + var _name: String? = nil + var _avatar: SignalService_ContactDetails.Avatar? = nil + var _color: String? = nil + var _verified: SignalService_Verified? = nil + var _profileKey: Data? = nil + var _blocked: Bool? = nil + var _expireTimer: UInt32? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _number = source._number + _name = source._name + _avatar = source._avatar + _color = source._color + _verified = source._verified + _profileKey = source._profileKey + _blocked = source._blocked + _expireTimer = source._expireTimer + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &_storage._number) + case 2: try decoder.decodeSingularStringField(value: &_storage._name) + case 3: try decoder.decodeSingularMessageField(value: &_storage._avatar) + case 4: try decoder.decodeSingularStringField(value: &_storage._color) + case 5: try decoder.decodeSingularMessageField(value: &_storage._verified) + case 6: try decoder.decodeSingularBytesField(value: &_storage._profileKey) + case 7: try decoder.decodeSingularBoolField(value: &_storage._blocked) + case 8: try decoder.decodeSingularUInt32Field(value: &_storage._expireTimer) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._number { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = _storage._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = _storage._avatar { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = _storage._color { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } + if let v = _storage._verified { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if let v = _storage._profileKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + if let v = _storage._blocked { + try visitor.visitSingularBoolField(value: v, fieldNumber: 7) + } + if let v = _storage._expireTimer { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 8) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_ContactDetails) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._number != other_storage._number {return false} + if _storage._name != other_storage._name {return false} + if _storage._avatar != other_storage._avatar {return false} + if _storage._color != other_storage._color {return false} + if _storage._verified != other_storage._verified {return false} + if _storage._profileKey != other_storage._profileKey {return false} + if _storage._blocked != other_storage._blocked {return false} + if _storage._expireTimer != other_storage._expireTimer {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_ContactDetails.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_ContactDetails.protoMessageName + ".Avatar" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "contentType"), + 2: .same(proto: "length"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._contentType) + case 2: try decoder.decodeSingularUInt32Field(value: &self._length) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._contentType { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._length { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_ContactDetails.Avatar) -> Bool { + if self._contentType != other._contentType {return false} + if self._length != other._length {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_GroupDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GroupDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "name"), + 3: .same(proto: "members"), + 4: .same(proto: "avatar"), + 5: .same(proto: "active"), + 6: .same(proto: "expireTimer"), + 7: .same(proto: "color"), + ] + + fileprivate class _StorageClass { + var _id: Data? = nil + var _name: String? = nil + var _members: [String] = [] + var _avatar: SignalService_GroupDetails.Avatar? = nil + var _active: Bool? = nil + var _expireTimer: UInt32? = nil + var _color: String? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _id = source._id + _name = source._name + _members = source._members + _avatar = source._avatar + _active = source._active + _expireTimer = source._expireTimer + _color = source._color + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &_storage._id) + case 2: try decoder.decodeSingularStringField(value: &_storage._name) + case 3: try decoder.decodeRepeatedStringField(value: &_storage._members) + case 4: try decoder.decodeSingularMessageField(value: &_storage._avatar) + case 5: try decoder.decodeSingularBoolField(value: &_storage._active) + case 6: try decoder.decodeSingularUInt32Field(value: &_storage._expireTimer) + case 7: try decoder.decodeSingularStringField(value: &_storage._color) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._id { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + if let v = _storage._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if !_storage._members.isEmpty { + try visitor.visitRepeatedStringField(value: _storage._members, fieldNumber: 3) + } + if let v = _storage._avatar { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if let v = _storage._active { + try visitor.visitSingularBoolField(value: v, fieldNumber: 5) + } + if let v = _storage._expireTimer { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 6) + } + if let v = _storage._color { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_GroupDetails) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._id != other_storage._id {return false} + if _storage._name != other_storage._name {return false} + if _storage._members != other_storage._members {return false} + if _storage._avatar != other_storage._avatar {return false} + if _storage._active != other_storage._active {return false} + if _storage._expireTimer != other_storage._expireTimer {return false} + if _storage._color != other_storage._color {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension SignalService_GroupDetails.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalService_GroupDetails.protoMessageName + ".Avatar" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "contentType"), + 2: .same(proto: "length"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._contentType) + case 2: try decoder.decodeSingularUInt32Field(value: &self._length) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._contentType { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._length { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: SignalService_GroupDetails.Avatar) -> Bool { + if self._contentType != other._contentType {return false} + if self._length != other._length {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} diff --git a/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift b/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift new file mode 100644 index 0000000000..3a6a1abbb8 --- /dev/null +++ b/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift @@ -0,0 +1,149 @@ +// +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// + +import Foundation + +@objc +public class SSKEnvelope: NSObject { + + enum EnvelopeError: Error { + case invalidProtobuf(description: String) + } + + @objc + public enum SSKEnvelopeType: Int32 { + case unknown = 0 + case ciphertext = 1 + case keyExchange = 2 + case prekeyBundle = 3 + case receipt = 5 + } + + @objc + public let timestamp: UInt64 + + @objc + public let source: String + + @objc + public let sourceDevice: UInt32 + + @objc + public let type: SSKEnvelopeType + + @objc + public let relay: String? + + @objc + public let content: Data? + + @objc + public let legacyMessage: Data? + + @objc + public init(timestamp: UInt64, source: String, sourceDevice: UInt32, type: SSKEnvelopeType, content: Data?, legacyMessage: Data?) { + self.source = source + self.type = type + self.timestamp = timestamp + self.sourceDevice = sourceDevice + self.relay = nil + self.content = content + self.legacyMessage = legacyMessage + } + + @objc + public init(serializedData: Data) throws { + let proto: SignalService_Envelope = try SignalService_Envelope(serializedData: serializedData) + + guard proto.hasSource else { + throw EnvelopeError.invalidProtobuf(description: "missing required field: source") + } + self.source = proto.source + + guard proto.hasType else { + throw EnvelopeError.invalidProtobuf(description: "missing required field: type") + } + self.type = { + switch proto.type { + case .unknown: + return .unknown + case .ciphertext: + return .ciphertext + case .keyExchange: + return .keyExchange + case .prekeyBundle: + return .prekeyBundle + case .receipt: + return .receipt + } + }() + + guard proto.hasTimestamp else { + throw EnvelopeError.invalidProtobuf(description: "missing required field: timestamp") + } + self.timestamp = proto.timestamp + + guard proto.hasSourceDevice else { + throw EnvelopeError.invalidProtobuf(description: "missing required field: sourceDevice") + } + self.sourceDevice = proto.sourceDevice + + if proto.hasContent { + self.content = proto.content + } else { + self.content = nil + } + + if proto.hasLegacyMessage { + self.legacyMessage = proto.legacyMessage + } else { + self.legacyMessage = nil + } + + if proto.relay.count > 0 { + self.relay = proto.relay + } else { + relay = nil + } + } + + @objc + public func serializedData() throws -> Data { + return try self.asProtobuf.serializedData() + } + + private var asProtobuf: SignalService_Envelope { + var proto = SignalService_Envelope() + + proto.source = self.source + + proto.type = { + switch self.type { + case .unknown: + return .unknown + case .ciphertext: + return .ciphertext + case .keyExchange: + return .keyExchange + case .prekeyBundle: + return .prekeyBundle + case .receipt: + return .receipt + } + }() + + proto.timestamp = self.timestamp + proto.sourceDevice = self.sourceDevice + + if let relay = self.relay { + proto.relay = relay + } + + if let content = self.content { + proto.content = content + } + + return proto + } +} From 9299c5e57328a89798112c8b06de2c7628044e15 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 25 Jul 2018 13:46:49 -0600 Subject: [PATCH 2/7] CR: tweak proto class name, include yet-to-be-used protos // FREEBIE --- Pods | 2 +- ...gerprintProtos.proto => Fingerprint.proto} | 3 +- SignalServiceKit/protobuf/Makefile | 26 +- ...sioningProtos.proto => Provisioning.proto} | 2 +- ...SSignaliOSProtos.proto => SignalIOS.proto} | 3 +- ...erviceProtos.proto => SignalService.proto} | 3 +- .../protobuf/WebSocketResources.proto | 3 +- .../src/Protos/Generated/Fingerprint.pb.swift | 194 ++++++++ .../{ => Generated}/OWSSignaliOSProtos.pb.h | 0 .../{ => Generated}/OWSSignaliOSProtos.pb.m | 0 .../Protos/Generated/Provisioning.pb.swift | 245 +++++++++ .../src/Protos/Generated/SignalIOS.pb.swift | 184 +++++++ .../SignalService.pb.swift} | 469 +++++++++--------- .../Generated/WebSocketResources.pb.swift | 397 +++++++++++++++ .../Protos/ProtoWrappers/SSKEnvelope.swift | 6 +- 15 files changed, 1284 insertions(+), 253 deletions(-) rename SignalServiceKit/protobuf/{OWSFingerprintProtos.proto => Fingerprint.proto} (87%) rename SignalServiceKit/protobuf/{OWSProvisioningProtos.proto => Provisioning.proto} (96%) rename SignalServiceKit/protobuf/{OWSSignaliOSProtos.proto => SignalIOS.proto} (89%) rename SignalServiceKit/protobuf/{OWSSignalServiceProtos.proto => SignalService.proto} (99%) create mode 100644 SignalServiceKit/src/Protos/Generated/Fingerprint.pb.swift rename SignalServiceKit/src/Protos/{ => Generated}/OWSSignaliOSProtos.pb.h (100%) rename SignalServiceKit/src/Protos/{ => Generated}/OWSSignaliOSProtos.pb.m (100%) create mode 100644 SignalServiceKit/src/Protos/Generated/Provisioning.pb.swift create mode 100644 SignalServiceKit/src/Protos/Generated/SignalIOS.pb.swift rename SignalServiceKit/src/Protos/{OWSSignalServiceProtos.pb.swift => Generated/SignalService.pb.swift} (88%) create mode 100644 SignalServiceKit/src/Protos/Generated/WebSocketResources.pb.swift diff --git a/Pods b/Pods index 2474b814b3..54d12b0ebb 160000 --- a/Pods +++ b/Pods @@ -1 +1 @@ -Subproject commit 2474b814b3108d9684effcdfe460c5ff42d3cbbe +Subproject commit 54d12b0ebb624542f3aa93d075b5f5ae02ecefc4 diff --git a/SignalServiceKit/protobuf/OWSFingerprintProtos.proto b/SignalServiceKit/protobuf/Fingerprint.proto similarity index 87% rename from SignalServiceKit/protobuf/OWSFingerprintProtos.proto rename to SignalServiceKit/protobuf/Fingerprint.proto index 8f82b73c6b..22a8e65412 100644 --- a/SignalServiceKit/protobuf/OWSFingerprintProtos.proto +++ b/SignalServiceKit/protobuf/Fingerprint.proto @@ -2,7 +2,8 @@ // the legacy proto format. syntax = "proto2"; -package textsecure; +// iOS - package name determines class prefix +package FingerprintProtos; option java_package = "org.whispersystems.libsignal.fingerprint"; option java_outer_classname = "FingerprintProtos"; diff --git a/SignalServiceKit/protobuf/Makefile b/SignalServiceKit/protobuf/Makefile index 484e3f406f..469aad87ca 100644 --- a/SignalServiceKit/protobuf/Makefile +++ b/SignalServiceKit/protobuf/Makefile @@ -3,20 +3,24 @@ PROTOC=protoc \ --proto_path='./' -all: signal_service_proto provisioning_protos fingerprint_protos websocket_protos +all: signal_service_protos provisioning_protos fingerprint_protos websocket_protos signal_ios_protos -signal_service_proto: OWSSignalServiceProtos.proto - $(PROTOC) --swift_out=../src/Protos/ \ - OWSSignalServiceProtos.proto +signal_service_protos: SignalService.proto + $(PROTOC) --swift_out=../src/Protos/Generated \ + SignalService.proto -provisioning_protos: OWSProvisioningProtos.proto - $(PROTOC) --swift_out=../src/Protos/ \ - OWSProvisioningProtos.proto +provisioning_protos: Provisioning.proto + $(PROTOC) --swift_out=../src/Protos/Generated \ + Provisioning.proto -fingerprint_protos: OWSFingerprintProtos.proto - $(PROTOC) --swift_out=../src/Protos/ \ - OWSFingerprintProtos.proto +fingerprint_protos: Fingerprint.proto + $(PROTOC) --swift_out=../src/Protos/Generated \ + Fingerprint.proto websocket_protos: WebSocketResources.proto - $(PROTOC) --swift_out=../src/Protos/ \ + $(PROTOC) --swift_out=../src/Protos/Generated \ WebSocketResources.proto + +signal_ios_protos: SignalIOS.proto + $(PROTOC) --swift_out=../src/Protos/Generated \ + SignalIOS.proto diff --git a/SignalServiceKit/protobuf/OWSProvisioningProtos.proto b/SignalServiceKit/protobuf/Provisioning.proto similarity index 96% rename from SignalServiceKit/protobuf/OWSProvisioningProtos.proto rename to SignalServiceKit/protobuf/Provisioning.proto index 7e7bddd799..065b94a5e1 100644 --- a/SignalServiceKit/protobuf/OWSProvisioningProtos.proto +++ b/SignalServiceKit/protobuf/Provisioning.proto @@ -8,7 +8,7 @@ // the legacy proto format. syntax = "proto2"; -package signalservice; +package ProvisioningProto; option java_package = "org.whispersystems.signalservice.internal.push"; option java_outer_classname = "ProvisioningProtos"; diff --git a/SignalServiceKit/protobuf/OWSSignaliOSProtos.proto b/SignalServiceKit/protobuf/SignalIOS.proto similarity index 89% rename from SignalServiceKit/protobuf/OWSSignaliOSProtos.proto rename to SignalServiceKit/protobuf/SignalIOS.proto index c1caee53eb..d118423b5a 100644 --- a/SignalServiceKit/protobuf/OWSSignaliOSProtos.proto +++ b/SignalServiceKit/protobuf/SignalIOS.proto @@ -8,7 +8,8 @@ // the legacy proto format. syntax = "proto2"; -package signalios; +// iOS - package name determines class prefix +package IOSProtos; message BackupSnapshot { diff --git a/SignalServiceKit/protobuf/OWSSignalServiceProtos.proto b/SignalServiceKit/protobuf/SignalService.proto similarity index 99% rename from SignalServiceKit/protobuf/OWSSignalServiceProtos.proto rename to SignalServiceKit/protobuf/SignalService.proto index cebe5945b9..83cce06167 100644 --- a/SignalServiceKit/protobuf/OWSSignalServiceProtos.proto +++ b/SignalServiceKit/protobuf/SignalService.proto @@ -8,7 +8,8 @@ // the legacy proto format. syntax = "proto2"; -package SignalService; +// iOS - package name determines class prefix +package SignalServiceProtos; option java_package = "org.whispersystems.signalservice.internal.push"; option java_outer_classname = "SignalServiceProtos"; diff --git a/SignalServiceKit/protobuf/WebSocketResources.proto b/SignalServiceKit/protobuf/WebSocketResources.proto index d054301a1e..c141d9f9c2 100644 --- a/SignalServiceKit/protobuf/WebSocketResources.proto +++ b/SignalServiceKit/protobuf/WebSocketResources.proto @@ -8,7 +8,8 @@ // the legacy proto format. syntax = "proto2"; -package signalservice; +// iOS - package name determines class prefix +package WebSocketProtos; option java_package = "org.whispersystems.signalservice.internal.websocket"; option java_outer_classname = "WebSocketProtos"; diff --git a/SignalServiceKit/src/Protos/Generated/Fingerprint.pb.swift b/SignalServiceKit/src/Protos/Generated/Fingerprint.pb.swift new file mode 100644 index 0000000000..7357c30853 --- /dev/null +++ b/SignalServiceKit/src/Protos/Generated/Fingerprint.pb.swift @@ -0,0 +1,194 @@ +// DO NOT EDIT. +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: Fingerprint.proto +// +// For information on using the generated types, please see the documenation: +// https://github.com/apple/swift-protobuf/ + +/// iOS - since we use a modern proto-compiler, we must specify +/// the legacy proto format. + +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 your 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 +} + +struct FingerprintProtos_LogicalFingerprint { + // 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. + + /// optional bytes identifier = 2; + var identityData: Data { + get {return _identityData ?? SwiftProtobuf.Internal.emptyData} + set {_identityData = newValue} + } + /// Returns true if `identityData` has been explicitly set. + var hasIdentityData: Bool {return self._identityData != nil} + /// Clears the value of `identityData`. Subsequent reads from it will return its default value. + mutating func clearIdentityData() {self._identityData = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _identityData: Data? = nil +} + +struct FingerprintProtos_LogicalFingerprints { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var version: UInt32 { + get {return _storage._version ?? 0} + set {_uniqueStorage()._version = newValue} + } + /// Returns true if `version` has been explicitly set. + var hasVersion: Bool {return _storage._version != nil} + /// Clears the value of `version`. Subsequent reads from it will return its default value. + mutating func clearVersion() {_storage._version = nil} + + var localFingerprint: FingerprintProtos_LogicalFingerprint { + get {return _storage._localFingerprint ?? FingerprintProtos_LogicalFingerprint()} + set {_uniqueStorage()._localFingerprint = newValue} + } + /// Returns true if `localFingerprint` has been explicitly set. + var hasLocalFingerprint: Bool {return _storage._localFingerprint != nil} + /// Clears the value of `localFingerprint`. Subsequent reads from it will return its default value. + mutating func clearLocalFingerprint() {_storage._localFingerprint = nil} + + var remoteFingerprint: FingerprintProtos_LogicalFingerprint { + get {return _storage._remoteFingerprint ?? FingerprintProtos_LogicalFingerprint()} + set {_uniqueStorage()._remoteFingerprint = newValue} + } + /// Returns true if `remoteFingerprint` has been explicitly set. + var hasRemoteFingerprint: Bool {return _storage._remoteFingerprint != nil} + /// Clears the value of `remoteFingerprint`. Subsequent reads from it will return its default value. + mutating func clearRemoteFingerprint() {_storage._remoteFingerprint = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "FingerprintProtos" + +extension FingerprintProtos_LogicalFingerprint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LogicalFingerprint" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "identityData"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self._identityData) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._identityData { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: FingerprintProtos_LogicalFingerprint) -> Bool { + if self._identityData != other._identityData {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension FingerprintProtos_LogicalFingerprints: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LogicalFingerprints" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "version"), + 2: .same(proto: "localFingerprint"), + 3: .same(proto: "remoteFingerprint"), + ] + + fileprivate class _StorageClass { + var _version: UInt32? = nil + var _localFingerprint: FingerprintProtos_LogicalFingerprint? = nil + var _remoteFingerprint: FingerprintProtos_LogicalFingerprint? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _version = source._version + _localFingerprint = source._localFingerprint + _remoteFingerprint = source._remoteFingerprint + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt32Field(value: &_storage._version) + case 2: try decoder.decodeSingularMessageField(value: &_storage._localFingerprint) + case 3: try decoder.decodeSingularMessageField(value: &_storage._remoteFingerprint) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._version { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 1) + } + if let v = _storage._localFingerprint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if let v = _storage._remoteFingerprint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: FingerprintProtos_LogicalFingerprints) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._version != other_storage._version {return false} + if _storage._localFingerprint != other_storage._localFingerprint {return false} + if _storage._remoteFingerprint != other_storage._remoteFingerprint {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} diff --git a/SignalServiceKit/src/Protos/OWSSignaliOSProtos.pb.h b/SignalServiceKit/src/Protos/Generated/OWSSignaliOSProtos.pb.h similarity index 100% rename from SignalServiceKit/src/Protos/OWSSignaliOSProtos.pb.h rename to SignalServiceKit/src/Protos/Generated/OWSSignaliOSProtos.pb.h diff --git a/SignalServiceKit/src/Protos/OWSSignaliOSProtos.pb.m b/SignalServiceKit/src/Protos/Generated/OWSSignaliOSProtos.pb.m similarity index 100% rename from SignalServiceKit/src/Protos/OWSSignaliOSProtos.pb.m rename to SignalServiceKit/src/Protos/Generated/OWSSignaliOSProtos.pb.m diff --git a/SignalServiceKit/src/Protos/Generated/Provisioning.pb.swift b/SignalServiceKit/src/Protos/Generated/Provisioning.pb.swift new file mode 100644 index 0000000000..42732a28af --- /dev/null +++ b/SignalServiceKit/src/Protos/Generated/Provisioning.pb.swift @@ -0,0 +1,245 @@ +// DO NOT EDIT. +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: Provisioning.proto +// +// For information on using the generated types, please see the documenation: +// https://github.com/apple/swift-protobuf/ + +//* +// Copyright (C) 2014-2016 Open Whisper Systems +// +// Licensed according to the LICENSE file in this repository. + +/// iOS - since we use a modern proto-compiler, we must specify +/// the legacy proto format. + +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 your 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 +} + +struct ProvisioningProto_ProvisionEnvelope { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var publicKey: Data { + get {return _publicKey ?? SwiftProtobuf.Internal.emptyData} + set {_publicKey = newValue} + } + /// Returns true if `publicKey` has been explicitly set. + var hasPublicKey: Bool {return self._publicKey != nil} + /// Clears the value of `publicKey`. Subsequent reads from it will return its default value. + mutating func clearPublicKey() {self._publicKey = nil} + + /// Encrypted ProvisionMessage + var body: Data { + get {return _body ?? SwiftProtobuf.Internal.emptyData} + set {_body = newValue} + } + /// Returns true if `body` has been explicitly set. + var hasBody: Bool {return self._body != nil} + /// Clears the value of `body`. Subsequent reads from it will return its default value. + mutating func clearBody() {self._body = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _publicKey: Data? = nil + fileprivate var _body: Data? = nil +} + +struct ProvisioningProto_ProvisionMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var identityKeyPublic: Data { + get {return _identityKeyPublic ?? SwiftProtobuf.Internal.emptyData} + set {_identityKeyPublic = newValue} + } + /// Returns true if `identityKeyPublic` has been explicitly set. + var hasIdentityKeyPublic: Bool {return self._identityKeyPublic != nil} + /// Clears the value of `identityKeyPublic`. Subsequent reads from it will return its default value. + mutating func clearIdentityKeyPublic() {self._identityKeyPublic = nil} + + var identityKeyPrivate: Data { + get {return _identityKeyPrivate ?? SwiftProtobuf.Internal.emptyData} + set {_identityKeyPrivate = newValue} + } + /// Returns true if `identityKeyPrivate` has been explicitly set. + var hasIdentityKeyPrivate: Bool {return self._identityKeyPrivate != nil} + /// Clears the value of `identityKeyPrivate`. Subsequent reads from it will return its default value. + mutating func clearIdentityKeyPrivate() {self._identityKeyPrivate = nil} + + var number: String { + get {return _number ?? String()} + set {_number = newValue} + } + /// Returns true if `number` has been explicitly set. + var hasNumber: Bool {return self._number != nil} + /// Clears the value of `number`. Subsequent reads from it will return its default value. + mutating func clearNumber() {self._number = nil} + + var provisioningCode: String { + get {return _provisioningCode ?? String()} + set {_provisioningCode = newValue} + } + /// Returns true if `provisioningCode` has been explicitly set. + var hasProvisioningCode: Bool {return self._provisioningCode != nil} + /// Clears the value of `provisioningCode`. Subsequent reads from it will return its default value. + mutating func clearProvisioningCode() {self._provisioningCode = nil} + + var userAgent: String { + get {return _userAgent ?? String()} + set {_userAgent = newValue} + } + /// Returns true if `userAgent` has been explicitly set. + var hasUserAgent: Bool {return self._userAgent != nil} + /// Clears the value of `userAgent`. Subsequent reads from it will return its default value. + mutating func clearUserAgent() {self._userAgent = nil} + + var profileKey: Data { + get {return _profileKey ?? SwiftProtobuf.Internal.emptyData} + set {_profileKey = newValue} + } + /// Returns true if `profileKey` has been explicitly set. + var hasProfileKey: Bool {return self._profileKey != nil} + /// Clears the value of `profileKey`. Subsequent reads from it will return its default value. + mutating func clearProfileKey() {self._profileKey = nil} + + var readReceipts: Bool { + get {return _readReceipts ?? false} + set {_readReceipts = newValue} + } + /// Returns true if `readReceipts` has been explicitly set. + var hasReadReceipts: Bool {return self._readReceipts != nil} + /// Clears the value of `readReceipts`. Subsequent reads from it will return its default value. + mutating func clearReadReceipts() {self._readReceipts = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _identityKeyPublic: Data? = nil + fileprivate var _identityKeyPrivate: Data? = nil + fileprivate var _number: String? = nil + fileprivate var _provisioningCode: String? = nil + fileprivate var _userAgent: String? = nil + fileprivate var _profileKey: Data? = nil + fileprivate var _readReceipts: Bool? = nil +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "ProvisioningProto" + +extension ProvisioningProto_ProvisionEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ProvisionEnvelope" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "publicKey"), + 2: .same(proto: "body"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self._publicKey) + case 2: try decoder.decodeSingularBytesField(value: &self._body) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._publicKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + if let v = self._body { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: ProvisioningProto_ProvisionEnvelope) -> Bool { + if self._publicKey != other._publicKey {return false} + if self._body != other._body {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension ProvisioningProto_ProvisionMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ProvisionMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "identityKeyPublic"), + 2: .same(proto: "identityKeyPrivate"), + 3: .same(proto: "number"), + 4: .same(proto: "provisioningCode"), + 5: .same(proto: "userAgent"), + 6: .same(proto: "profileKey"), + 7: .same(proto: "readReceipts"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self._identityKeyPublic) + case 2: try decoder.decodeSingularBytesField(value: &self._identityKeyPrivate) + case 3: try decoder.decodeSingularStringField(value: &self._number) + case 4: try decoder.decodeSingularStringField(value: &self._provisioningCode) + case 5: try decoder.decodeSingularStringField(value: &self._userAgent) + case 6: try decoder.decodeSingularBytesField(value: &self._profileKey) + case 7: try decoder.decodeSingularBoolField(value: &self._readReceipts) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._identityKeyPublic { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } + if let v = self._identityKeyPrivate { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } + if let v = self._number { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._provisioningCode { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } + if let v = self._userAgent { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } + if let v = self._profileKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } + if let v = self._readReceipts { + try visitor.visitSingularBoolField(value: v, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: ProvisioningProto_ProvisionMessage) -> Bool { + if self._identityKeyPublic != other._identityKeyPublic {return false} + if self._identityKeyPrivate != other._identityKeyPrivate {return false} + if self._number != other._number {return false} + if self._provisioningCode != other._provisioningCode {return false} + if self._userAgent != other._userAgent {return false} + if self._profileKey != other._profileKey {return false} + if self._readReceipts != other._readReceipts {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} diff --git a/SignalServiceKit/src/Protos/Generated/SignalIOS.pb.swift b/SignalServiceKit/src/Protos/Generated/SignalIOS.pb.swift new file mode 100644 index 0000000000..0ac4740f9a --- /dev/null +++ b/SignalServiceKit/src/Protos/Generated/SignalIOS.pb.swift @@ -0,0 +1,184 @@ +// DO NOT EDIT. +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: SignalIOS.proto +// +// For information on using the generated types, please see the documenation: +// https://github.com/apple/swift-protobuf/ + +//* +// Copyright (C) 2014-2016 Open Whisper Systems +// +// Licensed according to the LICENSE file in this repository. + +/// iOS - since we use a modern proto-compiler, we must specify +/// the legacy proto format. + +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 your 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 +} + +struct IOSProtos_BackupSnapshot { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var entity: [IOSProtos_BackupSnapshot.BackupEntity] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct BackupEntity { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: IOSProtos_BackupSnapshot.BackupEntity.TypeEnum { + get {return _type ?? .unknown} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var entityData: Data { + get {return _entityData ?? SwiftProtobuf.Internal.emptyData} + set {_entityData = newValue} + } + /// Returns true if `entityData` has been explicitly set. + var hasEntityData: Bool {return self._entityData != nil} + /// Clears the value of `entityData`. Subsequent reads from it will return its default value. + mutating func clearEntityData() {self._entityData = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case migration // = 1 + case thread // = 2 + case interaction // = 3 + case attachment // = 4 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .migration + case 2: self = .thread + case 3: self = .interaction + case 4: self = .attachment + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .migration: return 1 + case .thread: return 2 + case .interaction: return 3 + case .attachment: return 4 + } + } + + } + + init() {} + + fileprivate var _type: IOSProtos_BackupSnapshot.BackupEntity.TypeEnum? = nil + fileprivate var _entityData: Data? = nil + } + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "IOSProtos" + +extension IOSProtos_BackupSnapshot: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BackupSnapshot" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "entity"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.entity) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.entity.isEmpty { + try visitor.visitRepeatedMessageField(value: self.entity, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: IOSProtos_BackupSnapshot) -> Bool { + if self.entity != other.entity {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension IOSProtos_BackupSnapshot.BackupEntity: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = IOSProtos_BackupSnapshot.protoMessageName + ".BackupEntity" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "entityData"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._type) + case 2: try decoder.decodeSingularBytesField(value: &self._entityData) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if let v = self._entityData { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: IOSProtos_BackupSnapshot.BackupEntity) -> Bool { + if self._type != other._type {return false} + if self._entityData != other._entityData {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension IOSProtos_BackupSnapshot.BackupEntity.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "MIGRATION"), + 2: .same(proto: "THREAD"), + 3: .same(proto: "INTERACTION"), + 4: .same(proto: "ATTACHMENT"), + ] +} diff --git a/SignalServiceKit/src/Protos/OWSSignalServiceProtos.pb.swift b/SignalServiceKit/src/Protos/Generated/SignalService.pb.swift similarity index 88% rename from SignalServiceKit/src/Protos/OWSSignalServiceProtos.pb.swift rename to SignalServiceKit/src/Protos/Generated/SignalService.pb.swift index f5c5cefdb7..d0e63089ac 100644 --- a/SignalServiceKit/src/Protos/OWSSignalServiceProtos.pb.swift +++ b/SignalServiceKit/src/Protos/Generated/SignalService.pb.swift @@ -1,7 +1,7 @@ // DO NOT EDIT. // // Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: OWSSignalServiceProtos.proto +// Source: SignalService.proto // // For information on using the generated types, please see the documenation: // https://github.com/apple/swift-protobuf/ @@ -11,6 +11,9 @@ // // Licensed according to the LICENSE file in this repository. +/// iOS - since we use a modern proto-compiler, we must specify +/// the legacy proto format. + import Foundation import SwiftProtobuf @@ -24,12 +27,12 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -struct SignalService_Envelope { +struct SignalServiceProtos_Envelope { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var type: SignalService_Envelope.TypeEnum { + var type: SignalServiceProtos_Envelope.TypeEnum { get {return _type ?? .unknown} set {_type = newValue} } @@ -133,7 +136,7 @@ struct SignalService_Envelope { init() {} - fileprivate var _type: SignalService_Envelope.TypeEnum? = nil + fileprivate var _type: SignalServiceProtos_Envelope.TypeEnum? = nil fileprivate var _source: String? = nil fileprivate var _sourceDevice: UInt32? = nil fileprivate var _relay: String? = nil @@ -142,13 +145,13 @@ struct SignalService_Envelope { fileprivate var _content: Data? = nil } -struct SignalService_Content { +struct SignalServiceProtos_Content { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var dataMessage: SignalService_DataMessage { - get {return _storage._dataMessage ?? SignalService_DataMessage()} + var dataMessage: SignalServiceProtos_DataMessage { + get {return _storage._dataMessage ?? SignalServiceProtos_DataMessage()} set {_uniqueStorage()._dataMessage = newValue} } /// Returns true if `dataMessage` has been explicitly set. @@ -156,8 +159,8 @@ struct SignalService_Content { /// Clears the value of `dataMessage`. Subsequent reads from it will return its default value. mutating func clearDataMessage() {_storage._dataMessage = nil} - var syncMessage: SignalService_SyncMessage { - get {return _storage._syncMessage ?? SignalService_SyncMessage()} + var syncMessage: SignalServiceProtos_SyncMessage { + get {return _storage._syncMessage ?? SignalServiceProtos_SyncMessage()} set {_uniqueStorage()._syncMessage = newValue} } /// Returns true if `syncMessage` has been explicitly set. @@ -165,8 +168,8 @@ struct SignalService_Content { /// Clears the value of `syncMessage`. Subsequent reads from it will return its default value. mutating func clearSyncMessage() {_storage._syncMessage = nil} - var callMessage: SignalService_CallMessage { - get {return _storage._callMessage ?? SignalService_CallMessage()} + var callMessage: SignalServiceProtos_CallMessage { + get {return _storage._callMessage ?? SignalServiceProtos_CallMessage()} set {_uniqueStorage()._callMessage = newValue} } /// Returns true if `callMessage` has been explicitly set. @@ -174,8 +177,8 @@ struct SignalService_Content { /// Clears the value of `callMessage`. Subsequent reads from it will return its default value. mutating func clearCallMessage() {_storage._callMessage = nil} - var nullMessage: SignalService_NullMessage { - get {return _storage._nullMessage ?? SignalService_NullMessage()} + var nullMessage: SignalServiceProtos_NullMessage { + get {return _storage._nullMessage ?? SignalServiceProtos_NullMessage()} set {_uniqueStorage()._nullMessage = newValue} } /// Returns true if `nullMessage` has been explicitly set. @@ -183,8 +186,8 @@ struct SignalService_Content { /// Clears the value of `nullMessage`. Subsequent reads from it will return its default value. mutating func clearNullMessage() {_storage._nullMessage = nil} - var receiptMessage: SignalService_ReceiptMessage { - get {return _storage._receiptMessage ?? SignalService_ReceiptMessage()} + var receiptMessage: SignalServiceProtos_ReceiptMessage { + get {return _storage._receiptMessage ?? SignalServiceProtos_ReceiptMessage()} set {_uniqueStorage()._receiptMessage = newValue} } /// Returns true if `receiptMessage` has been explicitly set. @@ -199,13 +202,13 @@ struct SignalService_Content { fileprivate var _storage = _StorageClass.defaultInstance } -struct SignalService_CallMessage { +struct SignalServiceProtos_CallMessage { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var offer: SignalService_CallMessage.Offer { - get {return _storage._offer ?? SignalService_CallMessage.Offer()} + var offer: SignalServiceProtos_CallMessage.Offer { + get {return _storage._offer ?? SignalServiceProtos_CallMessage.Offer()} set {_uniqueStorage()._offer = newValue} } /// Returns true if `offer` has been explicitly set. @@ -213,8 +216,8 @@ struct SignalService_CallMessage { /// Clears the value of `offer`. Subsequent reads from it will return its default value. mutating func clearOffer() {_storage._offer = nil} - var answer: SignalService_CallMessage.Answer { - get {return _storage._answer ?? SignalService_CallMessage.Answer()} + var answer: SignalServiceProtos_CallMessage.Answer { + get {return _storage._answer ?? SignalServiceProtos_CallMessage.Answer()} set {_uniqueStorage()._answer = newValue} } /// Returns true if `answer` has been explicitly set. @@ -222,13 +225,13 @@ struct SignalService_CallMessage { /// Clears the value of `answer`. Subsequent reads from it will return its default value. mutating func clearAnswer() {_storage._answer = nil} - var iceUpdate: [SignalService_CallMessage.IceUpdate] { + var iceUpdate: [SignalServiceProtos_CallMessage.IceUpdate] { get {return _storage._iceUpdate} set {_uniqueStorage()._iceUpdate = newValue} } - var hangup: SignalService_CallMessage.Hangup { - get {return _storage._hangup ?? SignalService_CallMessage.Hangup()} + var hangup: SignalServiceProtos_CallMessage.Hangup { + get {return _storage._hangup ?? SignalServiceProtos_CallMessage.Hangup()} set {_uniqueStorage()._hangup = newValue} } /// Returns true if `hangup` has been explicitly set. @@ -236,8 +239,8 @@ struct SignalService_CallMessage { /// Clears the value of `hangup`. Subsequent reads from it will return its default value. mutating func clearHangup() {_storage._hangup = nil} - var busy: SignalService_CallMessage.Busy { - get {return _storage._busy ?? SignalService_CallMessage.Busy()} + var busy: SignalServiceProtos_CallMessage.Busy { + get {return _storage._busy ?? SignalServiceProtos_CallMessage.Busy()} set {_uniqueStorage()._busy = newValue} } /// Returns true if `busy` has been explicitly set. @@ -422,7 +425,7 @@ struct SignalService_CallMessage { fileprivate var _storage = _StorageClass.defaultInstance } -struct SignalService_DataMessage { +struct SignalServiceProtos_DataMessage { // 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. @@ -436,13 +439,13 @@ struct SignalService_DataMessage { /// Clears the value of `body`. Subsequent reads from it will return its default value. mutating func clearBody() {_storage._body = nil} - var attachments: [SignalService_AttachmentPointer] { + var attachments: [SignalServiceProtos_AttachmentPointer] { get {return _storage._attachments} set {_uniqueStorage()._attachments = newValue} } - var group: SignalService_GroupContext { - get {return _storage._group ?? SignalService_GroupContext()} + var group: SignalServiceProtos_GroupContext { + get {return _storage._group ?? SignalServiceProtos_GroupContext()} set {_uniqueStorage()._group = newValue} } /// Returns true if `group` has been explicitly set. @@ -486,8 +489,8 @@ struct SignalService_DataMessage { /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. mutating func clearTimestamp() {_storage._timestamp = nil} - var quote: SignalService_DataMessage.Quote { - get {return _storage._quote ?? SignalService_DataMessage.Quote()} + var quote: SignalServiceProtos_DataMessage.Quote { + get {return _storage._quote ?? SignalServiceProtos_DataMessage.Quote()} set {_uniqueStorage()._quote = newValue} } /// Returns true if `quote` has been explicitly set. @@ -495,7 +498,7 @@ struct SignalService_DataMessage { /// Clears the value of `quote`. Subsequent reads from it will return its default value. mutating func clearQuote() {_storage._quote = nil} - var contact: [SignalService_DataMessage.Contact] { + var contact: [SignalServiceProtos_DataMessage.Contact] { get {return _storage._contact} set {_uniqueStorage()._contact = newValue} } @@ -563,7 +566,7 @@ struct SignalService_DataMessage { /// Clears the value of `text`. Subsequent reads from it will return its default value. mutating func clearText() {self._text = nil} - var attachments: [SignalService_DataMessage.Quote.QuotedAttachment] = [] + var attachments: [SignalServiceProtos_DataMessage.Quote.QuotedAttachment] = [] var unknownFields = SwiftProtobuf.UnknownStorage() @@ -590,8 +593,8 @@ struct SignalService_DataMessage { /// Clears the value of `fileName`. Subsequent reads from it will return its default value. mutating func clearFileName() {_storage._fileName = nil} - var thumbnail: SignalService_AttachmentPointer { - get {return _storage._thumbnail ?? SignalService_AttachmentPointer()} + var thumbnail: SignalServiceProtos_AttachmentPointer { + get {return _storage._thumbnail ?? SignalServiceProtos_AttachmentPointer()} set {_uniqueStorage()._thumbnail = newValue} } /// Returns true if `thumbnail` has been explicitly set. @@ -650,8 +653,8 @@ struct SignalService_DataMessage { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var name: SignalService_DataMessage.Contact.Name { - get {return _storage._name ?? SignalService_DataMessage.Contact.Name()} + var name: SignalServiceProtos_DataMessage.Contact.Name { + get {return _storage._name ?? SignalServiceProtos_DataMessage.Contact.Name()} set {_uniqueStorage()._name = newValue} } /// Returns true if `name` has been explicitly set. @@ -659,23 +662,23 @@ struct SignalService_DataMessage { /// Clears the value of `name`. Subsequent reads from it will return its default value. mutating func clearName() {_storage._name = nil} - var number: [SignalService_DataMessage.Contact.Phone] { + var number: [SignalServiceProtos_DataMessage.Contact.Phone] { get {return _storage._number} set {_uniqueStorage()._number = newValue} } - var email: [SignalService_DataMessage.Contact.Email] { + var email: [SignalServiceProtos_DataMessage.Contact.Email] { get {return _storage._email} set {_uniqueStorage()._email = newValue} } - var address: [SignalService_DataMessage.Contact.PostalAddress] { + var address: [SignalServiceProtos_DataMessage.Contact.PostalAddress] { get {return _storage._address} set {_uniqueStorage()._address = newValue} } - var avatar: SignalService_DataMessage.Contact.Avatar { - get {return _storage._avatar ?? SignalService_DataMessage.Contact.Avatar()} + var avatar: SignalServiceProtos_DataMessage.Contact.Avatar { + get {return _storage._avatar ?? SignalServiceProtos_DataMessage.Contact.Avatar()} set {_uniqueStorage()._avatar = newValue} } /// Returns true if `avatar` has been explicitly set. @@ -779,7 +782,7 @@ struct SignalService_DataMessage { /// Clears the value of `value`. Subsequent reads from it will return its default value. mutating func clearValue() {self._value = nil} - var type: SignalService_DataMessage.Contact.Phone.TypeEnum { + var type: SignalServiceProtos_DataMessage.Contact.Phone.TypeEnum { get {return _type ?? .home} set {_type = newValue} } @@ -834,7 +837,7 @@ struct SignalService_DataMessage { init() {} fileprivate var _value: String? = nil - fileprivate var _type: SignalService_DataMessage.Contact.Phone.TypeEnum? = nil + fileprivate var _type: SignalServiceProtos_DataMessage.Contact.Phone.TypeEnum? = nil fileprivate var _label: String? = nil } @@ -852,7 +855,7 @@ struct SignalService_DataMessage { /// Clears the value of `value`. Subsequent reads from it will return its default value. mutating func clearValue() {self._value = nil} - var type: SignalService_DataMessage.Contact.Email.TypeEnum { + var type: SignalServiceProtos_DataMessage.Contact.Email.TypeEnum { get {return _type ?? .home} set {_type = newValue} } @@ -907,7 +910,7 @@ struct SignalService_DataMessage { init() {} fileprivate var _value: String? = nil - fileprivate var _type: SignalService_DataMessage.Contact.Email.TypeEnum? = nil + fileprivate var _type: SignalServiceProtos_DataMessage.Contact.Email.TypeEnum? = nil fileprivate var _label: String? = nil } @@ -916,7 +919,7 @@ struct SignalService_DataMessage { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var type: SignalService_DataMessage.Contact.PostalAddress.TypeEnum { + var type: SignalServiceProtos_DataMessage.Contact.PostalAddress.TypeEnum { get {return _type ?? .home} set {_type = newValue} } @@ -1030,7 +1033,7 @@ struct SignalService_DataMessage { init() {} - fileprivate var _type: SignalService_DataMessage.Contact.PostalAddress.TypeEnum? = nil + fileprivate var _type: SignalServiceProtos_DataMessage.Contact.PostalAddress.TypeEnum? = nil fileprivate var _label: String? = nil fileprivate var _street: String? = nil fileprivate var _pobox: String? = nil @@ -1046,8 +1049,8 @@ struct SignalService_DataMessage { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var avatar: SignalService_AttachmentPointer { - get {return _storage._avatar ?? SignalService_AttachmentPointer()} + var avatar: SignalServiceProtos_AttachmentPointer { + get {return _storage._avatar ?? SignalServiceProtos_AttachmentPointer()} set {_uniqueStorage()._avatar = newValue} } /// Returns true if `avatar` has been explicitly set. @@ -1081,7 +1084,7 @@ struct SignalService_DataMessage { fileprivate var _storage = _StorageClass.defaultInstance } -struct SignalService_NullMessage { +struct SignalServiceProtos_NullMessage { // 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. @@ -1102,12 +1105,12 @@ struct SignalService_NullMessage { fileprivate var _padding: Data? = nil } -struct SignalService_ReceiptMessage { +struct SignalServiceProtos_ReceiptMessage { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var type: SignalService_ReceiptMessage.TypeEnum { + var type: SignalServiceProtos_ReceiptMessage.TypeEnum { get {return _type ?? .delivery} set {_type = newValue} } @@ -1148,10 +1151,10 @@ struct SignalService_ReceiptMessage { init() {} - fileprivate var _type: SignalService_ReceiptMessage.TypeEnum? = nil + fileprivate var _type: SignalServiceProtos_ReceiptMessage.TypeEnum? = nil } -struct SignalService_Verified { +struct SignalServiceProtos_Verified { // 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. @@ -1174,7 +1177,7 @@ struct SignalService_Verified { /// Clears the value of `identityKey`. Subsequent reads from it will return its default value. mutating func clearIdentityKey() {self._identityKey = nil} - var state: SignalService_Verified.State { + var state: SignalServiceProtos_Verified.State { get {return _state ?? .default} set {_state = newValue} } @@ -1227,17 +1230,17 @@ struct SignalService_Verified { fileprivate var _destination: String? = nil fileprivate var _identityKey: Data? = nil - fileprivate var _state: SignalService_Verified.State? = nil + fileprivate var _state: SignalServiceProtos_Verified.State? = nil fileprivate var _nullMessage: Data? = nil } -struct SignalService_SyncMessage { +struct SignalServiceProtos_SyncMessage { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var sent: SignalService_SyncMessage.Sent { - get {return _storage._sent ?? SignalService_SyncMessage.Sent()} + var sent: SignalServiceProtos_SyncMessage.Sent { + get {return _storage._sent ?? SignalServiceProtos_SyncMessage.Sent()} set {_uniqueStorage()._sent = newValue} } /// Returns true if `sent` has been explicitly set. @@ -1245,8 +1248,8 @@ struct SignalService_SyncMessage { /// Clears the value of `sent`. Subsequent reads from it will return its default value. mutating func clearSent() {_storage._sent = nil} - var contacts: SignalService_SyncMessage.Contacts { - get {return _storage._contacts ?? SignalService_SyncMessage.Contacts()} + var contacts: SignalServiceProtos_SyncMessage.Contacts { + get {return _storage._contacts ?? SignalServiceProtos_SyncMessage.Contacts()} set {_uniqueStorage()._contacts = newValue} } /// Returns true if `contacts` has been explicitly set. @@ -1254,8 +1257,8 @@ struct SignalService_SyncMessage { /// Clears the value of `contacts`. Subsequent reads from it will return its default value. mutating func clearContacts() {_storage._contacts = nil} - var groups: SignalService_SyncMessage.Groups { - get {return _storage._groups ?? SignalService_SyncMessage.Groups()} + var groups: SignalServiceProtos_SyncMessage.Groups { + get {return _storage._groups ?? SignalServiceProtos_SyncMessage.Groups()} set {_uniqueStorage()._groups = newValue} } /// Returns true if `groups` has been explicitly set. @@ -1263,8 +1266,8 @@ struct SignalService_SyncMessage { /// Clears the value of `groups`. Subsequent reads from it will return its default value. mutating func clearGroups() {_storage._groups = nil} - var request: SignalService_SyncMessage.Request { - get {return _storage._request ?? SignalService_SyncMessage.Request()} + var request: SignalServiceProtos_SyncMessage.Request { + get {return _storage._request ?? SignalServiceProtos_SyncMessage.Request()} set {_uniqueStorage()._request = newValue} } /// Returns true if `request` has been explicitly set. @@ -1272,13 +1275,13 @@ struct SignalService_SyncMessage { /// Clears the value of `request`. Subsequent reads from it will return its default value. mutating func clearRequest() {_storage._request = nil} - var read: [SignalService_SyncMessage.Read] { + var read: [SignalServiceProtos_SyncMessage.Read] { get {return _storage._read} set {_uniqueStorage()._read = newValue} } - var blocked: SignalService_SyncMessage.Blocked { - get {return _storage._blocked ?? SignalService_SyncMessage.Blocked()} + var blocked: SignalServiceProtos_SyncMessage.Blocked { + get {return _storage._blocked ?? SignalServiceProtos_SyncMessage.Blocked()} set {_uniqueStorage()._blocked = newValue} } /// Returns true if `blocked` has been explicitly set. @@ -1286,8 +1289,8 @@ struct SignalService_SyncMessage { /// Clears the value of `blocked`. Subsequent reads from it will return its default value. mutating func clearBlocked() {_storage._blocked = nil} - var verified: SignalService_Verified { - get {return _storage._verified ?? SignalService_Verified()} + var verified: SignalServiceProtos_Verified { + get {return _storage._verified ?? SignalServiceProtos_Verified()} set {_uniqueStorage()._verified = newValue} } /// Returns true if `verified` has been explicitly set. @@ -1295,8 +1298,8 @@ struct SignalService_SyncMessage { /// Clears the value of `verified`. Subsequent reads from it will return its default value. mutating func clearVerified() {_storage._verified = nil} - var configuration: SignalService_SyncMessage.Configuration { - get {return _storage._configuration ?? SignalService_SyncMessage.Configuration()} + var configuration: SignalServiceProtos_SyncMessage.Configuration { + get {return _storage._configuration ?? SignalServiceProtos_SyncMessage.Configuration()} set {_uniqueStorage()._configuration = newValue} } /// Returns true if `configuration` has been explicitly set. @@ -1338,8 +1341,8 @@ struct SignalService_SyncMessage { /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. mutating func clearTimestamp() {_storage._timestamp = nil} - var message: SignalService_DataMessage { - get {return _storage._message ?? SignalService_DataMessage()} + var message: SignalServiceProtos_DataMessage { + get {return _storage._message ?? SignalServiceProtos_DataMessage()} set {_uniqueStorage()._message = newValue} } /// Returns true if `message` has been explicitly set. @@ -1368,8 +1371,8 @@ struct SignalService_SyncMessage { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var blob: SignalService_AttachmentPointer { - get {return _storage._blob ?? SignalService_AttachmentPointer()} + var blob: SignalServiceProtos_AttachmentPointer { + get {return _storage._blob ?? SignalServiceProtos_AttachmentPointer()} set {_uniqueStorage()._blob = newValue} } /// Returns true if `blob` has been explicitly set. @@ -1399,8 +1402,8 @@ struct SignalService_SyncMessage { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var blob: SignalService_AttachmentPointer { - get {return _storage._blob ?? SignalService_AttachmentPointer()} + var blob: SignalServiceProtos_AttachmentPointer { + get {return _storage._blob ?? SignalServiceProtos_AttachmentPointer()} set {_uniqueStorage()._blob = newValue} } /// Returns true if `blob` has been explicitly set. @@ -1432,7 +1435,7 @@ struct SignalService_SyncMessage { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var type: SignalService_SyncMessage.Request.TypeEnum { + var type: SignalServiceProtos_SyncMessage.Request.TypeEnum { get {return _type ?? .unknown} set {_type = newValue} } @@ -1480,7 +1483,7 @@ struct SignalService_SyncMessage { init() {} - fileprivate var _type: SignalService_SyncMessage.Request.TypeEnum? = nil + fileprivate var _type: SignalServiceProtos_SyncMessage.Request.TypeEnum? = nil } struct Read { @@ -1540,7 +1543,7 @@ struct SignalService_SyncMessage { fileprivate var _storage = _StorageClass.defaultInstance } -struct SignalService_AttachmentPointer { +struct SignalServiceProtos_AttachmentPointer { // 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. @@ -1674,7 +1677,7 @@ struct SignalService_AttachmentPointer { fileprivate var _height: UInt32? = nil } -struct SignalService_GroupContext { +struct SignalServiceProtos_GroupContext { // 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. @@ -1688,7 +1691,7 @@ struct SignalService_GroupContext { /// Clears the value of `id`. Subsequent reads from it will return its default value. mutating func clearID() {_storage._id = nil} - var type: SignalService_GroupContext.TypeEnum { + var type: SignalServiceProtos_GroupContext.TypeEnum { get {return _storage._type ?? .unknown} set {_uniqueStorage()._type = newValue} } @@ -1711,8 +1714,8 @@ struct SignalService_GroupContext { set {_uniqueStorage()._members = newValue} } - var avatar: SignalService_AttachmentPointer { - get {return _storage._avatar ?? SignalService_AttachmentPointer()} + var avatar: SignalServiceProtos_AttachmentPointer { + get {return _storage._avatar ?? SignalServiceProtos_AttachmentPointer()} set {_uniqueStorage()._avatar = newValue} } /// Returns true if `avatar` has been explicitly set. @@ -1762,7 +1765,7 @@ struct SignalService_GroupContext { fileprivate var _storage = _StorageClass.defaultInstance } -struct SignalService_ContactDetails { +struct SignalServiceProtos_ContactDetails { // 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. @@ -1785,8 +1788,8 @@ struct SignalService_ContactDetails { /// Clears the value of `name`. Subsequent reads from it will return its default value. mutating func clearName() {_storage._name = nil} - var avatar: SignalService_ContactDetails.Avatar { - get {return _storage._avatar ?? SignalService_ContactDetails.Avatar()} + var avatar: SignalServiceProtos_ContactDetails.Avatar { + get {return _storage._avatar ?? SignalServiceProtos_ContactDetails.Avatar()} set {_uniqueStorage()._avatar = newValue} } /// Returns true if `avatar` has been explicitly set. @@ -1803,8 +1806,8 @@ struct SignalService_ContactDetails { /// Clears the value of `color`. Subsequent reads from it will return its default value. mutating func clearColor() {_storage._color = nil} - var verified: SignalService_Verified { - get {return _storage._verified ?? SignalService_Verified()} + var verified: SignalServiceProtos_Verified { + get {return _storage._verified ?? SignalServiceProtos_Verified()} set {_uniqueStorage()._verified = newValue} } /// Returns true if `verified` has been explicitly set. @@ -1877,7 +1880,7 @@ struct SignalService_ContactDetails { fileprivate var _storage = _StorageClass.defaultInstance } -struct SignalService_GroupDetails { +struct SignalServiceProtos_GroupDetails { // 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. @@ -1905,8 +1908,8 @@ struct SignalService_GroupDetails { set {_uniqueStorage()._members = newValue} } - var avatar: SignalService_GroupDetails.Avatar { - get {return _storage._avatar ?? SignalService_GroupDetails.Avatar()} + var avatar: SignalServiceProtos_GroupDetails.Avatar { + get {return _storage._avatar ?? SignalServiceProtos_GroupDetails.Avatar()} set {_uniqueStorage()._avatar = newValue} } /// Returns true if `avatar` has been explicitly set. @@ -1981,9 +1984,9 @@ struct SignalService_GroupDetails { // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "SignalService" +fileprivate let _protobuf_package = "SignalServiceProtos" -extension SignalService_Envelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_Envelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Envelope" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "type"), @@ -2035,7 +2038,7 @@ extension SignalService_Envelope: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_Envelope) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_Envelope) -> Bool { if self._type != other._type {return false} if self._source != other._source {return false} if self._sourceDevice != other._sourceDevice {return false} @@ -2048,7 +2051,7 @@ extension SignalService_Envelope: SwiftProtobuf.Message, SwiftProtobuf._MessageI } } -extension SignalService_Envelope.TypeEnum: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_Envelope.TypeEnum: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNKNOWN"), 1: .same(proto: "CIPHERTEXT"), @@ -2058,7 +2061,7 @@ extension SignalService_Envelope.TypeEnum: SwiftProtobuf._ProtoNameProviding { ] } -extension SignalService_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Content" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "dataMessage"), @@ -2069,11 +2072,11 @@ extension SignalService_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm ] fileprivate class _StorageClass { - var _dataMessage: SignalService_DataMessage? = nil - var _syncMessage: SignalService_SyncMessage? = nil - var _callMessage: SignalService_CallMessage? = nil - var _nullMessage: SignalService_NullMessage? = nil - var _receiptMessage: SignalService_ReceiptMessage? = nil + var _dataMessage: SignalServiceProtos_DataMessage? = nil + var _syncMessage: SignalServiceProtos_SyncMessage? = nil + var _callMessage: SignalServiceProtos_CallMessage? = nil + var _nullMessage: SignalServiceProtos_NullMessage? = nil + var _receiptMessage: SignalServiceProtos_ReceiptMessage? = nil static let defaultInstance = _StorageClass() @@ -2132,7 +2135,7 @@ extension SignalService_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_Content) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_Content) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -2151,7 +2154,7 @@ extension SignalService_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm } } -extension SignalService_CallMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_CallMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".CallMessage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "offer"), @@ -2163,11 +2166,11 @@ extension SignalService_CallMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa ] fileprivate class _StorageClass { - var _offer: SignalService_CallMessage.Offer? = nil - var _answer: SignalService_CallMessage.Answer? = nil - var _iceUpdate: [SignalService_CallMessage.IceUpdate] = [] - var _hangup: SignalService_CallMessage.Hangup? = nil - var _busy: SignalService_CallMessage.Busy? = nil + var _offer: SignalServiceProtos_CallMessage.Offer? = nil + var _answer: SignalServiceProtos_CallMessage.Answer? = nil + var _iceUpdate: [SignalServiceProtos_CallMessage.IceUpdate] = [] + var _hangup: SignalServiceProtos_CallMessage.Hangup? = nil + var _busy: SignalServiceProtos_CallMessage.Busy? = nil var _profileKey: Data? = nil static let defaultInstance = _StorageClass() @@ -2232,7 +2235,7 @@ extension SignalService_CallMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_CallMessage) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_CallMessage) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -2252,8 +2255,8 @@ extension SignalService_CallMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa } } -extension SignalService_CallMessage.Offer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_CallMessage.protoMessageName + ".Offer" +extension SignalServiceProtos_CallMessage.Offer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_CallMessage.protoMessageName + ".Offer" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), 2: .same(proto: "sessionDescription"), @@ -2279,7 +2282,7 @@ extension SignalService_CallMessage.Offer: SwiftProtobuf.Message, SwiftProtobuf. try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_CallMessage.Offer) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_CallMessage.Offer) -> Bool { if self._id != other._id {return false} if self._sessionDescription != other._sessionDescription {return false} if unknownFields != other.unknownFields {return false} @@ -2287,8 +2290,8 @@ extension SignalService_CallMessage.Offer: SwiftProtobuf.Message, SwiftProtobuf. } } -extension SignalService_CallMessage.Answer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_CallMessage.protoMessageName + ".Answer" +extension SignalServiceProtos_CallMessage.Answer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_CallMessage.protoMessageName + ".Answer" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), 2: .same(proto: "sessionDescription"), @@ -2314,7 +2317,7 @@ extension SignalService_CallMessage.Answer: SwiftProtobuf.Message, SwiftProtobuf try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_CallMessage.Answer) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_CallMessage.Answer) -> Bool { if self._id != other._id {return false} if self._sessionDescription != other._sessionDescription {return false} if unknownFields != other.unknownFields {return false} @@ -2322,8 +2325,8 @@ extension SignalService_CallMessage.Answer: SwiftProtobuf.Message, SwiftProtobuf } } -extension SignalService_CallMessage.IceUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_CallMessage.protoMessageName + ".IceUpdate" +extension SignalServiceProtos_CallMessage.IceUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_CallMessage.protoMessageName + ".IceUpdate" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), 2: .same(proto: "sdpMid"), @@ -2359,7 +2362,7 @@ extension SignalService_CallMessage.IceUpdate: SwiftProtobuf.Message, SwiftProto try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_CallMessage.IceUpdate) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_CallMessage.IceUpdate) -> Bool { if self._id != other._id {return false} if self._sdpMid != other._sdpMid {return false} if self._sdpMlineIndex != other._sdpMlineIndex {return false} @@ -2369,8 +2372,8 @@ extension SignalService_CallMessage.IceUpdate: SwiftProtobuf.Message, SwiftProto } } -extension SignalService_CallMessage.Busy: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_CallMessage.protoMessageName + ".Busy" +extension SignalServiceProtos_CallMessage.Busy: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_CallMessage.protoMessageName + ".Busy" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), ] @@ -2391,15 +2394,15 @@ extension SignalService_CallMessage.Busy: SwiftProtobuf.Message, SwiftProtobuf._ try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_CallMessage.Busy) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_CallMessage.Busy) -> Bool { if self._id != other._id {return false} if unknownFields != other.unknownFields {return false} return true } } -extension SignalService_CallMessage.Hangup: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_CallMessage.protoMessageName + ".Hangup" +extension SignalServiceProtos_CallMessage.Hangup: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_CallMessage.protoMessageName + ".Hangup" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), ] @@ -2420,14 +2423,14 @@ extension SignalService_CallMessage.Hangup: SwiftProtobuf.Message, SwiftProtobuf try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_CallMessage.Hangup) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_CallMessage.Hangup) -> Bool { if self._id != other._id {return false} if unknownFields != other.unknownFields {return false} return true } } -extension SignalService_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".DataMessage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "body"), @@ -2443,14 +2446,14 @@ extension SignalService_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa fileprivate class _StorageClass { var _body: String? = nil - var _attachments: [SignalService_AttachmentPointer] = [] - var _group: SignalService_GroupContext? = nil + var _attachments: [SignalServiceProtos_AttachmentPointer] = [] + var _group: SignalServiceProtos_GroupContext? = nil var _flags: UInt32? = nil var _expireTimer: UInt32? = nil var _profileKey: Data? = nil var _timestamp: UInt64? = nil - var _quote: SignalService_DataMessage.Quote? = nil - var _contact: [SignalService_DataMessage.Contact] = [] + var _quote: SignalServiceProtos_DataMessage.Quote? = nil + var _contact: [SignalServiceProtos_DataMessage.Contact] = [] static let defaultInstance = _StorageClass() @@ -2529,7 +2532,7 @@ extension SignalService_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_DataMessage) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_DataMessage) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -2552,7 +2555,7 @@ extension SignalService_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa } } -extension SignalService_DataMessage.Flags: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_DataMessage.Flags: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "END_SESSION"), 2: .same(proto: "EXPIRATION_TIMER_UPDATE"), @@ -2560,8 +2563,8 @@ extension SignalService_DataMessage.Flags: SwiftProtobuf._ProtoNameProviding { ] } -extension SignalService_DataMessage.Quote: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_DataMessage.protoMessageName + ".Quote" +extension SignalServiceProtos_DataMessage.Quote: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_DataMessage.protoMessageName + ".Quote" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), 2: .same(proto: "author"), @@ -2597,7 +2600,7 @@ extension SignalService_DataMessage.Quote: SwiftProtobuf.Message, SwiftProtobuf. try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Quote) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_DataMessage.Quote) -> Bool { if self._id != other._id {return false} if self._author != other._author {return false} if self._text != other._text {return false} @@ -2607,8 +2610,8 @@ extension SignalService_DataMessage.Quote: SwiftProtobuf.Message, SwiftProtobuf. } } -extension SignalService_DataMessage.Quote.QuotedAttachment: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_DataMessage.Quote.protoMessageName + ".QuotedAttachment" +extension SignalServiceProtos_DataMessage.Quote.QuotedAttachment: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_DataMessage.Quote.protoMessageName + ".QuotedAttachment" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "contentType"), 2: .same(proto: "fileName"), @@ -2619,7 +2622,7 @@ extension SignalService_DataMessage.Quote.QuotedAttachment: SwiftProtobuf.Messag fileprivate class _StorageClass { var _contentType: String? = nil var _fileName: String? = nil - var _thumbnail: SignalService_AttachmentPointer? = nil + var _thumbnail: SignalServiceProtos_AttachmentPointer? = nil var _flags: UInt32? = nil static let defaultInstance = _StorageClass() @@ -2674,7 +2677,7 @@ extension SignalService_DataMessage.Quote.QuotedAttachment: SwiftProtobuf.Messag try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Quote.QuotedAttachment) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_DataMessage.Quote.QuotedAttachment) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -2692,14 +2695,14 @@ extension SignalService_DataMessage.Quote.QuotedAttachment: SwiftProtobuf.Messag } } -extension SignalService_DataMessage.Quote.QuotedAttachment.Flags: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_DataMessage.Quote.QuotedAttachment.Flags: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "VOICE_MESSAGE"), ] } -extension SignalService_DataMessage.Contact: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_DataMessage.protoMessageName + ".Contact" +extension SignalServiceProtos_DataMessage.Contact: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_DataMessage.protoMessageName + ".Contact" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "name"), 3: .same(proto: "number"), @@ -2710,11 +2713,11 @@ extension SignalService_DataMessage.Contact: SwiftProtobuf.Message, SwiftProtobu ] fileprivate class _StorageClass { - var _name: SignalService_DataMessage.Contact.Name? = nil - var _number: [SignalService_DataMessage.Contact.Phone] = [] - var _email: [SignalService_DataMessage.Contact.Email] = [] - var _address: [SignalService_DataMessage.Contact.PostalAddress] = [] - var _avatar: SignalService_DataMessage.Contact.Avatar? = nil + var _name: SignalServiceProtos_DataMessage.Contact.Name? = nil + var _number: [SignalServiceProtos_DataMessage.Contact.Phone] = [] + var _email: [SignalServiceProtos_DataMessage.Contact.Email] = [] + var _address: [SignalServiceProtos_DataMessage.Contact.PostalAddress] = [] + var _avatar: SignalServiceProtos_DataMessage.Contact.Avatar? = nil var _organization: String? = nil static let defaultInstance = _StorageClass() @@ -2779,7 +2782,7 @@ extension SignalService_DataMessage.Contact: SwiftProtobuf.Message, SwiftProtobu try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_DataMessage.Contact) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -2799,8 +2802,8 @@ extension SignalService_DataMessage.Contact: SwiftProtobuf.Message, SwiftProtobu } } -extension SignalService_DataMessage.Contact.Name: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_DataMessage.Contact.protoMessageName + ".Name" +extension SignalServiceProtos_DataMessage.Contact.Name: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_DataMessage.Contact.protoMessageName + ".Name" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "givenName"), 2: .same(proto: "familyName"), @@ -2846,7 +2849,7 @@ extension SignalService_DataMessage.Contact.Name: SwiftProtobuf.Message, SwiftPr try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact.Name) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_DataMessage.Contact.Name) -> Bool { if self._givenName != other._givenName {return false} if self._familyName != other._familyName {return false} if self._prefix != other._prefix {return false} @@ -2858,8 +2861,8 @@ extension SignalService_DataMessage.Contact.Name: SwiftProtobuf.Message, SwiftPr } } -extension SignalService_DataMessage.Contact.Phone: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_DataMessage.Contact.protoMessageName + ".Phone" +extension SignalServiceProtos_DataMessage.Contact.Phone: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_DataMessage.Contact.protoMessageName + ".Phone" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "value"), 2: .same(proto: "type"), @@ -2890,7 +2893,7 @@ extension SignalService_DataMessage.Contact.Phone: SwiftProtobuf.Message, SwiftP try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact.Phone) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_DataMessage.Contact.Phone) -> Bool { if self._value != other._value {return false} if self._type != other._type {return false} if self._label != other._label {return false} @@ -2899,7 +2902,7 @@ extension SignalService_DataMessage.Contact.Phone: SwiftProtobuf.Message, SwiftP } } -extension SignalService_DataMessage.Contact.Phone.TypeEnum: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_DataMessage.Contact.Phone.TypeEnum: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "HOME"), 2: .same(proto: "MOBILE"), @@ -2908,8 +2911,8 @@ extension SignalService_DataMessage.Contact.Phone.TypeEnum: SwiftProtobuf._Proto ] } -extension SignalService_DataMessage.Contact.Email: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_DataMessage.Contact.protoMessageName + ".Email" +extension SignalServiceProtos_DataMessage.Contact.Email: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_DataMessage.Contact.protoMessageName + ".Email" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "value"), 2: .same(proto: "type"), @@ -2940,7 +2943,7 @@ extension SignalService_DataMessage.Contact.Email: SwiftProtobuf.Message, SwiftP try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact.Email) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_DataMessage.Contact.Email) -> Bool { if self._value != other._value {return false} if self._type != other._type {return false} if self._label != other._label {return false} @@ -2949,7 +2952,7 @@ extension SignalService_DataMessage.Contact.Email: SwiftProtobuf.Message, SwiftP } } -extension SignalService_DataMessage.Contact.Email.TypeEnum: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_DataMessage.Contact.Email.TypeEnum: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "HOME"), 2: .same(proto: "MOBILE"), @@ -2958,8 +2961,8 @@ extension SignalService_DataMessage.Contact.Email.TypeEnum: SwiftProtobuf._Proto ] } -extension SignalService_DataMessage.Contact.PostalAddress: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_DataMessage.Contact.protoMessageName + ".PostalAddress" +extension SignalServiceProtos_DataMessage.Contact.PostalAddress: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_DataMessage.Contact.protoMessageName + ".PostalAddress" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "type"), 2: .same(proto: "label"), @@ -3020,7 +3023,7 @@ extension SignalService_DataMessage.Contact.PostalAddress: SwiftProtobuf.Message try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact.PostalAddress) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_DataMessage.Contact.PostalAddress) -> Bool { if self._type != other._type {return false} if self._label != other._label {return false} if self._street != other._street {return false} @@ -3035,7 +3038,7 @@ extension SignalService_DataMessage.Contact.PostalAddress: SwiftProtobuf.Message } } -extension SignalService_DataMessage.Contact.PostalAddress.TypeEnum: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_DataMessage.Contact.PostalAddress.TypeEnum: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "HOME"), 2: .same(proto: "WORK"), @@ -3043,15 +3046,15 @@ extension SignalService_DataMessage.Contact.PostalAddress.TypeEnum: SwiftProtobu ] } -extension SignalService_DataMessage.Contact.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_DataMessage.Contact.protoMessageName + ".Avatar" +extension SignalServiceProtos_DataMessage.Contact.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_DataMessage.Contact.protoMessageName + ".Avatar" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "avatar"), 2: .same(proto: "isProfile"), ] fileprivate class _StorageClass { - var _avatar: SignalService_AttachmentPointer? = nil + var _avatar: SignalServiceProtos_AttachmentPointer? = nil var _isProfile: Bool? = nil static let defaultInstance = _StorageClass() @@ -3096,7 +3099,7 @@ extension SignalService_DataMessage.Contact.Avatar: SwiftProtobuf.Message, Swift try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_DataMessage.Contact.Avatar) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_DataMessage.Contact.Avatar) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -3112,7 +3115,7 @@ extension SignalService_DataMessage.Contact.Avatar: SwiftProtobuf.Message, Swift } } -extension SignalService_NullMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_NullMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".NullMessage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "padding"), @@ -3134,14 +3137,14 @@ extension SignalService_NullMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_NullMessage) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_NullMessage) -> Bool { if self._padding != other._padding {return false} if unknownFields != other.unknownFields {return false} return true } } -extension SignalService_ReceiptMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_ReceiptMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ReceiptMessage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "type"), @@ -3168,7 +3171,7 @@ extension SignalService_ReceiptMessage: SwiftProtobuf.Message, SwiftProtobuf._Me try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_ReceiptMessage) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_ReceiptMessage) -> Bool { if self._type != other._type {return false} if self.timestamp != other.timestamp {return false} if unknownFields != other.unknownFields {return false} @@ -3176,14 +3179,14 @@ extension SignalService_ReceiptMessage: SwiftProtobuf.Message, SwiftProtobuf._Me } } -extension SignalService_ReceiptMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_ReceiptMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "DELIVERY"), 1: .same(proto: "READ"), ] } -extension SignalService_Verified: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_Verified: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Verified" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "destination"), @@ -3220,7 +3223,7 @@ extension SignalService_Verified: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_Verified) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_Verified) -> Bool { if self._destination != other._destination {return false} if self._identityKey != other._identityKey {return false} if self._state != other._state {return false} @@ -3230,7 +3233,7 @@ extension SignalService_Verified: SwiftProtobuf.Message, SwiftProtobuf._MessageI } } -extension SignalService_Verified.State: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_Verified.State: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "DEFAULT"), 1: .same(proto: "VERIFIED"), @@ -3238,7 +3241,7 @@ extension SignalService_Verified.State: SwiftProtobuf._ProtoNameProviding { ] } -extension SignalService_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".SyncMessage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "sent"), @@ -3253,14 +3256,14 @@ extension SignalService_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa ] fileprivate class _StorageClass { - var _sent: SignalService_SyncMessage.Sent? = nil - var _contacts: SignalService_SyncMessage.Contacts? = nil - var _groups: SignalService_SyncMessage.Groups? = nil - var _request: SignalService_SyncMessage.Request? = nil - var _read: [SignalService_SyncMessage.Read] = [] - var _blocked: SignalService_SyncMessage.Blocked? = nil - var _verified: SignalService_Verified? = nil - var _configuration: SignalService_SyncMessage.Configuration? = nil + var _sent: SignalServiceProtos_SyncMessage.Sent? = nil + var _contacts: SignalServiceProtos_SyncMessage.Contacts? = nil + var _groups: SignalServiceProtos_SyncMessage.Groups? = nil + var _request: SignalServiceProtos_SyncMessage.Request? = nil + var _read: [SignalServiceProtos_SyncMessage.Read] = [] + var _blocked: SignalServiceProtos_SyncMessage.Blocked? = nil + var _verified: SignalServiceProtos_Verified? = nil + var _configuration: SignalServiceProtos_SyncMessage.Configuration? = nil var _padding: Data? = nil static let defaultInstance = _StorageClass() @@ -3340,7 +3343,7 @@ extension SignalService_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_SyncMessage) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -3363,8 +3366,8 @@ extension SignalService_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa } } -extension SignalService_SyncMessage.Sent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Sent" +extension SignalServiceProtos_SyncMessage.Sent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Sent" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "destination"), 2: .same(proto: "timestamp"), @@ -3375,7 +3378,7 @@ extension SignalService_SyncMessage.Sent: SwiftProtobuf.Message, SwiftProtobuf._ fileprivate class _StorageClass { var _destination: String? = nil var _timestamp: UInt64? = nil - var _message: SignalService_DataMessage? = nil + var _message: SignalServiceProtos_DataMessage? = nil var _expirationStartTimestamp: UInt64? = nil static let defaultInstance = _StorageClass() @@ -3430,7 +3433,7 @@ extension SignalService_SyncMessage.Sent: SwiftProtobuf.Message, SwiftProtobuf._ try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Sent) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_SyncMessage.Sent) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -3448,15 +3451,15 @@ extension SignalService_SyncMessage.Sent: SwiftProtobuf.Message, SwiftProtobuf._ } } -extension SignalService_SyncMessage.Contacts: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Contacts" +extension SignalServiceProtos_SyncMessage.Contacts: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Contacts" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "blob"), 2: .same(proto: "isComplete"), ] fileprivate class _StorageClass { - var _blob: SignalService_AttachmentPointer? = nil + var _blob: SignalServiceProtos_AttachmentPointer? = nil var _isComplete: Bool? = nil static let defaultInstance = _StorageClass() @@ -3501,7 +3504,7 @@ extension SignalService_SyncMessage.Contacts: SwiftProtobuf.Message, SwiftProtob try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Contacts) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_SyncMessage.Contacts) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -3517,14 +3520,14 @@ extension SignalService_SyncMessage.Contacts: SwiftProtobuf.Message, SwiftProtob } } -extension SignalService_SyncMessage.Groups: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Groups" +extension SignalServiceProtos_SyncMessage.Groups: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Groups" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "blob"), ] fileprivate class _StorageClass { - var _blob: SignalService_AttachmentPointer? = nil + var _blob: SignalServiceProtos_AttachmentPointer? = nil static let defaultInstance = _StorageClass() @@ -3563,7 +3566,7 @@ extension SignalService_SyncMessage.Groups: SwiftProtobuf.Message, SwiftProtobuf try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Groups) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_SyncMessage.Groups) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -3578,8 +3581,8 @@ extension SignalService_SyncMessage.Groups: SwiftProtobuf.Message, SwiftProtobuf } } -extension SignalService_SyncMessage.Blocked: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Blocked" +extension SignalServiceProtos_SyncMessage.Blocked: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Blocked" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "numbers"), ] @@ -3600,15 +3603,15 @@ extension SignalService_SyncMessage.Blocked: SwiftProtobuf.Message, SwiftProtobu try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Blocked) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_SyncMessage.Blocked) -> Bool { if self.numbers != other.numbers {return false} if unknownFields != other.unknownFields {return false} return true } } -extension SignalService_SyncMessage.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Request" +extension SignalServiceProtos_SyncMessage.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Request" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "type"), ] @@ -3629,14 +3632,14 @@ extension SignalService_SyncMessage.Request: SwiftProtobuf.Message, SwiftProtobu try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Request) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_SyncMessage.Request) -> Bool { if self._type != other._type {return false} if unknownFields != other.unknownFields {return false} return true } } -extension SignalService_SyncMessage.Request.TypeEnum: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_SyncMessage.Request.TypeEnum: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNKNOWN"), 1: .same(proto: "CONTACTS"), @@ -3646,8 +3649,8 @@ extension SignalService_SyncMessage.Request.TypeEnum: SwiftProtobuf._ProtoNamePr ] } -extension SignalService_SyncMessage.Read: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Read" +extension SignalServiceProtos_SyncMessage.Read: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Read" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "sender"), 2: .same(proto: "timestamp"), @@ -3673,7 +3676,7 @@ extension SignalService_SyncMessage.Read: SwiftProtobuf.Message, SwiftProtobuf._ try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Read) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_SyncMessage.Read) -> Bool { if self._sender != other._sender {return false} if self._timestamp != other._timestamp {return false} if unknownFields != other.unknownFields {return false} @@ -3681,8 +3684,8 @@ extension SignalService_SyncMessage.Read: SwiftProtobuf.Message, SwiftProtobuf._ } } -extension SignalService_SyncMessage.Configuration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_SyncMessage.protoMessageName + ".Configuration" +extension SignalServiceProtos_SyncMessage.Configuration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Configuration" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "readReceipts"), ] @@ -3703,14 +3706,14 @@ extension SignalService_SyncMessage.Configuration: SwiftProtobuf.Message, SwiftP try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_SyncMessage.Configuration) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_SyncMessage.Configuration) -> Bool { if self._readReceipts != other._readReceipts {return false} if unknownFields != other.unknownFields {return false} return true } } -extension SignalService_AttachmentPointer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_AttachmentPointer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".AttachmentPointer" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), @@ -3777,7 +3780,7 @@ extension SignalService_AttachmentPointer: SwiftProtobuf.Message, SwiftProtobuf. try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_AttachmentPointer) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_AttachmentPointer) -> Bool { if self._id != other._id {return false} if self._contentType != other._contentType {return false} if self._key != other._key {return false} @@ -3793,13 +3796,13 @@ extension SignalService_AttachmentPointer: SwiftProtobuf.Message, SwiftProtobuf. } } -extension SignalService_AttachmentPointer.Flags: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_AttachmentPointer.Flags: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "VOICE_MESSAGE"), ] } -extension SignalService_GroupContext: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_GroupContext: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".GroupContext" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), @@ -3811,10 +3814,10 @@ extension SignalService_GroupContext: SwiftProtobuf.Message, SwiftProtobuf._Mess fileprivate class _StorageClass { var _id: Data? = nil - var _type: SignalService_GroupContext.TypeEnum? = nil + var _type: SignalServiceProtos_GroupContext.TypeEnum? = nil var _name: String? = nil var _members: [String] = [] - var _avatar: SignalService_AttachmentPointer? = nil + var _avatar: SignalServiceProtos_AttachmentPointer? = nil static let defaultInstance = _StorageClass() @@ -3873,7 +3876,7 @@ extension SignalService_GroupContext: SwiftProtobuf.Message, SwiftProtobuf._Mess try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_GroupContext) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_GroupContext) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -3892,7 +3895,7 @@ extension SignalService_GroupContext: SwiftProtobuf.Message, SwiftProtobuf._Mess } } -extension SignalService_GroupContext.TypeEnum: SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_GroupContext.TypeEnum: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNKNOWN"), 1: .same(proto: "UPDATE"), @@ -3902,7 +3905,7 @@ extension SignalService_GroupContext.TypeEnum: SwiftProtobuf._ProtoNameProviding ] } -extension SignalService_ContactDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_ContactDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ContactDetails" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "number"), @@ -3918,9 +3921,9 @@ extension SignalService_ContactDetails: SwiftProtobuf.Message, SwiftProtobuf._Me fileprivate class _StorageClass { var _number: String? = nil var _name: String? = nil - var _avatar: SignalService_ContactDetails.Avatar? = nil + var _avatar: SignalServiceProtos_ContactDetails.Avatar? = nil var _color: String? = nil - var _verified: SignalService_Verified? = nil + var _verified: SignalServiceProtos_Verified? = nil var _profileKey: Data? = nil var _blocked: Bool? = nil var _expireTimer: UInt32? = nil @@ -3997,7 +4000,7 @@ extension SignalService_ContactDetails: SwiftProtobuf.Message, SwiftProtobuf._Me try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_ContactDetails) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_ContactDetails) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -4019,8 +4022,8 @@ extension SignalService_ContactDetails: SwiftProtobuf.Message, SwiftProtobuf._Me } } -extension SignalService_ContactDetails.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_ContactDetails.protoMessageName + ".Avatar" +extension SignalServiceProtos_ContactDetails.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_ContactDetails.protoMessageName + ".Avatar" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "contentType"), 2: .same(proto: "length"), @@ -4046,7 +4049,7 @@ extension SignalService_ContactDetails.Avatar: SwiftProtobuf.Message, SwiftProto try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_ContactDetails.Avatar) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_ContactDetails.Avatar) -> Bool { if self._contentType != other._contentType {return false} if self._length != other._length {return false} if unknownFields != other.unknownFields {return false} @@ -4054,7 +4057,7 @@ extension SignalService_ContactDetails.Avatar: SwiftProtobuf.Message, SwiftProto } } -extension SignalService_GroupDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension SignalServiceProtos_GroupDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".GroupDetails" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), @@ -4070,7 +4073,7 @@ extension SignalService_GroupDetails: SwiftProtobuf.Message, SwiftProtobuf._Mess var _id: Data? = nil var _name: String? = nil var _members: [String] = [] - var _avatar: SignalService_GroupDetails.Avatar? = nil + var _avatar: SignalServiceProtos_GroupDetails.Avatar? = nil var _active: Bool? = nil var _expireTimer: UInt32? = nil var _color: String? = nil @@ -4142,7 +4145,7 @@ extension SignalService_GroupDetails: SwiftProtobuf.Message, SwiftProtobuf._Mess try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_GroupDetails) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_GroupDetails) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -4163,8 +4166,8 @@ extension SignalService_GroupDetails: SwiftProtobuf.Message, SwiftProtobuf._Mess } } -extension SignalService_GroupDetails.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SignalService_GroupDetails.protoMessageName + ".Avatar" +extension SignalServiceProtos_GroupDetails.Avatar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SignalServiceProtos_GroupDetails.protoMessageName + ".Avatar" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "contentType"), 2: .same(proto: "length"), @@ -4190,7 +4193,7 @@ extension SignalService_GroupDetails.Avatar: SwiftProtobuf.Message, SwiftProtobu try unknownFields.traverse(visitor: &visitor) } - func _protobuf_generated_isEqualTo(other: SignalService_GroupDetails.Avatar) -> Bool { + func _protobuf_generated_isEqualTo(other: SignalServiceProtos_GroupDetails.Avatar) -> Bool { if self._contentType != other._contentType {return false} if self._length != other._length {return false} if unknownFields != other.unknownFields {return false} diff --git a/SignalServiceKit/src/Protos/Generated/WebSocketResources.pb.swift b/SignalServiceKit/src/Protos/Generated/WebSocketResources.pb.swift new file mode 100644 index 0000000000..b3a02d079e --- /dev/null +++ b/SignalServiceKit/src/Protos/Generated/WebSocketResources.pb.swift @@ -0,0 +1,397 @@ +// DO NOT EDIT. +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: WebSocketResources.proto +// +// For information on using the generated types, please see the documenation: +// https://github.com/apple/swift-protobuf/ + +//* +// Copyright (C) 2014-2016 Open Whisper Systems +// +// Licensed according to the LICENSE file in this repository. + +/// iOS - since we use a modern proto-compiler, we must specify +/// the legacy proto format. + +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 your 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 +} + +struct WebSocketProtos_WebSocketRequestMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var verb: String { + get {return _verb ?? String()} + set {_verb = newValue} + } + /// Returns true if `verb` has been explicitly set. + var hasVerb: Bool {return self._verb != nil} + /// Clears the value of `verb`. Subsequent reads from it will return its default value. + mutating func clearVerb() {self._verb = nil} + + var path: String { + get {return _path ?? String()} + set {_path = newValue} + } + /// Returns true if `path` has been explicitly set. + var hasPath: Bool {return self._path != nil} + /// Clears the value of `path`. Subsequent reads from it will return its default value. + mutating func clearPath() {self._path = nil} + + var body: Data { + get {return _body ?? SwiftProtobuf.Internal.emptyData} + set {_body = newValue} + } + /// Returns true if `body` has been explicitly set. + var hasBody: Bool {return self._body != nil} + /// Clears the value of `body`. Subsequent reads from it will return its default value. + mutating func clearBody() {self._body = nil} + + var headers: [String] = [] + + var requestID: UInt64 { + get {return _requestID ?? 0} + set {_requestID = newValue} + } + /// Returns true if `requestID` has been explicitly set. + var hasRequestID: Bool {return self._requestID != nil} + /// Clears the value of `requestID`. Subsequent reads from it will return its default value. + mutating func clearRequestID() {self._requestID = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _verb: String? = nil + fileprivate var _path: String? = nil + fileprivate var _body: Data? = nil + fileprivate var _requestID: UInt64? = nil +} + +struct WebSocketProtos_WebSocketResponseMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var requestID: UInt64 { + get {return _requestID ?? 0} + set {_requestID = newValue} + } + /// Returns true if `requestID` has been explicitly set. + var hasRequestID: Bool {return self._requestID != nil} + /// Clears the value of `requestID`. Subsequent reads from it will return its default value. + mutating func clearRequestID() {self._requestID = nil} + + var status: UInt32 { + get {return _status ?? 0} + set {_status = newValue} + } + /// Returns true if `status` has been explicitly set. + var hasStatus: Bool {return self._status != nil} + /// Clears the value of `status`. Subsequent reads from it will return its default value. + mutating func clearStatus() {self._status = nil} + + var message: String { + get {return _message ?? String()} + set {_message = newValue} + } + /// Returns true if `message` has been explicitly set. + var hasMessage: Bool {return self._message != nil} + /// Clears the value of `message`. Subsequent reads from it will return its default value. + mutating func clearMessage() {self._message = nil} + + var headers: [String] = [] + + var body: Data { + get {return _body ?? SwiftProtobuf.Internal.emptyData} + set {_body = newValue} + } + /// Returns true if `body` has been explicitly set. + var hasBody: Bool {return self._body != nil} + /// Clears the value of `body`. Subsequent reads from it will return its default value. + mutating func clearBody() {self._body = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _requestID: UInt64? = nil + fileprivate var _status: UInt32? = nil + fileprivate var _message: String? = nil + fileprivate var _body: Data? = nil +} + +struct WebSocketProtos_WebSocketMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: WebSocketProtos_WebSocketMessage.TypeEnum { + get {return _storage._type ?? .unknown} + set {_uniqueStorage()._type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return _storage._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {_storage._type = nil} + + var request: WebSocketProtos_WebSocketRequestMessage { + get {return _storage._request ?? WebSocketProtos_WebSocketRequestMessage()} + set {_uniqueStorage()._request = newValue} + } + /// Returns true if `request` has been explicitly set. + var hasRequest: Bool {return _storage._request != nil} + /// Clears the value of `request`. Subsequent reads from it will return its default value. + mutating func clearRequest() {_storage._request = nil} + + var response: WebSocketProtos_WebSocketResponseMessage { + get {return _storage._response ?? WebSocketProtos_WebSocketResponseMessage()} + set {_uniqueStorage()._response = newValue} + } + /// Returns true if `response` has been explicitly set. + var hasResponse: Bool {return _storage._response != nil} + /// Clears the value of `response`. Subsequent reads from it will return its default value. + mutating func clearResponse() {_storage._response = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case request // = 1 + case response // = 2 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .request + case 2: self = .response + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .request: return 1 + case .response: return 2 + } + } + + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "WebSocketProtos" + +extension WebSocketProtos_WebSocketRequestMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WebSocketRequestMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "verb"), + 2: .same(proto: "path"), + 3: .same(proto: "body"), + 5: .same(proto: "headers"), + 4: .same(proto: "requestId"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._verb) + case 2: try decoder.decodeSingularStringField(value: &self._path) + case 3: try decoder.decodeSingularBytesField(value: &self._body) + case 4: try decoder.decodeSingularUInt64Field(value: &self._requestID) + case 5: try decoder.decodeRepeatedStringField(value: &self.headers) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._verb { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._path { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._body { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } + if let v = self._requestID { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 4) + } + if !self.headers.isEmpty { + try visitor.visitRepeatedStringField(value: self.headers, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: WebSocketProtos_WebSocketRequestMessage) -> Bool { + if self._verb != other._verb {return false} + if self._path != other._path {return false} + if self._body != other._body {return false} + if self.headers != other.headers {return false} + if self._requestID != other._requestID {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension WebSocketProtos_WebSocketResponseMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WebSocketResponseMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "requestId"), + 2: .same(proto: "status"), + 3: .same(proto: "message"), + 5: .same(proto: "headers"), + 4: .same(proto: "body"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self._requestID) + case 2: try decoder.decodeSingularUInt32Field(value: &self._status) + case 3: try decoder.decodeSingularStringField(value: &self._message) + case 4: try decoder.decodeSingularBytesField(value: &self._body) + case 5: try decoder.decodeRepeatedStringField(value: &self.headers) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._requestID { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 1) + } + if let v = self._status { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 2) + } + if let v = self._message { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._body { + try visitor.visitSingularBytesField(value: v, fieldNumber: 4) + } + if !self.headers.isEmpty { + try visitor.visitRepeatedStringField(value: self.headers, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: WebSocketProtos_WebSocketResponseMessage) -> Bool { + if self._requestID != other._requestID {return false} + if self._status != other._status {return false} + if self._message != other._message {return false} + if self.headers != other.headers {return false} + if self._body != other._body {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension WebSocketProtos_WebSocketMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WebSocketMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "request"), + 3: .same(proto: "response"), + ] + + fileprivate class _StorageClass { + var _type: WebSocketProtos_WebSocketMessage.TypeEnum? = nil + var _request: WebSocketProtos_WebSocketRequestMessage? = nil + var _response: WebSocketProtos_WebSocketResponseMessage? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _type = source._type + _request = source._request + _response = source._response + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &_storage._type) + case 2: try decoder.decodeSingularMessageField(value: &_storage._request) + case 3: try decoder.decodeSingularMessageField(value: &_storage._response) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if let v = _storage._request { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if let v = _storage._response { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: WebSocketProtos_WebSocketMessage) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._type != other_storage._type {return false} + if _storage._request != other_storage._request {return false} + if _storage._response != other_storage._response {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension WebSocketProtos_WebSocketMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "REQUEST"), + 2: .same(proto: "RESPONSE"), + ] +} diff --git a/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift b/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift index 3a6a1abbb8..be35d102b7 100644 --- a/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift +++ b/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift @@ -54,7 +54,7 @@ public class SSKEnvelope: NSObject { @objc public init(serializedData: Data) throws { - let proto: SignalService_Envelope = try SignalService_Envelope(serializedData: serializedData) + let proto: SignalServiceProtos_Envelope = try SignalServiceProtos_Envelope(serializedData: serializedData) guard proto.hasSource else { throw EnvelopeError.invalidProtobuf(description: "missing required field: source") @@ -113,8 +113,8 @@ public class SSKEnvelope: NSObject { return try self.asProtobuf.serializedData() } - private var asProtobuf: SignalService_Envelope { - var proto = SignalService_Envelope() + private var asProtobuf: SignalServiceProtos_Envelope { + var proto = SignalServiceProtos_Envelope() proto.source = self.source From 06bbe907b9d1f54e7c531fd7acc0f4731caeb524 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 25 Jul 2018 13:54:47 -0600 Subject: [PATCH 3/7] builder pattern for proto construction --- .../Protos/ProtoWrappers/SSKEnvelope.swift | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift b/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift index be35d102b7..c439497349 100644 --- a/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift +++ b/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift @@ -114,34 +114,34 @@ public class SSKEnvelope: NSObject { } private var asProtobuf: SignalServiceProtos_Envelope { - var proto = SignalServiceProtos_Envelope() + let proto = SignalServiceProtos_Envelope.with { (builder) in + builder.source = self.source - proto.source = self.source + builder.type = { + switch self.type { + case .unknown: + return .unknown + case .ciphertext: + return .ciphertext + case .keyExchange: + return .keyExchange + case .prekeyBundle: + return .prekeyBundle + case .receipt: + return .receipt + } + }() - proto.type = { - switch self.type { - case .unknown: - return .unknown - case .ciphertext: - return .ciphertext - case .keyExchange: - return .keyExchange - case .prekeyBundle: - return .prekeyBundle - case .receipt: - return .receipt + builder.timestamp = self.timestamp + builder.sourceDevice = self.sourceDevice + + if let relay = self.relay { + builder.relay = relay } - }() - proto.timestamp = self.timestamp - proto.sourceDevice = self.sourceDevice - - if let relay = self.relay { - proto.relay = relay - } - - if let content = self.content { - proto.content = content + if let content = self.content { + builder.content = content + } } return proto From abcd0a1d29d5ee72d7c2014ac68f9865e8e706b5 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 25 Jul 2018 14:00:25 -0600 Subject: [PATCH 4/7] CR: revert logging change --- SignalServiceKit/src/Messages/OWSMessageManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Messages/OWSMessageManager.m b/SignalServiceKit/src/Messages/OWSMessageManager.m index 09db8cdc94..7becd7cf56 100644 --- a/SignalServiceKit/src/Messages/OWSMessageManager.m +++ b/SignalServiceKit/src/Messages/OWSMessageManager.m @@ -322,7 +322,7 @@ NS_ASSUME_NONNULL_BEGIN [self handleIncomingEnvelope:envelope withDataMessage:dataMessage transaction:transaction]; } else { - DDLogWarn(@"%@ Ignoring envelope with neither Content nor LegacyMessage", self.logTag); + OWSProdInfoWEnvelope([OWSAnalyticsEvents messageManagerErrorEnvelopeNoActionablePayload], envelope); } } From e5856b2ac5b0b0c1bb98741c311f2922340449b9 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 25 Jul 2018 15:19:40 -0600 Subject: [PATCH 5/7] CR: Add back deprecated constructor to debug list --- .../ViewControllers/DebugUI/DebugUIMessages.m | 8 ++++- ...SInvalidIdentityKeyReceivingErrorMessage.h | 5 +++ ...SInvalidIdentityKeyReceivingErrorMessage.m | 33 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index 6d9e0c7be4..d2609948c4 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -3553,7 +3553,13 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac withTransaction:transaction]]; [result addObject:[TSErrorMessage corruptedMessageWithEnvelope:[self createEnvelopeForThread:thread] withTransaction:transaction]]; - + + + TSInvalidIdentityKeyReceivingErrorMessage *_Nullable blockingSNChangeMessage = + [TSInvalidIdentityKeyReceivingErrorMessage untrustedKeyWithEnvelope:[self createEnvelopeForThread:thread] + withTransaction:transaction]; + OWSAssert(blockingSNChangeMessage); + [result addObject:blockingSNChangeMessage]; [result addObject:[[TSErrorMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] inThread:thread failedMessageType:TSErrorMessageNonBlockingIdentityChange diff --git a/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.h b/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.h index fd919d10c9..d4dc751401 100644 --- a/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.h +++ b/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.h @@ -6,10 +6,15 @@ NS_ASSUME_NONNULL_BEGIN +@class SSKEnvelope; + // DEPRECATED - we no longer create new instances of this class (as of mid-2017); However, existing instances may // exist, so we should keep this class around to honor their old behavior. @interface TSInvalidIdentityKeyReceivingErrorMessage : TSInvalidIdentityKeyErrorMessage ++ (nullable instancetype)untrustedKeyWithEnvelope:(SSKEnvelope *)envelope + withTransaction:(YapDatabaseReadWriteTransaction *)transaction; + @end NS_ASSUME_NONNULL_END diff --git a/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m b/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m index 5747c5d5cf..659924e419 100644 --- a/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m +++ b/SignalServiceKit/src/Messages/InvalidKeyMessages/TSInvalidIdentityKeyReceivingErrorMessage.m @@ -33,6 +33,39 @@ NS_ASSUME_NONNULL_BEGIN @synthesize envelopeData = _envelopeData; ++ (nullable instancetype)untrustedKeyWithEnvelope:(SSKEnvelope *)envelope + withTransaction:(YapDatabaseReadWriteTransaction *)transaction +{ + TSContactThread *contactThread = + [TSContactThread getOrCreateThreadWithContactId:envelope.source transaction:transaction]; + TSInvalidIdentityKeyReceivingErrorMessage *errorMessage = + [[self alloc] initForUnknownIdentityKeyWithTimestamp:envelope.timestamp + inThread:contactThread + incomingEnvelope:envelope]; + return errorMessage; +} + +- (nullable instancetype)initForUnknownIdentityKeyWithTimestamp:(uint64_t)timestamp + inThread:(TSThread *)thread + incomingEnvelope:(SSKEnvelope *)envelope +{ + self = [self initWithTimestamp:timestamp inThread:thread failedMessageType:TSErrorMessageWrongTrustedIdentityKey]; + if (!self) { + return self; + } + + NSError *error; + _envelopeData = [envelope serializedDataAndReturnError:&error]; + if (!_envelopeData || error != nil) { + OWSFail(@"%@ failure: envelope data failed with error: %@", self.logTag, error); + return nil; + } + + _authorId = envelope.source; + + return self; +} + - (nullable SSKEnvelope *)envelope { if (!_envelope) { From d39906f606874dfc0d7787ece1fa80eaa6879150 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 25 Jul 2018 15:19:55 -0600 Subject: [PATCH 6/7] CR: test malformed protos --- Signal.xcodeproj/project.pbxproj | 12 ++++ Signal/test/SSKTests/SSKEnvelopeTest.swift | 68 +++++++++++++++++++ .../Protos/ProtoWrappers/SSKEnvelope.swift | 2 +- 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 Signal/test/SSKTests/SSKEnvelopeTest.swift diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 67a4943a82..9b359b79ff 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -431,6 +431,7 @@ 4C13C9F620E57BA30089A98B /* ColorPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C13C9F520E57BA30089A98B /* ColorPickerViewController.swift */; }; 4C20B2B720CA0034001BAC90 /* ThreadViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4542DF51208B82E9007B4E76 /* ThreadViewModel.swift */; }; 4C20B2B920CA10DE001BAC90 /* ConversationSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C20B2B820CA10DE001BAC90 /* ConversationSearchViewController.swift */; }; + 4C3EF802210918740007EBF7 /* SSKEnvelopeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C3EF801210918740007EBF7 /* SSKEnvelopeTest.swift */; }; 4C4AEC4520EC343B0020E72B /* DismissableTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4AEC4420EC343B0020E72B /* DismissableTextField.swift */; }; 4C4BC6C32102D697004040C9 /* ContactDiscoveryOperationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4BC6C22102D697004040C9 /* ContactDiscoveryOperationTest.swift */; }; 4C6F527C20FFE8400097DEEE /* SignalUBSan.supp in Resources */ = {isa = PBXBuildFile; fileRef = 4C6F527B20FFE8400097DEEE /* SignalUBSan.supp */; }; @@ -1110,6 +1111,7 @@ 4C11AA4F20FD59C700351FBD /* MessageStatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageStatusView.swift; sourceTree = ""; }; 4C13C9F520E57BA30089A98B /* ColorPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPickerViewController.swift; sourceTree = ""; }; 4C20B2B820CA10DE001BAC90 /* ConversationSearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationSearchViewController.swift; sourceTree = ""; }; + 4C3EF801210918740007EBF7 /* SSKEnvelopeTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSKEnvelopeTest.swift; sourceTree = ""; }; 4C4AEC4420EC343B0020E72B /* DismissableTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DismissableTextField.swift; sourceTree = ""; }; 4C4BC6C22102D697004040C9 /* ContactDiscoveryOperationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ContactDiscoveryOperationTest.swift; path = contact/ContactDiscoveryOperationTest.swift; sourceTree = ""; }; 4C6F527B20FFE8400097DEEE /* SignalUBSan.supp */ = {isa = PBXFileReference; lastKnownFileType = text; path = SignalUBSan.supp; sourceTree = ""; }; @@ -2109,6 +2111,14 @@ path = Speakerbox; sourceTree = ""; }; + 4C3EF8002109184A0007EBF7 /* SSKTests */ = { + isa = PBXGroup; + children = ( + 4C3EF801210918740007EBF7 /* SSKEnvelopeTest.swift */, + ); + path = SSKTests; + sourceTree = ""; + }; 76EB03C118170B33006006FC /* src */ = { isa = PBXGroup; children = ( @@ -2284,6 +2294,7 @@ B660F66C1C29867F00687D6E /* test */ = { isa = PBXGroup; children = ( + 4C3EF8002109184A0007EBF7 /* SSKTests */, 34C6B0A41FA0E46F00D35993 /* Assets */, B660F6731C29867F00687D6E /* call */, B660F6751C29867F00687D6E /* contact */, @@ -3454,6 +3465,7 @@ B660F6DA1C29868000687D6E /* ExceptionsTest.m in Sources */, B660F6DB1C29868000687D6E /* FunctionalUtilTest.m in Sources */, 45E7A6A81E71CA7E00D44FB5 /* DisplayableTextFilterTest.swift in Sources */, + 4C3EF802210918740007EBF7 /* SSKEnvelopeTest.swift in Sources */, 452D1AF12081059C00A67F7F /* StringAdditionsTest.swift in Sources */, 4C4BC6C32102D697004040C9 /* ContactDiscoveryOperationTest.swift in Sources */, B660F6BB1C29868000687D6E /* OWSContactsManagerTest.m in Sources */, diff --git a/Signal/test/SSKTests/SSKEnvelopeTest.swift b/Signal/test/SSKTests/SSKEnvelopeTest.swift new file mode 100644 index 0000000000..fa1aff2f96 --- /dev/null +++ b/Signal/test/SSKTests/SSKEnvelopeTest.swift @@ -0,0 +1,68 @@ +// +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// + +import XCTest + +import SignalServiceKit +import SwiftProtobuf + +class SSKEnvelopeTest: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testParse_EmptyData() { + let data = Data() + XCTAssertThrowsError(try SSKEnvelope(serializedData: data)) + } + + func testParse_UnparseableData() { + let data = "asdf".data(using: .utf8)! + XCTAssertThrowsError(try SSKEnvelope(serializedData: data)) { error in + XCTAssert(error is SwiftProtobuf.BinaryDecodingError) + } + } + + func testParse_ValidData() { + // `encodedData` was derived thus: + // let builder = OWSSignalServiceProtosEnvelopeBuilder() + // builder.setTimestamp(NSDate.ows_millisecondTimeStamp()) + // builder.setSource("+15551231234") + // builder.setSourceDevice(1) + // builder.setType(OWSSignalServiceProtosEnvelopeType.ciphertext) + // let encodedData = builder.build().data()!.base64EncodedString() + let encodedData = "CAESDCsxNTU1MTIzMTIzNCjKm4WazSw4AQ==" + let data = Data(base64Encoded: encodedData)! + + XCTAssertNoThrow(try SSKEnvelope(serializedData: data)) + } + + func testParse_invalidData() { + // `encodedData` was derived thus: + // let builder = OWSSignalServiceProtosEnvelopeBuilder() + // builder.setTimestamp(NSDate.ows_millisecondTimeStamp()) + // builder.setSource("+15551231234") + // builder.setSourceDevice(1) + // // MISSING TYPE! + // let encodedData = builder.build().data()!.base64EncodedString() + let encodedData = "EgwrMTU1NTEyMzEyMzQojdmOms0sOAE=" + let data = Data(base64Encoded: encodedData)! + + XCTAssertThrowsError(try SSKEnvelope(serializedData: data)) { (error) -> Void in + switch error { + case SSKEnvelope.EnvelopeError.invalidProtobuf: + break + default: + XCTFail("unexpected error: \(error)") + } + } + } +} diff --git a/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift b/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift index c439497349..6dfca1c970 100644 --- a/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift +++ b/SignalServiceKit/src/Protos/ProtoWrappers/SSKEnvelope.swift @@ -7,7 +7,7 @@ import Foundation @objc public class SSKEnvelope: NSObject { - enum EnvelopeError: Error { + public enum EnvelopeError: Error { case invalidProtobuf(description: String) } From 7f8dc83330122df043ffcc5f42645c5429786aac Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 25 Jul 2018 15:22:07 -0600 Subject: [PATCH 7/7] Update Pods --- Pods | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pods b/Pods index 54d12b0ebb..7c62088f5a 160000 --- a/Pods +++ b/Pods @@ -1 +1 @@ -Subproject commit 54d12b0ebb624542f3aa93d075b5f5ae02ecefc4 +Subproject commit 7c62088f5a59230b1d3435c12ab4273b97c594e9