Activate the Session protocol

This commit is contained in:
Niels Andriesse 2021-01-04 10:53:08 +11:00
parent 4cd9e979bc
commit ef1d6392a7
2 changed files with 4 additions and 14 deletions

View File

@ -66,19 +66,9 @@ public enum MessageReceiver {
} else {
switch envelope.type {
case .unidentifiedSender:
do {
(plaintext, sender) = try decryptWithSessionProtocol(envelope: envelope)
} catch {
// Migration
(plaintext, sender) = try decryptWithSignalProtocol(envelope: envelope, using: transaction)
}
(plaintext, sender) = try decryptWithSessionProtocol(envelope: envelope)
case .closedGroupCiphertext:
do {
(plaintext, sender) = try decryptWithSessionProtocol(envelope: envelope)
} catch {
// Migration
(plaintext, sender) = try decryptWithSharedSenderKeys(envelope: envelope, using: transaction)
}
(plaintext, sender) = try decryptWithSessionProtocol(envelope: envelope)
groupPublicKey = envelope.source
default: throw Error.unknownEnvelopeType
}

View File

@ -174,8 +174,8 @@ public final class MessageSender : NSObject {
let ciphertext: Data
do {
switch destination {
case .contact(let publicKey): ciphertext = try encryptWithSignalProtocol(plaintext, associatedWith: message, for: publicKey, using: transaction)
case .closedGroup(let groupPublicKey): ciphertext = try encryptWithSharedSenderKeys(plaintext, for: groupPublicKey, using: transaction)
case .contact(let publicKey): ciphertext = try encryptWithSessionProtocol(plaintext, for: publicKey)
case .closedGroup(let groupPublicKey): ciphertext = try encryptWithSessionProtocol(plaintext, for: groupPublicKey)
case .openGroup(_, _): preconditionFailure()
}
} catch {