From 304c89a56d2ae07d14cf1dde3c05b20a2c73fbe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 29 Jun 2021 10:03:53 +0200 Subject: [PATCH] crypto: Dispatch updates when we receive MAC events --- .../crypto/verification/RustVerificationService.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/RustVerificationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/RustVerificationService.kt index b39022589c..c3ff64d01d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/RustVerificationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/RustVerificationService.kt @@ -36,6 +36,7 @@ import org.matrix.android.sdk.internal.crypto.VerificationRequest import org.matrix.android.sdk.internal.crypto.model.rest.KeyVerificationCancel import org.matrix.android.sdk.internal.crypto.model.rest.KeyVerificationDone import org.matrix.android.sdk.internal.crypto.model.rest.KeyVerificationKey +import org.matrix.android.sdk.internal.crypto.model.rest.KeyVerificationMac import org.matrix.android.sdk.internal.crypto.model.rest.KeyVerificationRequest import org.matrix.android.sdk.internal.crypto.model.rest.KeyVerificationStart import org.matrix.android.sdk.internal.session.SessionScope @@ -114,7 +115,7 @@ constructor( EventType.KEY_VERIFICATION_CANCEL -> onCancel(event) EventType.KEY_VERIFICATION_ACCEPT -> {} EventType.KEY_VERIFICATION_KEY -> onKey(event) - EventType.KEY_VERIFICATION_MAC -> {} + EventType.KEY_VERIFICATION_MAC -> onMac(event) EventType.KEY_VERIFICATION_READY -> {} EventType.KEY_VERIFICATION_DONE -> onDone(event) MessageType.MSGTYPE_VERIFICATION_REQUEST -> onRequest(event) @@ -182,6 +183,14 @@ constructor( getAndDispatch(sender, flowId) } + private fun onMac(event: Event) { + val content = event.getClearContent().toModel() ?: return + val flowId = content.transactionId ?: return + val sender = event.senderId ?: return + + getAndDispatch(sender, flowId) + } + private fun onRequest(event: Event) { val content = event.getClearContent().toModel() ?: return val flowId = content.transactionId