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.
|
* @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) {
|
suspend fun decryptEventAndSaveResult(event: Event, timeline: String) {
|
||||||
if (event.type == EventType.ENCRYPTED && event.mxDecryptionResult != null) return
|
// event is not encrypted or already decrypted
|
||||||
tryOrNull(message = "Unable to decrypt the event") {
|
if (event.getClearType() != EventType.ENCRYPTED) return
|
||||||
|
|
||||||
|
tryOrNull(message = "decryptEventAndSaveResult | Unable to decrypt the event") {
|
||||||
decryptEvent(event, timeline)
|
decryptEvent(event, timeline)
|
||||||
}
|
}
|
||||||
?.let { result ->
|
?.let { result ->
|
||||||
|
|
Loading…
Reference in New Issue