mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Exception wrap PreKeyWhisperMessage for Swift
This commit is contained in:
parent
60769a3d17
commit
1482c600b4
2 changed files with 8 additions and 8 deletions
|
@ -112,7 +112,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
}
|
||||
|
||||
- (nullable NSData *)newIdentityKey
|
||||
- (nullable NSData *)try_newIdentityKey
|
||||
{
|
||||
if (!self.envelope) {
|
||||
OWSLogError(@"Error message had no envelope data to extract key from");
|
||||
|
@ -130,7 +130,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return nil;
|
||||
}
|
||||
|
||||
PreKeyWhisperMessage *message = [[PreKeyWhisperMessage alloc] initWithData:pkwmData];
|
||||
PreKeyWhisperMessage *message = [[PreKeyWhisperMessage alloc] init_try_withData:pkwmData];
|
||||
return [message.identityKey removeKeyType];
|
||||
}
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
return;
|
||||
}
|
||||
case SSKProtoEnvelopeTypePrekeyBundle: {
|
||||
[self decryptPreKeyBundle:envelope
|
||||
[self try_decryptPreKeyBundle:envelope
|
||||
envelopeData:envelopeData
|
||||
successBlock:^(OWSMessageDecryptResult *result, YapDatabaseReadWriteTransaction *transaction) {
|
||||
OWSLogDebug(@"decrypted pre-key whisper message");
|
||||
|
@ -318,10 +318,10 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
failureBlock:failureBlock];
|
||||
}
|
||||
|
||||
- (void)decryptPreKeyBundle:(SSKProtoEnvelope *)envelope
|
||||
envelopeData:(NSData *)envelopeData
|
||||
successBlock:(DecryptSuccessBlock)successBlock
|
||||
failureBlock:(void (^)(NSError *_Nullable error))failureBlock
|
||||
- (void)try_decryptPreKeyBundle:(SSKProtoEnvelope *)envelope
|
||||
envelopeData:(NSData *)envelopeData
|
||||
successBlock:(DecryptSuccessBlock)successBlock
|
||||
failureBlock:(void (^)(NSError *_Nullable error))failureBlock
|
||||
{
|
||||
OWSAssertDebug(envelope);
|
||||
OWSAssertDebug(envelopeData);
|
||||
|
@ -335,7 +335,7 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
envelopeData:envelopeData
|
||||
cipherTypeName:@"PreKey Bundle"
|
||||
cipherMessageBlock:^(NSData *encryptedData) {
|
||||
return [[PreKeyWhisperMessage alloc] initWithData:encryptedData];
|
||||
return [[PreKeyWhisperMessage alloc] init_try_withData:encryptedData];
|
||||
}
|
||||
successBlock:successBlock
|
||||
failureBlock:failureBlock];
|
||||
|
|
Loading…
Reference in a new issue