Improve encryption check condition
This commit is contained in:
parent
891897f0a7
commit
245ca13049
|
@ -94,8 +94,10 @@ internal class EventDecryptor @Inject constructor(
|
|||
* @param timeline the id of the timeline where the event is decrypted. It is used to prevent replay attack.
|
||||
*/
|
||||
suspend fun decryptEventAndSaveResult(event: Event, timeline: String) {
|
||||
if (event.type == EventType.ENCRYPTED && event.mxDecryptionResult != null) return
|
||||
tryOrNull(message = "Unable to decrypt the event") {
|
||||
// event is not encrypted or already decrypted
|
||||
if (event.getClearType() != EventType.ENCRYPTED) return
|
||||
|
||||
tryOrNull(message = "decryptEventAndSaveResult | Unable to decrypt the event") {
|
||||
decryptEvent(event, timeline)
|
||||
}
|
||||
?.let { result ->
|
||||
|
|
Loading…
Reference in New Issue