From f56cfba906a0486a1a14e38b975816436d634f70 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 9 Jun 2023 16:06:31 +0530 Subject: [PATCH] Sign the actual device/user --- .../verification/DeviceVerificationViewModel.ts | 15 ++++++++++----- src/matrix/verification/CrossSigning.ts | 4 +++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/domain/session/verification/DeviceVerificationViewModel.ts b/src/domain/session/verification/DeviceVerificationViewModel.ts index 8a25aad1..f282d7d8 100644 --- a/src/domain/session/verification/DeviceVerificationViewModel.ts +++ b/src/domain/session/verification/DeviceVerificationViewModel.ts @@ -40,20 +40,20 @@ export class DeviceVerificationViewModel extends ErrorReportViewModel) { super(options); - this.init(options); + this.start(options); } - private async init(options: Options): Promise { + private async start(options: Options): Promise { const room = options.room; let requestOrUserId: SASRequest | string; requestOrUserId = options.request ?? options.userId ?? this.getOption("session").userId; - await this.start(requestOrUserId, room); + await this.startVerification(requestOrUserId, room); } - private async start(requestOrUserId: SASRequest | string, room?: Room) { + private async startVerification(requestOrUserId: SASRequest | string, room?: Room) { await this.logAndCatch("DeviceVerificationViewModel.start", (log) => { const crossSigning = this.getOption("session").crossSigning.get(); this.sas = crossSigning.startVerification(requestOrUserId, room, log); @@ -64,7 +64,12 @@ export class DeviceVerificationViewModel extends ErrorReportViewModel; otherDeviceId: string; + otherUserId: string; } export class CrossSigning { @@ -295,8 +296,9 @@ export class CrossSigning { } /** @return the signed MSK for the given user id */ - async signUser(userId: string, verification: IVerificationMethod, log: ILogItem): Promise { + async signUser(verification: IVerificationMethod, log: ILogItem): Promise { return log.wrap("CrossSigning.signUser", async log => { + const userId = verification.otherUserId; log.set("id", userId); if (!this._isMasterKeyTrusted) { log.set("mskNotTrusted", true);