Activate the Session protocol

pull/325/head
Niels Andriesse 4 years ago
parent 4cd9e979bc
commit ef1d6392a7

@ -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
}

@ -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 {

Loading…
Cancel
Save