Don't send profile key with every sync message since we explicitly sync

upon update/create.

Following Signal-Android's lead here.

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 526d5e33b9
commit 6235e7fe5c

@ -154,11 +154,6 @@ message SyncMessage {
optional Blocked blocked = 6;
optional Verified verified = 7;
optional bytes padding = 8;
// Signal-iOS includes profileKey in *every* Sync message
// We should change this so as not to bloat our sync message size
// since sync messages are sent all the time and we only need to
// send a key once.
optional bytes profileKey = 9;
}
message AttachmentPointer {

@ -32,8 +32,6 @@ NS_ASSUME_NONNULL_BEGIN
size_t paddingBytesLength = arc4random_uniform(512) + 1;
builder.padding = [Cryptography generateRandomBytes:paddingBytesLength];
[builder addLocalProfileKey];
return [builder build];
}

@ -1007,7 +1007,6 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
#define SyncMessage_blocked @"blocked"
#define SyncMessage_verified @"verified"
#define SyncMessage_padding @"padding"
#define SyncMessage_profileKey @"profileKey"
@interface OWSSignalServiceProtosSyncMessage : PBGeneratedMessage<GeneratedMessageProtocol> {
@private
BOOL hasSent_:1;
@ -1017,7 +1016,6 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
BOOL hasBlocked_:1;
BOOL hasVerified_:1;
BOOL hasPadding_:1;
BOOL hasProfileKey_:1;
OWSSignalServiceProtosSyncMessageSent* sent;
OWSSignalServiceProtosSyncMessageContacts* contacts;
OWSSignalServiceProtosSyncMessageGroups* groups;
@ -1025,7 +1023,6 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
OWSSignalServiceProtosSyncMessageBlocked* blocked;
OWSSignalServiceProtosVerified* verified;
NSData* padding;
NSData* profileKey;
NSMutableArray * readArray;
}
- (BOOL) hasSent;
@ -1035,7 +1032,6 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
- (BOOL) hasBlocked;
- (BOOL) hasVerified;
- (BOOL) hasPadding;
- (BOOL) hasProfileKey;
@property (readonly, strong) OWSSignalServiceProtosSyncMessageSent* sent;
@property (readonly, strong) OWSSignalServiceProtosSyncMessageContacts* contacts;
@property (readonly, strong) OWSSignalServiceProtosSyncMessageGroups* groups;
@ -1044,7 +1040,6 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
@property (readonly, strong) OWSSignalServiceProtosSyncMessageBlocked* blocked;
@property (readonly, strong) OWSSignalServiceProtosVerified* verified;
@property (readonly, strong) NSData* padding;
@property (readonly, strong) NSData* profileKey;
- (OWSSignalServiceProtosSyncMessageRead*)readAtIndex:(NSUInteger)index;
+ (instancetype) defaultInstance;
@ -1490,11 +1485,6 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
- (NSData*) padding;
- (OWSSignalServiceProtosSyncMessageBuilder*) setPadding:(NSData*) value;
- (OWSSignalServiceProtosSyncMessageBuilder*) clearPadding;
- (BOOL) hasProfileKey;
- (NSData*) profileKey;
- (OWSSignalServiceProtosSyncMessageBuilder*) setProfileKey:(NSData*) value;
- (OWSSignalServiceProtosSyncMessageBuilder*) clearProfileKey;
@end
#define AttachmentPointer_id @"id"

@ -3947,7 +3947,6 @@ NSString *NSStringFromOWSSignalServiceProtosVerifiedState(OWSSignalServiceProtos
@property (strong) OWSSignalServiceProtosSyncMessageBlocked* blocked;
@property (strong) OWSSignalServiceProtosVerified* verified;
@property (strong) NSData* padding;
@property (strong) NSData* profileKey;
@end
@implementation OWSSignalServiceProtosSyncMessage
@ -4003,13 +4002,6 @@ NSString *NSStringFromOWSSignalServiceProtosVerifiedState(OWSSignalServiceProtos
hasPadding_ = !!_value_;
}
@synthesize padding;
- (BOOL) hasProfileKey {
return !!hasProfileKey_;
}
- (void) setHasProfileKey:(BOOL) _value_ {
hasProfileKey_ = !!_value_;
}
@synthesize profileKey;
- (instancetype) init {
if ((self = [super init])) {
self.sent = [OWSSignalServiceProtosSyncMessageSent defaultInstance];
@ -4019,7 +4011,6 @@ NSString *NSStringFromOWSSignalServiceProtosVerifiedState(OWSSignalServiceProtos
self.blocked = [OWSSignalServiceProtosSyncMessageBlocked defaultInstance];
self.verified = [OWSSignalServiceProtosVerified defaultInstance];
self.padding = [NSData data];
self.profileKey = [NSData data];
}
return self;
}
@ -4069,9 +4060,6 @@ static OWSSignalServiceProtosSyncMessage* defaultOWSSignalServiceProtosSyncMessa
if (self.hasPadding) {
[output writeData:8 value:self.padding];
}
if (self.hasProfileKey) {
[output writeData:9 value:self.profileKey];
}
[self.unknownFields writeToCodedOutputStream:output];
}
- (SInt32) serializedSize {
@ -4105,9 +4093,6 @@ static OWSSignalServiceProtosSyncMessage* defaultOWSSignalServiceProtosSyncMessa
if (self.hasPadding) {
size_ += computeDataSize(8, self.padding);
}
if (self.hasProfileKey) {
size_ += computeDataSize(9, self.profileKey);
}
size_ += self.unknownFields.serializedSize;
memoizedSerializedSize = size_;
return size_;
@ -4188,9 +4173,6 @@ static OWSSignalServiceProtosSyncMessage* defaultOWSSignalServiceProtosSyncMessa
if (self.hasPadding) {
[output appendFormat:@"%@%@: %@\n", indent, @"padding", self.padding];
}
if (self.hasProfileKey) {
[output appendFormat:@"%@%@: %@\n", indent, @"profileKey", self.profileKey];
}
[self.unknownFields writeDescriptionTo:output withIndent:indent];
}
- (void) storeInDictionary:(NSMutableDictionary *)dictionary {
@ -4232,9 +4214,6 @@ static OWSSignalServiceProtosSyncMessage* defaultOWSSignalServiceProtosSyncMessa
if (self.hasPadding) {
[dictionary setObject: self.padding forKey: @"padding"];
}
if (self.hasProfileKey) {
[dictionary setObject: self.profileKey forKey: @"profileKey"];
}
[self.unknownFields storeInDictionary:dictionary];
}
- (BOOL) isEqual:(id)other {
@ -4261,8 +4240,6 @@ static OWSSignalServiceProtosSyncMessage* defaultOWSSignalServiceProtosSyncMessa
(!self.hasVerified || [self.verified isEqual:otherMessage.verified]) &&
self.hasPadding == otherMessage.hasPadding &&
(!self.hasPadding || [self.padding isEqual:otherMessage.padding]) &&
self.hasProfileKey == otherMessage.hasProfileKey &&
(!self.hasProfileKey || [self.profileKey isEqual:otherMessage.profileKey]) &&
(self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
}
- (NSUInteger) hash {
@ -4291,9 +4268,6 @@ static OWSSignalServiceProtosSyncMessage* defaultOWSSignalServiceProtosSyncMessa
if (self.hasPadding) {
hashCode = hashCode * 31 + [self.padding hash];
}
if (self.hasProfileKey) {
hashCode = hashCode * 31 + [self.profileKey hash];
}
hashCode = hashCode * 31 + [self.unknownFields hash];
return hashCode;
}
@ -5966,9 +5940,6 @@ static OWSSignalServiceProtosSyncMessageRead* defaultOWSSignalServiceProtosSyncM
if (other.hasPadding) {
[self setPadding:other.padding];
}
if (other.hasProfileKey) {
[self setProfileKey:other.profileKey];
}
[self mergeUnknownFields:other.unknownFields];
return self;
}
@ -6054,10 +6025,6 @@ static OWSSignalServiceProtosSyncMessageRead* defaultOWSSignalServiceProtosSyncM
[self setPadding:[input readData]];
break;
}
case 74: {
[self setProfileKey:[input readData]];
break;
}
}
}
}
@ -6278,22 +6245,6 @@ static OWSSignalServiceProtosSyncMessageRead* defaultOWSSignalServiceProtosSyncM
resultSyncMessage.padding = [NSData data];
return self;
}
- (BOOL) hasProfileKey {
return resultSyncMessage.hasProfileKey;
}
- (NSData*) profileKey {
return resultSyncMessage.profileKey;
}
- (OWSSignalServiceProtosSyncMessageBuilder*) setProfileKey:(NSData*) value {
resultSyncMessage.hasProfileKey = YES;
resultSyncMessage.profileKey = value;
return self;
}
- (OWSSignalServiceProtosSyncMessageBuilder*) clearProfileKey {
resultSyncMessage.hasProfileKey = NO;
resultSyncMessage.profileKey = [NSData data];
return self;
}
@end
@interface OWSSignalServiceProtosAttachmentPointer ()

@ -28,12 +28,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
#pragma mark -
@interface OWSSignalServiceProtosSyncMessageBuilder (OWS)
- (void)addLocalProfileKey;
@end
NS_ASSUME_NONNULL_END

@ -90,15 +90,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
#pragma mark -
@implementation OWSSignalServiceProtosSyncMessageBuilder (OWS)
- (void)addLocalProfileKey
{
[self setProfileKey:self.localProfileKey.keyData];
}
@end
NS_ASSUME_NONNULL_END

Loading…
Cancel
Save