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
|
@ -112,7 +112,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable NSData *)newIdentityKey
|
- (nullable NSData *)try_newIdentityKey
|
||||||
{
|
{
|
||||||
if (!self.envelope) {
|
if (!self.envelope) {
|
||||||
OWSLogError(@"Error message had no envelope data to extract key from");
|
OWSLogError(@"Error message had no envelope data to extract key from");
|
||||||
|
@ -130,7 +130,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
PreKeyWhisperMessage *message = [[PreKeyWhisperMessage alloc] initWithData:pkwmData];
|
PreKeyWhisperMessage *message = [[PreKeyWhisperMessage alloc] init_try_withData:pkwmData];
|
||||||
return [message.identityKey removeKeyType];
|
return [message.identityKey removeKeyType];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case SSKProtoEnvelopeTypePrekeyBundle: {
|
case SSKProtoEnvelopeTypePrekeyBundle: {
|
||||||
[self decryptPreKeyBundle:envelope
|
[self try_decryptPreKeyBundle:envelope
|
||||||
envelopeData:envelopeData
|
envelopeData:envelopeData
|
||||||
successBlock:^(OWSMessageDecryptResult *result, YapDatabaseReadWriteTransaction *transaction) {
|
successBlock:^(OWSMessageDecryptResult *result, YapDatabaseReadWriteTransaction *transaction) {
|
||||||
OWSLogDebug(@"decrypted pre-key whisper message");
|
OWSLogDebug(@"decrypted pre-key whisper message");
|
||||||
|
@ -318,10 +318,10 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
||||||
failureBlock:failureBlock];
|
failureBlock:failureBlock];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)decryptPreKeyBundle:(SSKProtoEnvelope *)envelope
|
- (void)try_decryptPreKeyBundle:(SSKProtoEnvelope *)envelope
|
||||||
envelopeData:(NSData *)envelopeData
|
envelopeData:(NSData *)envelopeData
|
||||||
successBlock:(DecryptSuccessBlock)successBlock
|
successBlock:(DecryptSuccessBlock)successBlock
|
||||||
failureBlock:(void (^)(NSError *_Nullable error))failureBlock
|
failureBlock:(void (^)(NSError *_Nullable error))failureBlock
|
||||||
{
|
{
|
||||||
OWSAssertDebug(envelope);
|
OWSAssertDebug(envelope);
|
||||||
OWSAssertDebug(envelopeData);
|
OWSAssertDebug(envelopeData);
|
||||||
|
@ -335,7 +335,7 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
||||||
envelopeData:envelopeData
|
envelopeData:envelopeData
|
||||||
cipherTypeName:@"PreKey Bundle"
|
cipherTypeName:@"PreKey Bundle"
|
||||||
cipherMessageBlock:^(NSData *encryptedData) {
|
cipherMessageBlock:^(NSData *encryptedData) {
|
||||||
return [[PreKeyWhisperMessage alloc] initWithData:encryptedData];
|
return [[PreKeyWhisperMessage alloc] init_try_withData:encryptedData];
|
||||||
}
|
}
|
||||||
successBlock:successBlock
|
successBlock:successBlock
|
||||||
failureBlock:failureBlock];
|
failureBlock:failureBlock];
|
||||||
|
|
Loading…
Reference in a new issue