diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index a5067d467..142ba0cad 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -1902,7 +1902,7 @@ typedef enum : NSUInteger { // as-of-yet-undecrypted messages if ([errorMessage isKindOfClass:[TSInvalidIdentityKeyReceivingErrorMessage class]]) { // 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]; } }]; diff --git a/SignalServiceKit/src/Account/TSAccountManager.m b/SignalServiceKit/src/Account/TSAccountManager.m index c1c8dcb40..01b124339 100644 --- a/SignalServiceKit/src/Account/TSAccountManager.m +++ b/SignalServiceKit/src/Account/TSAccountManager.m @@ -159,7 +159,7 @@ NSString *const TSAccountManager_NeedsAccountAttributesUpdateKey = @"TSAccountMa NSString *phoneNumber = self.phoneNumberAwaitingVerification; if (!phoneNumber) { - OWSFail(@"phonNumber was unexpectedly nil"); + OWSFail(@"phoneNumber was unexpectedly nil"); } [self storeLocalNumber:phoneNumber]; diff --git a/SignalServiceKit/src/Messages/OWSMessageSender.m b/SignalServiceKit/src/Messages/OWSMessageSender.m index ed0cd9095..87b625094 100644 --- a/SignalServiceKit/src/Messages/OWSMessageSender.m +++ b/SignalServiceKit/src/Messages/OWSMessageSender.m @@ -1609,7 +1609,6 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException"; }) retainUntilComplete]; } -// NOTE: This method uses exceptions for control flow. - (NSDictionary *)throws_encryptedMessageForMessageSend:(OWSMessageSend *)messageSend deviceId:(NSNumber *)deviceId plainText:(NSData *)plainText diff --git a/SignalServiceKit/src/Storage/AxolotlStore/OWSPrimaryStorage+SignedPreKeyStore.m b/SignalServiceKit/src/Storage/AxolotlStore/OWSPrimaryStorage+SignedPreKeyStore.m index 3c2f9318c..bc9be2751 100644 --- a/SignalServiceKit/src/Storage/AxolotlStore/OWSPrimaryStorage+SignedPreKeyStore.m +++ b/SignalServiceKit/src/Storage/AxolotlStore/OWSPrimaryStorage+SignedPreKeyStore.m @@ -30,14 +30,15 @@ NSString *const OWSPrimaryStorageKeyPrekeyCurrentSignedPrekeyId = @"currentSigne int preKeyId = 1 + arc4random_uniform(INT32_MAX - 1); ECKeyPair *_Nullable identityKeyPair = [[OWSIdentityManager sharedManager] identityKeyPair]; OWSAssert(identityKeyPair); + @try { - return [[SignedPreKeyRecord alloc] - initWithId:preKeyId - keyPair:keyPair - signature:[Ed25519 throws_sign:keyPair.publicKey.prependKeyType withKeyPair:identityKeyPair] - generatedAt:[NSDate date]]; + NSData *signature = [Ed25519 throws_sign:keyPair.publicKey.prependKeyType withKeyPair:identityKeyPair]; + return [[SignedPreKeyRecord alloc] initWithId:preKeyId + keyPair:keyPair + signature:signature + generatedAt:[NSDate date]]; } @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. OWSFail(@"exception: %@", exception); return nil;