|
|
|
@ -23,13 +23,20 @@ class LokiServiceCipher(
|
|
|
|
|
|
|
|
|
|
override fun decrypt(envelope: SignalServiceEnvelope, ciphertext: ByteArray): Plaintext {
|
|
|
|
|
// return if (envelope.isFallbackMessage) decryptFallbackMessage(envelope, ciphertext) else super.decrypt(envelope, ciphertext)
|
|
|
|
|
// return decryptFallbackMessage(envelope, ciphertext);
|
|
|
|
|
|
|
|
|
|
//AC: Messages come unencrypted (for refactoring time being).
|
|
|
|
|
val transportDetails = PushTransportDetails(FallbackSessionCipher.sessionVersion)
|
|
|
|
|
val unpaddedMessageBody = transportDetails.getStrippedPaddingMessageBody(ciphertext)
|
|
|
|
|
val metadata = Metadata(envelope.source, envelope.sourceDevice, envelope.timestamp, false)
|
|
|
|
|
return Plaintext(metadata, unpaddedMessageBody)
|
|
|
|
|
return when {
|
|
|
|
|
envelope.isUnidentifiedSender -> {
|
|
|
|
|
//AC: Messages come unencrypted (for refactoring time being).
|
|
|
|
|
val transportDetails = PushTransportDetails(FallbackSessionCipher.sessionVersion)
|
|
|
|
|
val unpaddedMessageBody = transportDetails.getStrippedPaddingMessageBody(ciphertext)
|
|
|
|
|
val metadata = Metadata(envelope.source, envelope.sourceDevice, envelope.timestamp, false)
|
|
|
|
|
return Plaintext(metadata, unpaddedMessageBody)
|
|
|
|
|
}
|
|
|
|
|
envelope.isFallbackMessage ->
|
|
|
|
|
decryptFallbackMessage(envelope, ciphertext)
|
|
|
|
|
else ->
|
|
|
|
|
super.decrypt(envelope, ciphertext)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun decryptFallbackMessage(envelope: SignalServiceEnvelope, ciphertext: ByteArray): Plaintext {
|
|
|
|
|