mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-30 15:50:53 +08:00
crypto: Dispatch updates when we receive MAC events
This commit is contained in:
parent
53b3f54808
commit
304c89a56d
@ -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<KeyVerificationMac>() ?: return
|
||||
val flowId = content.transactionId ?: return
|
||||
val sender = event.senderId ?: return
|
||||
|
||||
getAndDispatch(sender, flowId)
|
||||
}
|
||||
|
||||
private fun onRequest(event: Event) {
|
||||
val content = event.getClearContent().toModel<KeyVerificationRequest>() ?: return
|
||||
val flowId = content.transactionId
|
||||
|
Loading…
Reference in New Issue
Block a user