Code generate Swift wrappers for protocol buffers.

pull/1/head
Matthew Chen 7 years ago
parent 8d814a5210
commit 6be3d2e42d

@ -491,6 +491,15 @@ class MessageContext(BaseContext):
writer.add('}') writer.add('}')
writer.newline() writer.newline()
# serializedDataIgnoringErrors() func
writer.add('// NOTE: This method is intended for debugging purposes only.')
writer.add('@objc public func serializedDataIgnoringErrors() -> Data? {')
writer.push_indent()
writer.add('return try! self.serializedData()')
writer.pop_indent()
writer.add('}')
writer.newline()
# serializedData() func # serializedData() func
writer.extend((''' writer.extend(('''
@objc @objc
@ -689,7 +698,16 @@ public func serializedData() throws -> Data {
writer.pop_indent() writer.pop_indent()
writer.add('}') writer.add('}')
writer.newline() writer.newline()
# buildIgnoringErrors() func
writer.add('// NOTE: This method is intended for debugging purposes only.')
writer.add('@objc public func buildIgnoringErrors() -> %s? {' % self.swift_name)
writer.push_indent()
writer.add('return try! self.build()')
writer.pop_indent()
writer.add('}')
writer.newline()
# build() func # build() func
writer.add('@objc public func build() throws -> %s {' % self.swift_name) writer.add('@objc public func build() throws -> %s {' % self.swift_name)
writer.push_indent() writer.push_indent()

@ -5,7 +5,7 @@
shift-base:CodedInputStream.m shift-base:CodedInputStream.m
# generated protos # generated protos
bool:WebSocketResources.pb.m bool:WebSocketResources.pb.m
bool:OWSSignalServiceProtos.pb.m bool:SSKProto.pb.m
bool:WhisperTextProtocol.pb.m bool:WhisperTextProtocol.pb.m
bool:OWSWebRTCDataProtos.pb.m bool:OWSWebRTCDataProtos.pb.m
bool:OWSSignaliOSProtos.pb.m bool:OWSSignaliOSProtos.pb.m

@ -3863,20 +3863,20 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
NSString *randomText = [self randomText]; NSString *randomText = [self randomText];
NSString *text = [[[@(counter) description] stringByAppendingString:@" "] stringByAppendingString:randomText]; NSString *text = [[[@(counter) description] stringByAppendingString:@" "] stringByAppendingString:randomText];
OWSSignalServiceProtosDataMessageBuilder *dataMessageBuilder = [OWSSignalServiceProtosDataMessageBuilder new]; SSKProtoDataMessageBuilder *dataMessageBuilder = [SSKProtoDataMessageBuilder new];
[dataMessageBuilder setBody:text]; [dataMessageBuilder setBody:text];
if ([thread isKindOfClass:[TSGroupThread class]]) { if ([thread isKindOfClass:[TSGroupThread class]]) {
TSGroupThread *groupThread = (TSGroupThread *)thread; TSGroupThread *groupThread = (TSGroupThread *)thread;
OWSSignalServiceProtosGroupContextBuilder *groupBuilder = [OWSSignalServiceProtosGroupContextBuilder new]; SSKProtoGroupContextBuilder *groupBuilder = [SSKProtoGroupContextBuilder new];
[groupBuilder setType:OWSSignalServiceProtosGroupContextTypeDeliver]; [groupBuilder setType:SSKProtoGroupContextTypeDeliver];
[groupBuilder setId:groupThread.groupModel.groupId]; [groupBuilder setId:groupThread.groupModel.groupId];
[dataMessageBuilder setGroup:groupBuilder.build]; [dataMessageBuilder setGroup:groupBuilder.buildIgnoringErrors];
} }
OWSSignalServiceProtosContentBuilder *payloadBuilder = [OWSSignalServiceProtosContentBuilder new]; SSKProtoContentBuilder *payloadBuilder = [SSKProtoContentBuilder new];
[payloadBuilder setDataMessage:dataMessageBuilder.build]; [payloadBuilder setDataMessage:dataMessageBuilder.buildIgnoringErrors];
NSData *plaintextData = [payloadBuilder build].data; NSData *plaintextData = [payloadBuilder buildIgnoringErrors].serializedDataIgnoringErrors;
// Try to use an arbitrary member of the current thread that isn't // Try to use an arbitrary member of the current thread that isn't
// ourselves as the sender. // ourselves as the sender.

@ -13,6 +13,7 @@
#import <SignalServiceKit/OWSDynamicOutgoingMessage.h> #import <SignalServiceKit/OWSDynamicOutgoingMessage.h>
#import <SignalServiceKit/OWSPrimaryStorage.h> #import <SignalServiceKit/OWSPrimaryStorage.h>
#import <SignalServiceKit/SecurityUtils.h> #import <SignalServiceKit/SecurityUtils.h>
#import <SignalServiceKit/SignalServiceKit-Swift.h>
#import <SignalServiceKit/TSGroupThread.h> #import <SignalServiceKit/TSGroupThread.h>
#import <SignalServiceKit/TSThread.h> #import <SignalServiceKit/TSThread.h>
@ -49,120 +50,135 @@ NS_ASSUME_NONNULL_BEGIN
}]]; }]];
[items addObject:[OWSTableItem itemWithTitle:@"Send no payload message" [items addObject:[OWSTableItem itemWithTitle:@"Send no payload message"
actionBlock:^{ actionBlock:^{
[DebugUIStress sendStressMessage:thread block:^(SignalRecipient *recipient) { [DebugUIStress sendStressMessage:thread
OWSSignalServiceProtosContentBuilder *contentBuilder = [OWSSignalServiceProtosContentBuilder new]; block:^(SignalRecipient *recipient) {
return [[contentBuilder build] data]; SSKProtoContentBuilder *contentBuilder =
}]; [SSKProtoContentBuilder new];
return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}];
}]]; }]];
[items addObject:[OWSTableItem itemWithTitle:@"Send empty null message" [items addObject:[OWSTableItem itemWithTitle:@"Send empty null message"
actionBlock:^{ actionBlock:^{
[DebugUIStress sendStressMessage:thread block:^(SignalRecipient *recipient) { [DebugUIStress sendStressMessage:thread
OWSSignalServiceProtosContentBuilder *contentBuilder = [OWSSignalServiceProtosContentBuilder new]; block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosNullMessageBuilder *nullMessageBuilder = [OWSSignalServiceProtosNullMessageBuilder new]; SSKProtoContentBuilder *contentBuilder =
contentBuilder.nullMessage = [nullMessageBuilder build]; [SSKProtoContentBuilder new];
return [[contentBuilder build] data]; SSKProtoNullMessageBuilder *nullMessageBuilder =
}]; [SSKProtoNullMessageBuilder new];
contentBuilder.nullMessage =
[nullMessageBuilder buildIgnoringErrors];
return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}];
}]];
[items addObject:[OWSTableItem itemWithTitle:@"Send random null message"
actionBlock:^{
[DebugUIStress
sendStressMessage:thread
block:^(SignalRecipient *recipient) {
SSKProtoContentBuilder *contentBuilder =
[SSKProtoContentBuilder new];
SSKProtoNullMessageBuilder *nullMessageBuilder =
[SSKProtoNullMessageBuilder new];
NSUInteger contentLength = arc4random_uniform(32);
nullMessageBuilder.padding =
[Cryptography generateRandomBytes:contentLength];
contentBuilder.nullMessage =
[nullMessageBuilder buildIgnoringErrors];
return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}];
}]];
[items addObject:[OWSTableItem itemWithTitle:@"Send empty sync message"
actionBlock:^{
[DebugUIStress sendStressMessage:thread
block:^(SignalRecipient *recipient) {
SSKProtoContentBuilder *contentBuilder =
[SSKProtoContentBuilder new];
SSKProtoSyncMessageBuilder *syncMessageBuilder =
[SSKProtoSyncMessageBuilder new];
contentBuilder.syncMessage =
[syncMessageBuilder buildIgnoringErrors];
return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}];
}]];
[items addObject:[OWSTableItem itemWithTitle:@"Send empty sync sent message"
actionBlock:^{
[DebugUIStress sendStressMessage:thread
block:^(SignalRecipient *recipient) {
SSKProtoContentBuilder *contentBuilder =
[SSKProtoContentBuilder new];
SSKProtoSyncMessageBuilder *syncMessageBuilder =
[SSKProtoSyncMessageBuilder new];
SSKProtoSyncMessageSentBuilder *sentBuilder =
[SSKProtoSyncMessageSentBuilder new];
syncMessageBuilder.sent =
[sentBuilder buildIgnoringErrors];
contentBuilder.syncMessage =
[syncMessageBuilder buildIgnoringErrors];
return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}];
}]]; }]];
[items
addObject:[OWSTableItem itemWithTitle:@"Send random null message"
actionBlock:^{
[DebugUIStress
sendStressMessage:thread
block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosContentBuilder *contentBuilder =
[OWSSignalServiceProtosContentBuilder new];
OWSSignalServiceProtosNullMessageBuilder *nullMessageBuilder =
[OWSSignalServiceProtosNullMessageBuilder new];
NSUInteger contentLength = arc4random_uniform(32);
nullMessageBuilder.padding =
[Cryptography generateRandomBytes:contentLength];
contentBuilder.nullMessage = [nullMessageBuilder build];
return [[contentBuilder build] data];
}];
}]];
[items
addObject:[OWSTableItem itemWithTitle:@"Send empty sync message"
actionBlock:^{
[DebugUIStress
sendStressMessage:thread
block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosContentBuilder *contentBuilder =
[OWSSignalServiceProtosContentBuilder new];
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
[OWSSignalServiceProtosSyncMessageBuilder new];
contentBuilder.syncMessage = [syncMessageBuilder build];
return [[contentBuilder build] data];
}];
}]];
[items
addObject:[OWSTableItem itemWithTitle:@"Send empty sync sent message"
actionBlock:^{
[DebugUIStress
sendStressMessage:thread
block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosContentBuilder *contentBuilder =
[OWSSignalServiceProtosContentBuilder new];
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
[OWSSignalServiceProtosSyncMessageBuilder new];
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder =
[OWSSignalServiceProtosSyncMessageSentBuilder new];
syncMessageBuilder.sent = [sentBuilder build];
contentBuilder.syncMessage = [syncMessageBuilder build];
return [[contentBuilder build] data];
}];
}]];
[items addObject:[OWSTableItem itemWithTitle:@"Send whitespace text data message" [items addObject:[OWSTableItem itemWithTitle:@"Send whitespace text data message"
actionBlock:^{ actionBlock:^{
[DebugUIStress [DebugUIStress
sendStressMessage:thread sendStressMessage:thread
block:^(SignalRecipient *recipient) { block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosContentBuilder *contentBuilder = SSKProtoContentBuilder *contentBuilder =
[OWSSignalServiceProtosContentBuilder new]; [SSKProtoContentBuilder new];
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
dataBuilder.body = @" "; dataBuilder.body = @" ";
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder [DebugUIStress ensureGroupOfDataBuilder:dataBuilder
thread:thread]; thread:thread];
contentBuilder.dataMessage = [dataBuilder build]; contentBuilder.dataMessage =
return [[contentBuilder build] data]; [dataBuilder buildIgnoringErrors];
return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}]; }];
}]]; }]];
[items addObject:[OWSTableItem [items
itemWithTitle:@"Send bad attachment data message" addObject:[OWSTableItem
actionBlock:^{ itemWithTitle:@"Send bad attachment data message"
[DebugUIStress actionBlock:^{
sendStressMessage:thread [DebugUIStress
block:^(SignalRecipient *recipient) { sendStressMessage:thread
OWSSignalServiceProtosContentBuilder *contentBuilder = block:^(SignalRecipient *recipient) {
[OWSSignalServiceProtosContentBuilder new]; SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
OWSSignalServiceProtosAttachmentPointerBuilder *attachmentPointer = SSKProtoAttachmentPointerBuilder *attachmentPointer =
[OWSSignalServiceProtosAttachmentPointerBuilder new]; [SSKProtoAttachmentPointerBuilder new];
[attachmentPointer setId:arc4random_uniform(32) + 1]; [attachmentPointer setId:arc4random_uniform(32) + 1];
[attachmentPointer setContentType:@"1"]; [attachmentPointer setContentType:@"1"];
[attachmentPointer setSize:arc4random_uniform(32) + 1]; [attachmentPointer setSize:arc4random_uniform(32) + 1];
[attachmentPointer setDigest:[Cryptography generateRandomBytes:1]]; [attachmentPointer setDigest:[Cryptography generateRandomBytes:1]];
[attachmentPointer setFileName:@" "]; [attachmentPointer setFileName:@" "];
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread]; [DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
contentBuilder.dataMessage = [dataBuilder build]; contentBuilder.dataMessage = [dataBuilder buildIgnoringErrors];
return [[contentBuilder build] data]; return
}]; [[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
}]]; }];
}]];
[items addObject:[OWSTableItem itemWithTitle:@"Send normal text data message" [items addObject:[OWSTableItem itemWithTitle:@"Send normal text data message"
actionBlock:^{ actionBlock:^{
[DebugUIStress [DebugUIStress
sendStressMessage:thread sendStressMessage:thread
block:^(SignalRecipient *recipient) { block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosContentBuilder *contentBuilder = SSKProtoContentBuilder *contentBuilder =
[OWSSignalServiceProtosContentBuilder new]; [SSKProtoContentBuilder new];
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
dataBuilder.body = @"alice"; dataBuilder.body = @"alice";
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder [DebugUIStress ensureGroupOfDataBuilder:dataBuilder
thread:thread]; thread:thread];
contentBuilder.dataMessage = [dataBuilder build]; contentBuilder.dataMessage =
return [[contentBuilder build] data]; [dataBuilder buildIgnoringErrors];
return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}]; }];
}]]; }]];
[items addObject:[OWSTableItem itemWithTitle:@"Send N text messages with same timestamp" [items addObject:[OWSTableItem itemWithTitle:@"Send N text messages with same timestamp"
@ -173,17 +189,19 @@ NS_ASSUME_NONNULL_BEGIN
sendStressMessage:thread sendStressMessage:thread
timestamp:timestamp timestamp:timestamp
block:^(SignalRecipient *recipient) { block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosContentBuilder *contentBuilder = SSKProtoContentBuilder *contentBuilder =
[OWSSignalServiceProtosContentBuilder new]; [SSKProtoContentBuilder new];
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
dataBuilder.body = [NSString stringWithFormat:@"%@ %d", dataBuilder.body = [NSString stringWithFormat:@"%@ %d",
[NSUUID UUID].UUIDString, [NSUUID UUID].UUIDString,
i]; i];
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder [DebugUIStress ensureGroupOfDataBuilder:dataBuilder
thread:thread]; thread:thread];
contentBuilder.dataMessage = [dataBuilder build]; contentBuilder.dataMessage =
return [[contentBuilder build] data]; [dataBuilder buildIgnoringErrors];
return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}]; }];
} }
}]]; }]];
@ -195,15 +213,16 @@ NS_ASSUME_NONNULL_BEGIN
sendStressMessage:thread sendStressMessage:thread
timestamp:timestamp timestamp:timestamp
block:^(SignalRecipient *recipient) { block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosContentBuilder *contentBuilder = SSKProtoContentBuilder *contentBuilder =
[OWSSignalServiceProtosContentBuilder new]; [SSKProtoContentBuilder new];
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
dataBuilder.body = dataBuilder.body =
[[NSUUID UUID].UUIDString stringByAppendingString:@" now"]; [[NSUUID UUID].UUIDString stringByAppendingString:@" now"];
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread]; [DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
contentBuilder.dataMessage = [dataBuilder build]; contentBuilder.dataMessage = [dataBuilder buildIgnoringErrors];
return [[contentBuilder build] data]; return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}]; }];
}]]; }]];
[items addObject:[OWSTableItem [items addObject:[OWSTableItem
@ -215,15 +234,16 @@ NS_ASSUME_NONNULL_BEGIN
sendStressMessage:thread sendStressMessage:thread
timestamp:timestamp timestamp:timestamp
block:^(SignalRecipient *recipient) { block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosContentBuilder *contentBuilder = SSKProtoContentBuilder *contentBuilder =
[OWSSignalServiceProtosContentBuilder new]; [SSKProtoContentBuilder new];
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
dataBuilder.body = dataBuilder.body =
[[NSUUID UUID].UUIDString stringByAppendingString:@" now"]; [[NSUUID UUID].UUIDString stringByAppendingString:@" now"];
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread]; [DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
contentBuilder.dataMessage = [dataBuilder build]; contentBuilder.dataMessage = [dataBuilder buildIgnoringErrors];
return [[contentBuilder build] data]; return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}]; }];
}]]; }]];
[items addObject:[OWSTableItem [items addObject:[OWSTableItem
@ -235,27 +255,27 @@ NS_ASSUME_NONNULL_BEGIN
sendStressMessage:thread sendStressMessage:thread
timestamp:timestamp timestamp:timestamp
block:^(SignalRecipient *recipient) { block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosContentBuilder *contentBuilder = SSKProtoContentBuilder *contentBuilder =
[OWSSignalServiceProtosContentBuilder new]; [SSKProtoContentBuilder new];
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
dataBuilder.body = dataBuilder.body =
[[NSUUID UUID].UUIDString stringByAppendingString:@" now"]; [[NSUUID UUID].UUIDString stringByAppendingString:@" now"];
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread]; [DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
contentBuilder.dataMessage = [dataBuilder build]; contentBuilder.dataMessage = [dataBuilder buildIgnoringErrors];
return [[contentBuilder build] data]; return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}]; }];
}]]; }]];
[items addObject:[OWSTableItem itemWithTitle:@"Send N text messages with same timestamp" [items addObject:[OWSTableItem itemWithTitle:@"Send N text messages with same timestamp"
actionBlock:^{ actionBlock:^{
OWSSignalServiceProtosContentBuilder *contentBuilder = SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
[OWSSignalServiceProtosContentBuilder new]; SSKProtoDataMessageBuilder *dataBuilder = [SSKProtoDataMessageBuilder new];
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new];
dataBuilder.body = @"alice"; dataBuilder.body = @"alice";
contentBuilder.dataMessage = [dataBuilder build]; contentBuilder.dataMessage = [dataBuilder buildIgnoringErrors];
[DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread]; [DebugUIStress ensureGroupOfDataBuilder:dataBuilder thread:thread];
NSData *data = [[contentBuilder build] data]; NSData *data =
[[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
uint64_t timestamp = [NSDate ows_millisecondTimeStamp]; uint64_t timestamp = [NSDate ows_millisecondTimeStamp];
@ -268,145 +288,151 @@ NS_ASSUME_NONNULL_BEGIN
} }
}]]; }]];
[items [items
addObject:[OWSTableItem itemWithTitle:@"Send malformed sync sent message 1" addObject:[OWSTableItem
actionBlock:^{ itemWithTitle:@"Send malformed sync sent message 1"
[DebugUIStress actionBlock:^{
sendStressMessage:thread [DebugUIStress
block:^(SignalRecipient *recipient) { sendStressMessage:thread
OWSSignalServiceProtosContentBuilder *contentBuilder = block:^(SignalRecipient *recipient) {
[OWSSignalServiceProtosContentBuilder new]; SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder = SSKProtoSyncMessageBuilder *syncMessageBuilder =
[OWSSignalServiceProtosSyncMessageBuilder new]; [SSKProtoSyncMessageBuilder new];
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder = SSKProtoSyncMessageSentBuilder *sentBuilder =
[OWSSignalServiceProtosSyncMessageSentBuilder new]; [SSKProtoSyncMessageSentBuilder new];
sentBuilder.destination = @"abc"; sentBuilder.destination = @"abc";
sentBuilder.timestamp = arc4random_uniform(32) + 1; sentBuilder.timestamp = arc4random_uniform(32) + 1;
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
sentBuilder.message = [dataBuilder build]; sentBuilder.message = [dataBuilder buildIgnoringErrors];
syncMessageBuilder.sent = [sentBuilder build]; syncMessageBuilder.sent = [sentBuilder buildIgnoringErrors];
contentBuilder.syncMessage = [syncMessageBuilder build]; contentBuilder.syncMessage = [syncMessageBuilder buildIgnoringErrors];
return [[contentBuilder build] data]; return
}]; [[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
}]]; }];
[items }]];
addObject:[OWSTableItem itemWithTitle:@"Send malformed sync sent message 2"
actionBlock:^{
[DebugUIStress
sendStressMessage:thread
block:^(SignalRecipient *recipient) {
OWSSignalServiceProtosContentBuilder *contentBuilder =
[OWSSignalServiceProtosContentBuilder new];
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder =
[OWSSignalServiceProtosSyncMessageBuilder new];
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder =
[OWSSignalServiceProtosSyncMessageSentBuilder new];
sentBuilder.destination = @"abc";
sentBuilder.timestamp = 0;
OWSSignalServiceProtosDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new];
sentBuilder.message = [dataBuilder build];
syncMessageBuilder.sent = [sentBuilder build];
contentBuilder.syncMessage = [syncMessageBuilder build];
return [[contentBuilder build] data];
}];
}]];
[items [items
addObject:[OWSTableItem itemWithTitle:@"Send malformed sync sent message 3" addObject:[OWSTableItem
actionBlock:^{ itemWithTitle:@"Send malformed sync sent message 2"
[DebugUIStress actionBlock:^{
sendStressMessage:thread [DebugUIStress
block:^(SignalRecipient *recipient) { sendStressMessage:thread
OWSSignalServiceProtosContentBuilder *contentBuilder = block:^(SignalRecipient *recipient) {
[OWSSignalServiceProtosContentBuilder new]; SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder = SSKProtoSyncMessageBuilder *syncMessageBuilder =
[OWSSignalServiceProtosSyncMessageBuilder new]; [SSKProtoSyncMessageBuilder new];
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder = SSKProtoSyncMessageSentBuilder *sentBuilder =
[OWSSignalServiceProtosSyncMessageSentBuilder new]; [SSKProtoSyncMessageSentBuilder new];
sentBuilder.destination = @"abc"; sentBuilder.destination = @"abc";
sentBuilder.timestamp = 0; sentBuilder.timestamp = 0;
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
dataBuilder.body = @" "; sentBuilder.message = [dataBuilder buildIgnoringErrors];
sentBuilder.message = [dataBuilder build]; syncMessageBuilder.sent = [sentBuilder buildIgnoringErrors];
syncMessageBuilder.sent = [sentBuilder build]; contentBuilder.syncMessage = [syncMessageBuilder buildIgnoringErrors];
contentBuilder.syncMessage = [syncMessageBuilder build]; return
return [[contentBuilder build] data]; [[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
}]; }];
}]]; }]];
[items [items
addObject:[OWSTableItem itemWithTitle:@"Send malformed sync sent message 4" addObject:[OWSTableItem
actionBlock:^{ itemWithTitle:@"Send malformed sync sent message 3"
[DebugUIStress actionBlock:^{
sendStressMessage:thread [DebugUIStress
block:^(SignalRecipient *recipient) { sendStressMessage:thread
OWSSignalServiceProtosContentBuilder *contentBuilder = block:^(SignalRecipient *recipient) {
[OWSSignalServiceProtosContentBuilder new]; SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder = SSKProtoSyncMessageBuilder *syncMessageBuilder =
[OWSSignalServiceProtosSyncMessageBuilder new]; [SSKProtoSyncMessageBuilder new];
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder = SSKProtoSyncMessageSentBuilder *sentBuilder =
[OWSSignalServiceProtosSyncMessageSentBuilder new]; [SSKProtoSyncMessageSentBuilder new];
sentBuilder.destination = @"abc"; sentBuilder.destination = @"abc";
sentBuilder.timestamp = 0; sentBuilder.timestamp = 0;
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
dataBuilder.body = @" "; dataBuilder.body = @" ";
OWSSignalServiceProtosGroupContextBuilder *groupBuilder = sentBuilder.message = [dataBuilder buildIgnoringErrors];
[OWSSignalServiceProtosGroupContextBuilder new]; syncMessageBuilder.sent = [sentBuilder buildIgnoringErrors];
[groupBuilder setId:[Cryptography generateRandomBytes:1]]; contentBuilder.syncMessage = [syncMessageBuilder buildIgnoringErrors];
dataBuilder.group = [groupBuilder build]; return
sentBuilder.message = [dataBuilder build]; [[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
syncMessageBuilder.sent = [sentBuilder build]; }];
contentBuilder.syncMessage = [syncMessageBuilder build]; }]];
return [[contentBuilder build] data];
}];
}]];
[items [items
addObject:[OWSTableItem itemWithTitle:@"Send malformed sync sent message 5" addObject:[OWSTableItem
actionBlock:^{ itemWithTitle:@"Send malformed sync sent message 4"
[DebugUIStress actionBlock:^{
sendStressMessage:thread [DebugUIStress
block:^(SignalRecipient *recipient) { sendStressMessage:thread
OWSSignalServiceProtosContentBuilder *contentBuilder = block:^(SignalRecipient *recipient) {
[OWSSignalServiceProtosContentBuilder new]; SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder = SSKProtoSyncMessageBuilder *syncMessageBuilder =
[OWSSignalServiceProtosSyncMessageBuilder new]; [SSKProtoSyncMessageBuilder new];
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder = SSKProtoSyncMessageSentBuilder *sentBuilder =
[OWSSignalServiceProtosSyncMessageSentBuilder new]; [SSKProtoSyncMessageSentBuilder new];
sentBuilder.destination = @"abc"; sentBuilder.destination = @"abc";
sentBuilder.timestamp = 0; sentBuilder.timestamp = 0;
OWSSignalServiceProtosDataMessageBuilder *dataBuilder = SSKProtoDataMessageBuilder *dataBuilder =
[OWSSignalServiceProtosDataMessageBuilder new]; [SSKProtoDataMessageBuilder new];
dataBuilder.body = @" "; dataBuilder.body = @" ";
OWSSignalServiceProtosGroupContextBuilder *groupBuilder = SSKProtoGroupContextBuilder *groupBuilder =
[OWSSignalServiceProtosGroupContextBuilder new]; [SSKProtoGroupContextBuilder new];
[groupBuilder setId:[Cryptography generateRandomBytes:1]]; [groupBuilder setId:[Cryptography generateRandomBytes:1]];
dataBuilder.group = [groupBuilder build]; dataBuilder.group = [groupBuilder buildIgnoringErrors];
sentBuilder.message = [dataBuilder build]; sentBuilder.message = [dataBuilder buildIgnoringErrors];
syncMessageBuilder.sent = [sentBuilder build]; syncMessageBuilder.sent = [sentBuilder buildIgnoringErrors];
contentBuilder.syncMessage = [syncMessageBuilder build]; contentBuilder.syncMessage = [syncMessageBuilder buildIgnoringErrors];
return [[contentBuilder build] data]; return
}]; [[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
}]]; }];
}]];
[items [items
addObject:[OWSTableItem itemWithTitle:@"Send empty sync sent message 6" addObject:[OWSTableItem
actionBlock:^{ itemWithTitle:@"Send malformed sync sent message 5"
[DebugUIStress actionBlock:^{
sendStressMessage:thread [DebugUIStress
block:^(SignalRecipient *recipient) { sendStressMessage:thread
OWSSignalServiceProtosContentBuilder *contentBuilder = block:^(SignalRecipient *recipient) {
[OWSSignalServiceProtosContentBuilder new]; SSKProtoContentBuilder *contentBuilder = [SSKProtoContentBuilder new];
OWSSignalServiceProtosSyncMessageBuilder *syncMessageBuilder = SSKProtoSyncMessageBuilder *syncMessageBuilder =
[OWSSignalServiceProtosSyncMessageBuilder new]; [SSKProtoSyncMessageBuilder new];
OWSSignalServiceProtosSyncMessageSentBuilder *sentBuilder = SSKProtoSyncMessageSentBuilder *sentBuilder =
[OWSSignalServiceProtosSyncMessageSentBuilder new]; [SSKProtoSyncMessageSentBuilder new];
sentBuilder.destination = @"abc"; sentBuilder.destination = @"abc";
syncMessageBuilder.sent = [sentBuilder build]; sentBuilder.timestamp = 0;
contentBuilder.syncMessage = [syncMessageBuilder build]; SSKProtoDataMessageBuilder *dataBuilder =
return [[contentBuilder build] data]; [SSKProtoDataMessageBuilder new];
}]; dataBuilder.body = @" ";
}]]; SSKProtoGroupContextBuilder *groupBuilder =
[SSKProtoGroupContextBuilder new];
[groupBuilder setId:[Cryptography generateRandomBytes:1]];
dataBuilder.group = [groupBuilder buildIgnoringErrors];
sentBuilder.message = [dataBuilder buildIgnoringErrors];
syncMessageBuilder.sent = [sentBuilder buildIgnoringErrors];
contentBuilder.syncMessage = [syncMessageBuilder buildIgnoringErrors];
return
[[contentBuilder buildIgnoringErrors] serializedDataIgnoringErrors];
}];
}]];
[items addObject:[OWSTableItem itemWithTitle:@"Send empty sync sent message 6"
actionBlock:^{
[DebugUIStress sendStressMessage:thread
block:^(SignalRecipient *recipient) {
SSKProtoContentBuilder *contentBuilder =
[SSKProtoContentBuilder new];
SSKProtoSyncMessageBuilder *syncMessageBuilder =
[SSKProtoSyncMessageBuilder new];
SSKProtoSyncMessageSentBuilder *sentBuilder =
[SSKProtoSyncMessageSentBuilder new];
sentBuilder.destination = @"abc";
syncMessageBuilder.sent =
[sentBuilder buildIgnoringErrors];
contentBuilder.syncMessage =
[syncMessageBuilder buildIgnoringErrors];
return [[contentBuilder buildIgnoringErrors]
serializedDataIgnoringErrors];
}];
}]];
if ([thread isKindOfClass:[TSGroupThread class]]) { if ([thread isKindOfClass:[TSGroupThread class]]) {
TSGroupThread *groupThread = (TSGroupThread *)thread; TSGroupThread *groupThread = (TSGroupThread *)thread;
[items addObject:[OWSTableItem itemWithTitle:@"Hallucinate twin group" [items addObject:[OWSTableItem itemWithTitle:@"Hallucinate twin group"
@ -417,7 +443,7 @@ NS_ASSUME_NONNULL_BEGIN
return [OWSTableSection sectionWithTitle:self.name items:items]; return [OWSTableSection sectionWithTitle:self.name items:items];
} }
+ (void)ensureGroupOfDataBuilder:(OWSSignalServiceProtosDataMessageBuilder *)dataBuilder thread:(TSThread *)thread + (void)ensureGroupOfDataBuilder:(SSKProtoDataMessageBuilder *)dataBuilder thread:(TSThread *)thread
{ {
OWSAssert(dataBuilder); OWSAssert(dataBuilder);
OWSAssert(thread); OWSAssert(thread);
@ -427,10 +453,10 @@ NS_ASSUME_NONNULL_BEGIN
} }
TSGroupThread *groupThread = (TSGroupThread *)thread; TSGroupThread *groupThread = (TSGroupThread *)thread;
OWSSignalServiceProtosGroupContextBuilder *groupBuilder = [OWSSignalServiceProtosGroupContextBuilder new]; SSKProtoGroupContextBuilder *groupBuilder = [SSKProtoGroupContextBuilder new];
[groupBuilder setType:OWSSignalServiceProtosGroupContextTypeDeliver]; [groupBuilder setType:SSKProtoGroupContextTypeDeliver];
[groupBuilder setId:groupThread.groupModel.groupId]; [groupBuilder setId:groupThread.groupModel.groupId];
[dataBuilder setGroup:groupBuilder.build]; [dataBuilder setGroup:groupBuilder.buildIgnoringErrors];
} }
+ (void)sendStressMessage:(TSOutgoingMessage *)message + (void)sendStressMessage:(TSOutgoingMessage *)message

@ -9,7 +9,7 @@ import SignalMessaging
@objc(OWSWebRTCCallMessageHandler) @objc(OWSWebRTCCallMessageHandler)
public class WebRTCCallMessageHandler: NSObject, OWSCallMessageHandler { public class WebRTCCallMessageHandler: NSObject, OWSCallMessageHandler {
// MARK - Properties // MARK: - Properties
let TAG = "[WebRTCCallMessageHandler]" let TAG = "[WebRTCCallMessageHandler]"
@ -33,34 +33,22 @@ public class WebRTCCallMessageHandler: NSObject, OWSCallMessageHandler {
// MARK: - Call Handlers // MARK: - Call Handlers
public func receivedOffer(_ offer: OWSSignalServiceProtosCallMessageOffer, from callerId: String) { public func receivedOffer(_ offer: SSKProtoCallMessageOffer, from callerId: String) {
SwiftAssertIsOnMainThread(#function) SwiftAssertIsOnMainThread(#function)
guard offer.hasId() else {
owsFail("no callId in \(#function)")
return
}
let thread = TSContactThread.getOrCreateThread(contactId: callerId) let thread = TSContactThread.getOrCreateThread(contactId: callerId)
self.callService.handleReceivedOffer(thread: thread, callId: offer.id, sessionDescription: offer.sessionDescription) self.callService.handleReceivedOffer(thread: thread, callId: offer.id, sessionDescription: offer.sessionDescription)
} }
public func receivedAnswer(_ answer: OWSSignalServiceProtosCallMessageAnswer, from callerId: String) { public func receivedAnswer(_ answer: SSKProtoCallMessageAnswer, from callerId: String) {
SwiftAssertIsOnMainThread(#function) SwiftAssertIsOnMainThread(#function)
guard answer.hasId() else {
owsFail("no callId in \(#function)")
return
}
let thread = TSContactThread.getOrCreateThread(contactId: callerId) let thread = TSContactThread.getOrCreateThread(contactId: callerId)
self.callService.handleReceivedAnswer(thread: thread, callId: answer.id, sessionDescription: answer.sessionDescription) self.callService.handleReceivedAnswer(thread: thread, callId: answer.id, sessionDescription: answer.sessionDescription)
} }
public func receivedIceUpdate(_ iceUpdate: OWSSignalServiceProtosCallMessageIceUpdate, from callerId: String) { public func receivedIceUpdate(_ iceUpdate: SSKProtoCallMessageIceUpdate, from callerId: String) {
SwiftAssertIsOnMainThread(#function) SwiftAssertIsOnMainThread(#function)
guard iceUpdate.hasId() else {
owsFail("no callId in \(#function)")
return
}
let thread = TSContactThread.getOrCreateThread(contactId: callerId) let thread = TSContactThread.getOrCreateThread(contactId: callerId)
@ -71,23 +59,15 @@ public class WebRTCCallMessageHandler: NSObject, OWSCallMessageHandler {
self.callService.handleRemoteAddedIceCandidate(thread: thread, callId: iceUpdate.id, sdp: iceUpdate.sdp, lineIndex: lineIndex, mid: iceUpdate.sdpMid) self.callService.handleRemoteAddedIceCandidate(thread: thread, callId: iceUpdate.id, sdp: iceUpdate.sdp, lineIndex: lineIndex, mid: iceUpdate.sdpMid)
} }
public func receivedHangup(_ hangup: OWSSignalServiceProtosCallMessageHangup, from callerId: String) { public func receivedHangup(_ hangup: SSKProtoCallMessageHangup, from callerId: String) {
SwiftAssertIsOnMainThread(#function) SwiftAssertIsOnMainThread(#function)
guard hangup.hasId() else {
owsFail("no callId in \(#function)")
return
}
let thread = TSContactThread.getOrCreateThread(contactId: callerId) let thread = TSContactThread.getOrCreateThread(contactId: callerId)
self.callService.handleRemoteHangup(thread: thread, callId: hangup.id) self.callService.handleRemoteHangup(thread: thread, callId: hangup.id)
} }
public func receivedBusy(_ busy: OWSSignalServiceProtosCallMessageBusy, from callerId: String) { public func receivedBusy(_ busy: SSKProtoCallMessageBusy, from callerId: String) {
SwiftAssertIsOnMainThread(#function) SwiftAssertIsOnMainThread(#function)
guard busy.hasId() else {
owsFail("no callId in \(#function)")
return
}
let thread = TSContactThread.getOrCreateThread(contactId: callerId) let thread = TSContactThread.getOrCreateThread(contactId: callerId)
self.callService.handleRemoteBusy(thread: thread, callId: busy.id) self.callService.handleRemoteBusy(thread: thread, callId: busy.id)

@ -5,7 +5,6 @@
#import "OWSBackupExportJob.h" #import "OWSBackupExportJob.h"
#import "OWSBackupIO.h" #import "OWSBackupIO.h"
#import "OWSDatabaseMigration.h" #import "OWSDatabaseMigration.h"
#import "OWSSignalServiceProtos.pb.h"
#import "Signal-Swift.h" #import "Signal-Swift.h"
#import <SignalServiceKit/NSData+Base64.h> #import <SignalServiceKit/NSData+Base64.h>
#import <SignalServiceKit/NSDate+OWS.h> #import <SignalServiceKit/NSDate+OWS.h>

@ -33,11 +33,11 @@ class SSKProtoEnvelopeTest: XCTestCase {
func testParse_ValidData() { func testParse_ValidData() {
// `encodedData` was derived thus: // `encodedData` was derived thus:
// let builder = OWSSignalServiceProtosEnvelopeBuilder() // let builder = SSKProtoEnvelopeBuilder()
// builder.setTimestamp(NSDate.ows_millisecondTimeStamp()) // builder.setTimestamp(NSDate.ows_millisecondTimeStamp())
// builder.setSource("+15551231234") // builder.setSource("+15551231234")
// builder.setSourceDevice(1) // builder.setSourceDevice(1)
// builder.setType(OWSSignalServiceProtosEnvelopeType.ciphertext) // builder.setType(SSKProtoEnvelopeType.ciphertext)
// let encodedData = builder.build().data()!.base64EncodedString() // let encodedData = builder.build().data()!.base64EncodedString()
let encodedData = "CAESDCsxNTU1MTIzMTIzNCjKm4WazSw4AQ==" let encodedData = "CAESDCsxNTU1MTIzMTIzNCjKm4WazSw4AQ=="
let data = Data(base64Encoded: encodedData)! let data = Data(base64Encoded: encodedData)!
@ -47,7 +47,7 @@ class SSKProtoEnvelopeTest: XCTestCase {
func testParse_invalidData() { func testParse_invalidData() {
// `encodedData` was derived thus: // `encodedData` was derived thus:
// let builder = OWSSignalServiceProtosEnvelopeBuilder() // let builder = SSKProtoEnvelopeBuilder()
// builder.setTimestamp(NSDate.ows_millisecondTimeStamp()) // builder.setTimestamp(NSDate.ows_millisecondTimeStamp())
// builder.setSource("+15551231234") // builder.setSource("+15551231234")
// builder.setSourceDevice(1) // builder.setSourceDevice(1)

@ -2,7 +2,7 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "OWSSignalServiceProtos.pb.h" #import "SSKProto.pb.h"
#import <SignalServiceKit/CDSSigningCertificate.h> #import <SignalServiceKit/CDSSigningCertificate.h>
#import <SignalServiceKit/NSData+Base64.h> #import <SignalServiceKit/NSData+Base64.h>
#import <SignalServiceKit/NSData+OWS.h> #import <SignalServiceKit/NSData+OWS.h>

@ -2,7 +2,7 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "OWSSignalServiceProtos.pb.h" #import "SSKProto.pb.h"
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
@interface ProtoParsingTest : XCTestCase @interface ProtoParsingTest : XCTestCase
@ -15,14 +15,14 @@
- (void)testProtoParsing_nil - (void)testProtoParsing_nil
{ {
OWSSignalServiceProtosEnvelope *_Nullable envelope = [OWSSignalServiceProtosEnvelope parseFromData:nil]; SSKProtoEnvelope *_Nullable envelope = [SSKProtoEnvelope parseFromData:nil];
XCTAssertNotNil(envelope); XCTAssertNotNil(envelope);
} }
- (void)testProtoParsing_empty - (void)testProtoParsing_empty
{ {
NSData *data = [NSData new]; NSData *data = [NSData new];
OWSSignalServiceProtosEnvelope *_Nullable envelope = [OWSSignalServiceProtosEnvelope parseFromData:data]; SSKProtoEnvelope *_Nullable envelope = [SSKProtoEnvelope parseFromData:data];
XCTAssertNotNil(envelope); XCTAssertNotNil(envelope);
} }
@ -30,7 +30,7 @@
{ {
@try { @try {
NSData *data = [@"test" dataUsingEncoding:NSUTF8StringEncoding]; NSData *data = [@"test" dataUsingEncoding:NSUTF8StringEncoding];
[OWSSignalServiceProtosEnvelope parseFromData:data]; [SSKProtoEnvelope parseFromData:data];
XCTFail(@"Missing expected exception"); XCTFail(@"Missing expected exception");
} @catch (NSException *exception) { } @catch (NSException *exception) {
// Exception is expected. // Exception is expected.

@ -1,5 +1,5 @@
// //
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
import SignalServiceKit import SignalServiceKit
@ -7,23 +7,23 @@ import SignalServiceKit
@objc @objc
public class NoopCallMessageHandler: NSObject, OWSCallMessageHandler { public class NoopCallMessageHandler: NSObject, OWSCallMessageHandler {
public func receivedOffer(_ offer: OWSSignalServiceProtosCallMessageOffer, from callerId: String) { public func receivedOffer(_ offer: SSKProtoCallMessageOffer, from callerId: String) {
owsFail("\(self.logTag) in \(#function).") owsFail("\(self.logTag) in \(#function).")
} }
public func receivedAnswer(_ answer: OWSSignalServiceProtosCallMessageAnswer, from callerId: String) { public func receivedAnswer(_ answer: SSKProtoCallMessageAnswer, from callerId: String) {
owsFail("\(self.logTag) in \(#function).") owsFail("\(self.logTag) in \(#function).")
} }
public func receivedIceUpdate(_ iceUpdate: OWSSignalServiceProtosCallMessageIceUpdate, from callerId: String) { public func receivedIceUpdate(_ iceUpdate: SSKProtoCallMessageIceUpdate, from callerId: String) {
owsFail("\(self.logTag) in \(#function).") owsFail("\(self.logTag) in \(#function).")
} }
public func receivedHangup(_ hangup: OWSSignalServiceProtosCallMessageHangup, from callerId: String) { public func receivedHangup(_ hangup: SSKProtoCallMessageHangup, from callerId: String) {
owsFail("\(self.logTag) in \(#function).") owsFail("\(self.logTag) in \(#function).")
} }
public func receivedBusy(_ busy: OWSSignalServiceProtosCallMessageBusy, from callerId: String) { public func receivedBusy(_ busy: SSKProtoCallMessageBusy, from callerId: String) {
owsFail("\(self.logTag) in \(#function).") owsFail("\(self.logTag) in \(#function).")
} }
} }

@ -50,6 +50,7 @@ message CallMessage {
optional uint64 id = 1; optional uint64 id = 1;
// Signal-iOS renamed the description field to avoid // Signal-iOS renamed the description field to avoid
// conflicts with [NSObject description]. // conflicts with [NSObject description].
// @required
optional string sessionDescription = 2; optional string sessionDescription = 2;
} }
@ -58,14 +59,18 @@ message CallMessage {
optional uint64 id = 1; optional uint64 id = 1;
// Signal-iOS renamed the description field to avoid // Signal-iOS renamed the description field to avoid
// conflicts with [NSObject description]. // conflicts with [NSObject description].
// @required
optional string sessionDescription = 2; optional string sessionDescription = 2;
} }
message IceUpdate { message IceUpdate {
// @required // @required
optional uint64 id = 1; optional uint64 id = 1;
// @required
optional string sdpMid = 2; optional string sdpMid = 2;
// @required
optional uint32 sdpMLineIndex = 3; optional uint32 sdpMLineIndex = 3;
// @required
optional string sdp = 4; optional string sdp = 4;
} }

@ -80,6 +80,11 @@ public enum SSKProtoError: Error {
proto.content = valueParam proto.content = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoEnvelope? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoEnvelope { @objc public func build() throws -> SSKProtoEnvelope {
let wrapper = try SSKProtoEnvelope.parseProto(proto) let wrapper = try SSKProtoEnvelope.parseProto(proto)
return wrapper return wrapper
@ -138,6 +143,11 @@ public enum SSKProtoError: Error {
self.timestamp = timestamp self.timestamp = timestamp
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -214,6 +224,11 @@ public enum SSKProtoError: Error {
proto.receiptMessage = valueParam.proto proto.receiptMessage = valueParam.proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoContent? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoContent { @objc public func build() throws -> SSKProtoContent {
let wrapper = try SSKProtoContent.parseProto(proto) let wrapper = try SSKProtoContent.parseProto(proto)
return wrapper return wrapper
@ -261,6 +276,11 @@ public enum SSKProtoError: Error {
self.receiptMessage = receiptMessage self.receiptMessage = receiptMessage
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -331,6 +351,11 @@ public enum SSKProtoError: Error {
proto.sessionDescription = valueParam proto.sessionDescription = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoCallMessageOffer? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoCallMessageOffer { @objc public func build() throws -> SSKProtoCallMessageOffer {
let wrapper = try SSKProtoCallMessageOffer.parseProto(proto) let wrapper = try SSKProtoCallMessageOffer.parseProto(proto)
return wrapper return wrapper
@ -341,20 +366,19 @@ public enum SSKProtoError: Error {
@objc public let id: UInt64 @objc public let id: UInt64
@objc public var sessionDescription: String? { @objc public let sessionDescription: String
guard proto.hasSessionDescription else {
return nil
}
return proto.sessionDescription
}
@objc public var hasSessionDescription: Bool {
return proto.hasSessionDescription
}
private init(proto: SignalServiceProtos_CallMessage.Offer, private init(proto: SignalServiceProtos_CallMessage.Offer,
id: UInt64) { id: UInt64,
sessionDescription: String) {
self.proto = proto self.proto = proto
self.id = id self.id = id
self.sessionDescription = sessionDescription
}
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
} }
@objc @objc
@ -373,12 +397,18 @@ public enum SSKProtoError: Error {
} }
let id = proto.id let id = proto.id
guard proto.hasSessionDescription else {
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sessionDescription")
}
let sessionDescription = proto.sessionDescription
// MARK: - Begin Validation Logic for SSKProtoCallMessageOffer - // MARK: - Begin Validation Logic for SSKProtoCallMessageOffer -
// MARK: - End Validation Logic for SSKProtoCallMessageOffer - // MARK: - End Validation Logic for SSKProtoCallMessageOffer -
let result = SSKProtoCallMessageOffer(proto: proto, let result = SSKProtoCallMessageOffer(proto: proto,
id: id) id: id,
sessionDescription: sessionDescription)
return result return result
} }
} }
@ -403,6 +433,11 @@ public enum SSKProtoError: Error {
proto.sessionDescription = valueParam proto.sessionDescription = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoCallMessageAnswer? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoCallMessageAnswer { @objc public func build() throws -> SSKProtoCallMessageAnswer {
let wrapper = try SSKProtoCallMessageAnswer.parseProto(proto) let wrapper = try SSKProtoCallMessageAnswer.parseProto(proto)
return wrapper return wrapper
@ -413,20 +448,19 @@ public enum SSKProtoError: Error {
@objc public let id: UInt64 @objc public let id: UInt64
@objc public var sessionDescription: String? { @objc public let sessionDescription: String
guard proto.hasSessionDescription else {
return nil
}
return proto.sessionDescription
}
@objc public var hasSessionDescription: Bool {
return proto.hasSessionDescription
}
private init(proto: SignalServiceProtos_CallMessage.Answer, private init(proto: SignalServiceProtos_CallMessage.Answer,
id: UInt64) { id: UInt64,
sessionDescription: String) {
self.proto = proto self.proto = proto
self.id = id self.id = id
self.sessionDescription = sessionDescription
}
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
} }
@objc @objc
@ -445,12 +479,18 @@ public enum SSKProtoError: Error {
} }
let id = proto.id let id = proto.id
guard proto.hasSessionDescription else {
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sessionDescription")
}
let sessionDescription = proto.sessionDescription
// MARK: - Begin Validation Logic for SSKProtoCallMessageAnswer - // MARK: - Begin Validation Logic for SSKProtoCallMessageAnswer -
// MARK: - End Validation Logic for SSKProtoCallMessageAnswer - // MARK: - End Validation Logic for SSKProtoCallMessageAnswer -
let result = SSKProtoCallMessageAnswer(proto: proto, let result = SSKProtoCallMessageAnswer(proto: proto,
id: id) id: id,
sessionDescription: sessionDescription)
return result return result
} }
} }
@ -483,6 +523,11 @@ public enum SSKProtoError: Error {
proto.sdp = valueParam proto.sdp = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoCallMessageIceUpdate? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoCallMessageIceUpdate { @objc public func build() throws -> SSKProtoCallMessageIceUpdate {
let wrapper = try SSKProtoCallMessageIceUpdate.parseProto(proto) let wrapper = try SSKProtoCallMessageIceUpdate.parseProto(proto)
return wrapper return wrapper
@ -493,37 +538,27 @@ public enum SSKProtoError: Error {
@objc public let id: UInt64 @objc public let id: UInt64
@objc public var sdpMid: String? { @objc public let sdpMid: String
guard proto.hasSdpMid else {
return nil
}
return proto.sdpMid
}
@objc public var hasSdpMid: Bool {
return proto.hasSdpMid
}
@objc public var sdpMlineIndex: UInt32 { @objc public let sdpMlineIndex: UInt32
return proto.sdpMlineIndex
}
@objc public var hasSdpMlineIndex: Bool {
return proto.hasSdpMlineIndex
}
@objc public var sdp: String? { @objc public let sdp: String
guard proto.hasSdp else {
return nil
}
return proto.sdp
}
@objc public var hasSdp: Bool {
return proto.hasSdp
}
private init(proto: SignalServiceProtos_CallMessage.IceUpdate, private init(proto: SignalServiceProtos_CallMessage.IceUpdate,
id: UInt64) { id: UInt64,
sdpMid: String,
sdpMlineIndex: UInt32,
sdp: String) {
self.proto = proto self.proto = proto
self.id = id self.id = id
self.sdpMid = sdpMid
self.sdpMlineIndex = sdpMlineIndex
self.sdp = sdp
}
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
} }
@objc @objc
@ -542,12 +577,30 @@ public enum SSKProtoError: Error {
} }
let id = proto.id let id = proto.id
guard proto.hasSdpMid else {
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sdpMid")
}
let sdpMid = proto.sdpMid
guard proto.hasSdpMlineIndex else {
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sdpMlineIndex")
}
let sdpMlineIndex = proto.sdpMlineIndex
guard proto.hasSdp else {
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sdp")
}
let sdp = proto.sdp
// MARK: - Begin Validation Logic for SSKProtoCallMessageIceUpdate - // MARK: - Begin Validation Logic for SSKProtoCallMessageIceUpdate -
// MARK: - End Validation Logic for SSKProtoCallMessageIceUpdate - // MARK: - End Validation Logic for SSKProtoCallMessageIceUpdate -
let result = SSKProtoCallMessageIceUpdate(proto: proto, let result = SSKProtoCallMessageIceUpdate(proto: proto,
id: id) id: id,
sdpMid: sdpMid,
sdpMlineIndex: sdpMlineIndex,
sdp: sdp)
return result return result
} }
} }
@ -568,6 +621,11 @@ public enum SSKProtoError: Error {
proto.id = valueParam proto.id = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoCallMessageBusy? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoCallMessageBusy { @objc public func build() throws -> SSKProtoCallMessageBusy {
let wrapper = try SSKProtoCallMessageBusy.parseProto(proto) let wrapper = try SSKProtoCallMessageBusy.parseProto(proto)
return wrapper return wrapper
@ -584,6 +642,11 @@ public enum SSKProtoError: Error {
self.id = id self.id = id
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -626,6 +689,11 @@ public enum SSKProtoError: Error {
proto.id = valueParam proto.id = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoCallMessageHangup? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoCallMessageHangup { @objc public func build() throws -> SSKProtoCallMessageHangup {
let wrapper = try SSKProtoCallMessageHangup.parseProto(proto) let wrapper = try SSKProtoCallMessageHangup.parseProto(proto)
return wrapper return wrapper
@ -642,6 +710,11 @@ public enum SSKProtoError: Error {
self.id = id self.id = id
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -714,6 +787,11 @@ public enum SSKProtoError: Error {
proto.profileKey = valueParam proto.profileKey = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoCallMessage? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoCallMessage { @objc public func build() throws -> SSKProtoCallMessage {
let wrapper = try SSKProtoCallMessage.parseProto(proto) let wrapper = try SSKProtoCallMessage.parseProto(proto)
return wrapper return wrapper
@ -768,6 +846,11 @@ public enum SSKProtoError: Error {
self.busy = busy self.busy = busy
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -865,6 +948,11 @@ public enum SSKProtoError: Error {
proto.flags = valueParam proto.flags = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageQuoteQuotedAttachment? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoDataMessageQuoteQuotedAttachment { @objc public func build() throws -> SSKProtoDataMessageQuoteQuotedAttachment {
let wrapper = try SSKProtoDataMessageQuoteQuotedAttachment.parseProto(proto) let wrapper = try SSKProtoDataMessageQuoteQuotedAttachment.parseProto(proto)
return wrapper return wrapper
@ -911,6 +999,11 @@ public enum SSKProtoError: Error {
self.thumbnail = thumbnail self.thumbnail = thumbnail
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -975,6 +1068,11 @@ public enum SSKProtoError: Error {
proto.attachments = unwrappedItems proto.attachments = unwrappedItems
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageQuote? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoDataMessageQuote { @objc public func build() throws -> SSKProtoDataMessageQuote {
let wrapper = try SSKProtoDataMessageQuote.parseProto(proto) let wrapper = try SSKProtoDataMessageQuote.parseProto(proto)
return wrapper return wrapper
@ -1009,6 +1107,11 @@ public enum SSKProtoError: Error {
self.attachments = attachments self.attachments = attachments
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -1084,6 +1187,11 @@ public enum SSKProtoError: Error {
proto.displayName = valueParam proto.displayName = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactName? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoDataMessageContactName { @objc public func build() throws -> SSKProtoDataMessageContactName {
let wrapper = try SSKProtoDataMessageContactName.parseProto(proto) let wrapper = try SSKProtoDataMessageContactName.parseProto(proto)
return wrapper return wrapper
@ -1156,6 +1264,11 @@ public enum SSKProtoError: Error {
self.proto = proto self.proto = proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -1227,6 +1340,11 @@ public enum SSKProtoError: Error {
proto.label = valueParam proto.label = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactPhone? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoDataMessageContactPhone { @objc public func build() throws -> SSKProtoDataMessageContactPhone {
let wrapper = try SSKProtoDataMessageContactPhone.parseProto(proto) let wrapper = try SSKProtoDataMessageContactPhone.parseProto(proto)
return wrapper return wrapper
@ -1266,6 +1384,11 @@ public enum SSKProtoError: Error {
self.proto = proto self.proto = proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -1337,6 +1460,11 @@ public enum SSKProtoError: Error {
proto.label = valueParam proto.label = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactEmail? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoDataMessageContactEmail { @objc public func build() throws -> SSKProtoDataMessageContactEmail {
let wrapper = try SSKProtoDataMessageContactEmail.parseProto(proto) let wrapper = try SSKProtoDataMessageContactEmail.parseProto(proto)
return wrapper return wrapper
@ -1376,6 +1504,11 @@ public enum SSKProtoError: Error {
self.proto = proto self.proto = proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -1468,6 +1601,11 @@ public enum SSKProtoError: Error {
proto.country = valueParam proto.country = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactPostalAddress? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoDataMessageContactPostalAddress { @objc public func build() throws -> SSKProtoDataMessageContactPostalAddress {
let wrapper = try SSKProtoDataMessageContactPostalAddress.parseProto(proto) let wrapper = try SSKProtoDataMessageContactPostalAddress.parseProto(proto)
return wrapper return wrapper
@ -1567,6 +1705,11 @@ public enum SSKProtoError: Error {
self.proto = proto self.proto = proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -1607,6 +1750,11 @@ public enum SSKProtoError: Error {
proto.isProfile = valueParam proto.isProfile = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContactAvatar? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoDataMessageContactAvatar { @objc public func build() throws -> SSKProtoDataMessageContactAvatar {
let wrapper = try SSKProtoDataMessageContactAvatar.parseProto(proto) let wrapper = try SSKProtoDataMessageContactAvatar.parseProto(proto)
return wrapper return wrapper
@ -1633,6 +1781,11 @@ public enum SSKProtoError: Error {
self.avatar = avatar self.avatar = avatar
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -1725,6 +1878,11 @@ public enum SSKProtoError: Error {
proto.organization = valueParam proto.organization = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoDataMessageContact? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoDataMessageContact { @objc public func build() throws -> SSKProtoDataMessageContact {
let wrapper = try SSKProtoDataMessageContact.parseProto(proto) let wrapper = try SSKProtoDataMessageContact.parseProto(proto)
return wrapper return wrapper
@ -1773,6 +1931,11 @@ public enum SSKProtoError: Error {
self.avatar = avatar self.avatar = avatar
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -1918,6 +2081,11 @@ public enum SSKProtoError: Error {
proto.contact = unwrappedItems proto.contact = unwrappedItems
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoDataMessage? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoDataMessage { @objc public func build() throws -> SSKProtoDataMessage {
let wrapper = try SSKProtoDataMessage.parseProto(proto) let wrapper = try SSKProtoDataMessage.parseProto(proto)
return wrapper return wrapper
@ -1993,6 +2161,11 @@ public enum SSKProtoError: Error {
self.contact = contact self.contact = contact
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2055,6 +2228,11 @@ public enum SSKProtoError: Error {
proto.padding = valueParam proto.padding = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoNullMessage? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoNullMessage { @objc public func build() throws -> SSKProtoNullMessage {
let wrapper = try SSKProtoNullMessage.parseProto(proto) let wrapper = try SSKProtoNullMessage.parseProto(proto)
return wrapper return wrapper
@ -2077,6 +2255,11 @@ public enum SSKProtoError: Error {
self.proto = proto self.proto = proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2148,6 +2331,11 @@ public enum SSKProtoError: Error {
proto.timestamp = unwrappedItems proto.timestamp = unwrappedItems
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoReceiptMessage? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoReceiptMessage { @objc public func build() throws -> SSKProtoReceiptMessage {
let wrapper = try SSKProtoReceiptMessage.parseProto(proto) let wrapper = try SSKProtoReceiptMessage.parseProto(proto)
return wrapper return wrapper
@ -2168,6 +2356,11 @@ public enum SSKProtoError: Error {
self.type = type self.type = type
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2246,6 +2439,11 @@ public enum SSKProtoError: Error {
proto.nullMessage = valueParam proto.nullMessage = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoVerified? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoVerified { @objc public func build() throws -> SSKProtoVerified {
let wrapper = try SSKProtoVerified.parseProto(proto) let wrapper = try SSKProtoVerified.parseProto(proto)
return wrapper return wrapper
@ -2289,6 +2487,11 @@ public enum SSKProtoError: Error {
self.destination = destination self.destination = destination
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2343,6 +2546,11 @@ public enum SSKProtoError: Error {
proto.expirationStartTimestamp = valueParam proto.expirationStartTimestamp = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageSent? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoSyncMessageSent { @objc public func build() throws -> SSKProtoSyncMessageSent {
let wrapper = try SSKProtoSyncMessageSent.parseProto(proto) let wrapper = try SSKProtoSyncMessageSent.parseProto(proto)
return wrapper return wrapper
@ -2386,6 +2594,11 @@ public enum SSKProtoError: Error {
self.message = message self.message = message
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2432,6 +2645,11 @@ public enum SSKProtoError: Error {
proto.isComplete = valueParam proto.isComplete = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageContacts? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoSyncMessageContacts { @objc public func build() throws -> SSKProtoSyncMessageContacts {
let wrapper = try SSKProtoSyncMessageContacts.parseProto(proto) let wrapper = try SSKProtoSyncMessageContacts.parseProto(proto)
return wrapper return wrapper
@ -2455,6 +2673,11 @@ public enum SSKProtoError: Error {
self.blob = blob self.blob = blob
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2497,6 +2720,11 @@ public enum SSKProtoError: Error {
proto.blob = valueParam.proto proto.blob = valueParam.proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageGroups? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoSyncMessageGroups { @objc public func build() throws -> SSKProtoSyncMessageGroups {
let wrapper = try SSKProtoSyncMessageGroups.parseProto(proto) let wrapper = try SSKProtoSyncMessageGroups.parseProto(proto)
return wrapper return wrapper
@ -2516,6 +2744,11 @@ public enum SSKProtoError: Error {
self.blob = blob self.blob = blob
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2568,6 +2801,11 @@ public enum SSKProtoError: Error {
proto.numbers = unwrappedItems proto.numbers = unwrappedItems
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageBlocked? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoSyncMessageBlocked { @objc public func build() throws -> SSKProtoSyncMessageBlocked {
let wrapper = try SSKProtoSyncMessageBlocked.parseProto(proto) let wrapper = try SSKProtoSyncMessageBlocked.parseProto(proto)
return wrapper return wrapper
@ -2584,6 +2822,11 @@ public enum SSKProtoError: Error {
self.proto = proto self.proto = proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2650,6 +2893,11 @@ public enum SSKProtoError: Error {
proto.type = SSKProtoSyncMessageRequestTypeUnwrap(valueParam) proto.type = SSKProtoSyncMessageRequestTypeUnwrap(valueParam)
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageRequest? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoSyncMessageRequest { @objc public func build() throws -> SSKProtoSyncMessageRequest {
let wrapper = try SSKProtoSyncMessageRequest.parseProto(proto) let wrapper = try SSKProtoSyncMessageRequest.parseProto(proto)
return wrapper return wrapper
@ -2666,6 +2914,11 @@ public enum SSKProtoError: Error {
self.type = type self.type = type
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2712,6 +2965,11 @@ public enum SSKProtoError: Error {
proto.timestamp = valueParam proto.timestamp = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageRead? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoSyncMessageRead { @objc public func build() throws -> SSKProtoSyncMessageRead {
let wrapper = try SSKProtoSyncMessageRead.parseProto(proto) let wrapper = try SSKProtoSyncMessageRead.parseProto(proto)
return wrapper return wrapper
@ -2732,6 +2990,11 @@ public enum SSKProtoError: Error {
self.timestamp = timestamp self.timestamp = timestamp
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2780,6 +3043,11 @@ public enum SSKProtoError: Error {
proto.readReceipts = valueParam proto.readReceipts = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessageConfiguration? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoSyncMessageConfiguration { @objc public func build() throws -> SSKProtoSyncMessageConfiguration {
let wrapper = try SSKProtoSyncMessageConfiguration.parseProto(proto) let wrapper = try SSKProtoSyncMessageConfiguration.parseProto(proto)
return wrapper return wrapper
@ -2799,6 +3067,11 @@ public enum SSKProtoError: Error {
self.proto = proto self.proto = proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -2877,6 +3150,11 @@ public enum SSKProtoError: Error {
proto.padding = valueParam proto.padding = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoSyncMessage? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoSyncMessage { @objc public func build() throws -> SSKProtoSyncMessage {
let wrapper = try SSKProtoSyncMessage.parseProto(proto) let wrapper = try SSKProtoSyncMessage.parseProto(proto)
return wrapper return wrapper
@ -2952,6 +3230,11 @@ public enum SSKProtoError: Error {
self.configuration = configuration self.configuration = configuration
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -3091,6 +3374,11 @@ public enum SSKProtoError: Error {
proto.height = valueParam proto.height = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoAttachmentPointer? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoAttachmentPointer { @objc public func build() throws -> SSKProtoAttachmentPointer {
let wrapper = try SSKProtoAttachmentPointer.parseProto(proto) let wrapper = try SSKProtoAttachmentPointer.parseProto(proto)
return wrapper return wrapper
@ -3185,6 +3473,11 @@ public enum SSKProtoError: Error {
self.id = id self.id = id
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -3283,6 +3576,11 @@ public enum SSKProtoError: Error {
proto.avatar = valueParam.proto proto.avatar = valueParam.proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoGroupContext? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoGroupContext { @objc public func build() throws -> SSKProtoGroupContext {
let wrapper = try SSKProtoGroupContext.parseProto(proto) let wrapper = try SSKProtoGroupContext.parseProto(proto)
return wrapper return wrapper
@ -3324,6 +3622,11 @@ public enum SSKProtoError: Error {
self.avatar = avatar self.avatar = avatar
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -3382,6 +3685,11 @@ public enum SSKProtoError: Error {
proto.length = valueParam proto.length = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoContactDetailsAvatar? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoContactDetailsAvatar { @objc public func build() throws -> SSKProtoContactDetailsAvatar {
let wrapper = try SSKProtoContactDetailsAvatar.parseProto(proto) let wrapper = try SSKProtoContactDetailsAvatar.parseProto(proto)
return wrapper return wrapper
@ -3411,6 +3719,11 @@ public enum SSKProtoError: Error {
self.proto = proto self.proto = proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -3475,6 +3788,11 @@ public enum SSKProtoError: Error {
proto.expireTimer = valueParam proto.expireTimer = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoContactDetails? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoContactDetails { @objc public func build() throws -> SSKProtoContactDetails {
let wrapper = try SSKProtoContactDetails.parseProto(proto) let wrapper = try SSKProtoContactDetails.parseProto(proto)
return wrapper return wrapper
@ -3549,6 +3867,11 @@ public enum SSKProtoError: Error {
self.verified = verified self.verified = verified
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -3607,6 +3930,11 @@ public enum SSKProtoError: Error {
proto.length = valueParam proto.length = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoGroupDetailsAvatar? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoGroupDetailsAvatar { @objc public func build() throws -> SSKProtoGroupDetailsAvatar {
let wrapper = try SSKProtoGroupDetailsAvatar.parseProto(proto) let wrapper = try SSKProtoGroupDetailsAvatar.parseProto(proto)
return wrapper return wrapper
@ -3636,6 +3964,11 @@ public enum SSKProtoError: Error {
self.proto = proto self.proto = proto
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()
@ -3706,6 +4039,11 @@ public enum SSKProtoError: Error {
proto.color = valueParam proto.color = valueParam
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func buildIgnoringErrors() -> SSKProtoGroupDetails? {
return try! self.build()
}
@objc public func build() throws -> SSKProtoGroupDetails { @objc public func build() throws -> SSKProtoGroupDetails {
let wrapper = try SSKProtoGroupDetails.parseProto(proto) let wrapper = try SSKProtoGroupDetails.parseProto(proto)
return wrapper return wrapper
@ -3767,6 +4105,11 @@ public enum SSKProtoError: Error {
self.avatar = avatar self.avatar = avatar
} }
// NOTE: This method is intended for debugging purposes only.
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
@objc @objc
public func serializedData() throws -> Data { public func serializedData() throws -> Data {
return try self.proto.serializedData() return try self.proto.serializedData()

@ -282,6 +282,7 @@ struct SignalServiceProtos_CallMessage {
/// Signal-iOS renamed the description field to avoid /// Signal-iOS renamed the description field to avoid
/// conflicts with [NSObject description]. /// conflicts with [NSObject description].
/// @required
var sessionDescription: String { var sessionDescription: String {
get {return _sessionDescription ?? String()} get {return _sessionDescription ?? String()}
set {_sessionDescription = newValue} set {_sessionDescription = newValue}
@ -316,6 +317,7 @@ struct SignalServiceProtos_CallMessage {
/// Signal-iOS renamed the description field to avoid /// Signal-iOS renamed the description field to avoid
/// conflicts with [NSObject description]. /// conflicts with [NSObject description].
/// @required
var sessionDescription: String { var sessionDescription: String {
get {return _sessionDescription ?? String()} get {return _sessionDescription ?? String()}
set {_sessionDescription = newValue} set {_sessionDescription = newValue}
@ -348,6 +350,7 @@ struct SignalServiceProtos_CallMessage {
/// Clears the value of `id`. Subsequent reads from it will return its default value. /// Clears the value of `id`. Subsequent reads from it will return its default value.
mutating func clearID() {self._id = nil} mutating func clearID() {self._id = nil}
/// @required
var sdpMid: String { var sdpMid: String {
get {return _sdpMid ?? String()} get {return _sdpMid ?? String()}
set {_sdpMid = newValue} set {_sdpMid = newValue}
@ -357,6 +360,7 @@ struct SignalServiceProtos_CallMessage {
/// Clears the value of `sdpMid`. Subsequent reads from it will return its default value. /// Clears the value of `sdpMid`. Subsequent reads from it will return its default value.
mutating func clearSdpMid() {self._sdpMid = nil} mutating func clearSdpMid() {self._sdpMid = nil}
/// @required
var sdpMlineIndex: UInt32 { var sdpMlineIndex: UInt32 {
get {return _sdpMlineIndex ?? 0} get {return _sdpMlineIndex ?? 0}
set {_sdpMlineIndex = newValue} set {_sdpMlineIndex = newValue}
@ -366,6 +370,7 @@ struct SignalServiceProtos_CallMessage {
/// Clears the value of `sdpMlineIndex`. Subsequent reads from it will return its default value. /// Clears the value of `sdpMlineIndex`. Subsequent reads from it will return its default value.
mutating func clearSdpMlineIndex() {self._sdpMlineIndex = nil} mutating func clearSdpMlineIndex() {self._sdpMlineIndex = nil}
/// @required
var sdp: String { var sdp: String {
get {return _sdp ?? String()} get {return _sdp ?? String()}
set {_sdp = newValue} set {_sdp = newValue}

Loading…
Cancel
Save