From ae58d0c8eb1b34bf0d8a9d3019da049650034fe2 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Mon, 1 Jul 2024 12:32:09 +0100 Subject: [PATCH] Rust crypto: Clean up handling of verification events (#4288) We had both an `onIncomingKeyVerificationRequest` and an `onKeyVerificationRequest` which did different, but related, things. Improve the documentation and reduce the duplication. --- src/rust-crypto/rust-crypto.ts | 55 +++++++++++++--------------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/src/rust-crypto/rust-crypto.ts b/src/rust-crypto/rust-crypto.ts index c5e9bd904..95d7c2495 100644 --- a/src/rust-crypto/rust-crypto.ts +++ b/src/rust-crypto/rust-crypto.ts @@ -21,7 +21,7 @@ import type { IEventDecryptionResult, IMegolmSessionData } from "../@types/crypt import { KnownMembership } from "../@types/membership"; import type { IDeviceLists, IToDeviceEvent } from "../sync-accumulator"; import type { IEncryptedEventInfo } from "../crypto/api"; -import { IContent, MatrixEvent, MatrixEventEvent } from "../models/event"; +import { MatrixEvent, MatrixEventEvent } from "../models/event"; import { Room } from "../models/room"; import { RoomMember } from "../models/room-member"; import { BackupDecryptor, CryptoBackend, DecryptionError, OnSyncCompletedData } from "../common-crypto/CryptoBackend"; @@ -1315,7 +1315,11 @@ export class RustCrypto extends TypedEventEmitter => { // Process only verification event if (isVerificationEvent(event)) { - await this.onKeyVerificationRequest(evt); + await this.onKeyVerificationEvent(evt); } }; @@ -1624,11 +1629,11 @@ export class RustCrypto extends TypedEventEmitter { + private async onKeyVerificationEvent(event: MatrixEvent): Promise { const roomId = event.getRoomId(); if (!roomId) { @@ -1655,27 +1660,7 @@ export class RustCrypto extends TypedEventEmitter