CR: comments and code clarity

pull/1/head
Michael Kirk 7 years ago
parent 3bef78335d
commit 3d9cd4f4ed

@ -1902,7 +1902,7 @@ typedef enum : NSUInteger {
// as-of-yet-undecrypted messages // as-of-yet-undecrypted messages
if ([errorMessage isKindOfClass:[TSInvalidIdentityKeyReceivingErrorMessage class]]) { if ([errorMessage isKindOfClass:[TSInvalidIdentityKeyReceivingErrorMessage class]]) {
// Deliberately crash if the user fails to explicitly accept the new identity // Deliberately crash if the user fails to explicitly accept the new identity
// key. In practice we haven't been creating these messags in over a year. // key. In practice we haven't been creating these messages in over a year.
[errorMessage throws_acceptNewIdentityKey]; [errorMessage throws_acceptNewIdentityKey];
} }
}]; }];

@ -159,7 +159,7 @@ NSString *const TSAccountManager_NeedsAccountAttributesUpdateKey = @"TSAccountMa
NSString *phoneNumber = self.phoneNumberAwaitingVerification; NSString *phoneNumber = self.phoneNumberAwaitingVerification;
if (!phoneNumber) { if (!phoneNumber) {
OWSFail(@"phonNumber was unexpectedly nil"); OWSFail(@"phoneNumber was unexpectedly nil");
} }
[self storeLocalNumber:phoneNumber]; [self storeLocalNumber:phoneNumber];

@ -1609,7 +1609,6 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
}) retainUntilComplete]; }) retainUntilComplete];
} }
// NOTE: This method uses exceptions for control flow.
- (NSDictionary *)throws_encryptedMessageForMessageSend:(OWSMessageSend *)messageSend - (NSDictionary *)throws_encryptedMessageForMessageSend:(OWSMessageSend *)messageSend
deviceId:(NSNumber *)deviceId deviceId:(NSNumber *)deviceId
plainText:(NSData *)plainText plainText:(NSData *)plainText

@ -30,14 +30,15 @@ NSString *const OWSPrimaryStorageKeyPrekeyCurrentSignedPrekeyId = @"currentSigne
int preKeyId = 1 + arc4random_uniform(INT32_MAX - 1); int preKeyId = 1 + arc4random_uniform(INT32_MAX - 1);
ECKeyPair *_Nullable identityKeyPair = [[OWSIdentityManager sharedManager] identityKeyPair]; ECKeyPair *_Nullable identityKeyPair = [[OWSIdentityManager sharedManager] identityKeyPair];
OWSAssert(identityKeyPair); OWSAssert(identityKeyPair);
@try { @try {
return [[SignedPreKeyRecord alloc] NSData *signature = [Ed25519 throws_sign:keyPair.publicKey.prependKeyType withKeyPair:identityKeyPair];
initWithId:preKeyId return [[SignedPreKeyRecord alloc] initWithId:preKeyId
keyPair:keyPair keyPair:keyPair
signature:[Ed25519 throws_sign:keyPair.publicKey.prependKeyType withKeyPair:identityKeyPair] signature:signature
generatedAt:[NSDate date]]; generatedAt:[NSDate date]];
} @catch (NSException *exception) { } @catch (NSException *exception) {
// throws_sign only throws when the data to sign is empty or `keyPair`. // throws_sign only throws when the data to sign is empty or `keyPair` is nil.
// Neither of which should happen. // Neither of which should happen.
OWSFail(@"exception: %@", exception); OWSFail(@"exception: %@", exception);
return nil; return nil;

Loading…
Cancel
Save