From 016f9ff3004ccf807d6fae511141689c3fc62c19 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 31 Mar 2023 15:54:45 +0530 Subject: [PATCH] Send done before waiting for message --- src/matrix/verification/SAS/stages/SendDoneStage.ts | 3 ++- src/matrix/verification/SAS/stages/VerifyMacStage.ts | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/matrix/verification/SAS/stages/SendDoneStage.ts b/src/matrix/verification/SAS/stages/SendDoneStage.ts index 95167e24..dcdeba3a 100644 --- a/src/matrix/verification/SAS/stages/SendDoneStage.ts +++ b/src/matrix/verification/SAS/stages/SendDoneStage.ts @@ -19,8 +19,9 @@ import {VerificationEventType} from "../channel/types"; export class SendDoneStage extends BaseSASVerificationStage { async completeStage() { await this.log.wrap("SendDoneStage.completeStage", async (log) => { - this.eventEmitter.emit("VerificationCompleted", this.otherUserDeviceId); await this.channel.send(VerificationEventType.Done, {}, log); + await this.channel.waitForEvent(VerificationEventType.Done); + this.eventEmitter.emit("VerificationCompleted", this.otherUserDeviceId); }); } } diff --git a/src/matrix/verification/SAS/stages/VerifyMacStage.ts b/src/matrix/verification/SAS/stages/VerifyMacStage.ts index 7fa66cc5..a1ef5515 100644 --- a/src/matrix/verification/SAS/stages/VerifyMacStage.ts +++ b/src/matrix/verification/SAS/stages/VerifyMacStage.ts @@ -30,7 +30,6 @@ export class VerifyMacStage extends BaseSASVerificationStage { const macMethod = acceptMessage.message_authentication_code; const calculateMAC = createCalculateMAC(this.olmSAS, macMethod); await this.checkMAC(calculateMAC, log); - await this.channel.waitForEvent(VerificationEventType.Done); this.setNextStage(new SendDoneStage(this.options)); }); }