mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-29 12:28:36 +03:00
crypto: Dispatch updates when we receive MAC events
This commit is contained in:
parent
53b3f54808
commit
304c89a56d
1 changed files with 10 additions and 1 deletions
|
@ -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.KeyVerificationCancel
|
||||||
import org.matrix.android.sdk.internal.crypto.model.rest.KeyVerificationDone
|
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.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.KeyVerificationRequest
|
||||||
import org.matrix.android.sdk.internal.crypto.model.rest.KeyVerificationStart
|
import org.matrix.android.sdk.internal.crypto.model.rest.KeyVerificationStart
|
||||||
import org.matrix.android.sdk.internal.session.SessionScope
|
import org.matrix.android.sdk.internal.session.SessionScope
|
||||||
|
@ -114,7 +115,7 @@ constructor(
|
||||||
EventType.KEY_VERIFICATION_CANCEL -> onCancel(event)
|
EventType.KEY_VERIFICATION_CANCEL -> onCancel(event)
|
||||||
EventType.KEY_VERIFICATION_ACCEPT -> {}
|
EventType.KEY_VERIFICATION_ACCEPT -> {}
|
||||||
EventType.KEY_VERIFICATION_KEY -> onKey(event)
|
EventType.KEY_VERIFICATION_KEY -> onKey(event)
|
||||||
EventType.KEY_VERIFICATION_MAC -> {}
|
EventType.KEY_VERIFICATION_MAC -> onMac(event)
|
||||||
EventType.KEY_VERIFICATION_READY -> {}
|
EventType.KEY_VERIFICATION_READY -> {}
|
||||||
EventType.KEY_VERIFICATION_DONE -> onDone(event)
|
EventType.KEY_VERIFICATION_DONE -> onDone(event)
|
||||||
MessageType.MSGTYPE_VERIFICATION_REQUEST -> onRequest(event)
|
MessageType.MSGTYPE_VERIFICATION_REQUEST -> onRequest(event)
|
||||||
|
@ -182,6 +183,14 @@ constructor(
|
||||||
getAndDispatch(sender, flowId)
|
getAndDispatch(sender, flowId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun onMac(event: Event) {
|
||||||
|
val content = event.getClearContent().toModel<KeyVerificationMac>() ?: return
|
||||||
|
val flowId = content.transactionId ?: return
|
||||||
|
val sender = event.senderId ?: return
|
||||||
|
|
||||||
|
getAndDispatch(sender, flowId)
|
||||||
|
}
|
||||||
|
|
||||||
private fun onRequest(event: Event) {
|
private fun onRequest(event: Event) {
|
||||||
val content = event.getClearContent().toModel<KeyVerificationRequest>() ?: return
|
val content = event.getClearContent().toModel<KeyVerificationRequest>() ?: return
|
||||||
val flowId = content.transactionId
|
val flowId = content.transactionId
|
||||||
|
|
Loading…
Reference in a new issue