Activate the Session protocol
This commit is contained in:
parent
4cd9e979bc
commit
ef1d6392a7
|
@ -66,19 +66,9 @@ public enum MessageReceiver {
|
||||||
} else {
|
} else {
|
||||||
switch envelope.type {
|
switch envelope.type {
|
||||||
case .unidentifiedSender:
|
case .unidentifiedSender:
|
||||||
do {
|
(plaintext, sender) = try decryptWithSessionProtocol(envelope: envelope)
|
||||||
(plaintext, sender) = try decryptWithSessionProtocol(envelope: envelope)
|
|
||||||
} catch {
|
|
||||||
// Migration
|
|
||||||
(plaintext, sender) = try decryptWithSignalProtocol(envelope: envelope, using: transaction)
|
|
||||||
}
|
|
||||||
case .closedGroupCiphertext:
|
case .closedGroupCiphertext:
|
||||||
do {
|
(plaintext, sender) = try decryptWithSessionProtocol(envelope: envelope)
|
||||||
(plaintext, sender) = try decryptWithSessionProtocol(envelope: envelope)
|
|
||||||
} catch {
|
|
||||||
// Migration
|
|
||||||
(plaintext, sender) = try decryptWithSharedSenderKeys(envelope: envelope, using: transaction)
|
|
||||||
}
|
|
||||||
groupPublicKey = envelope.source
|
groupPublicKey = envelope.source
|
||||||
default: throw Error.unknownEnvelopeType
|
default: throw Error.unknownEnvelopeType
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,8 +174,8 @@ public final class MessageSender : NSObject {
|
||||||
let ciphertext: Data
|
let ciphertext: Data
|
||||||
do {
|
do {
|
||||||
switch destination {
|
switch destination {
|
||||||
case .contact(let publicKey): ciphertext = try encryptWithSignalProtocol(plaintext, associatedWith: message, for: publicKey, using: transaction)
|
case .contact(let publicKey): ciphertext = try encryptWithSessionProtocol(plaintext, for: publicKey)
|
||||||
case .closedGroup(let groupPublicKey): ciphertext = try encryptWithSharedSenderKeys(plaintext, for: groupPublicKey, using: transaction)
|
case .closedGroup(let groupPublicKey): ciphertext = try encryptWithSessionProtocol(plaintext, for: groupPublicKey)
|
||||||
case .openGroup(_, _): preconditionFailure()
|
case .openGroup(_, _): preconditionFailure()
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|
Loading…
Reference in New Issue