Wait for cross-signing to become available

This commit is contained in:
RMidhunSuresh 2023-06-11 20:32:39 +05:30
parent 571e6591c8
commit fbc31e6fbe

View File

@ -64,8 +64,9 @@ export class DeviceVerificationViewModel extends ErrorReportViewModel<SegmentTyp
} }
private async startVerification(requestOrUserId: SASRequest | string, room?: Room) { private async startVerification(requestOrUserId: SASRequest | string, room?: Room) {
await this.logAndCatch("DeviceVerificationViewModel.start", async (log) => { await this.logAndCatch("DeviceVerificationViewModel.startVerification", async (log) => {
const crossSigning = this.getOption("session").crossSigning.get(); const crossSigningObservable = this.getOption("session").crossSigning;
const crossSigning = await crossSigningObservable.waitFor(c => !!c).promise;
this.sas = crossSigning.startVerification(requestOrUserId, room, log); this.sas = crossSigning.startVerification(requestOrUserId, room, log);
if (!this.sas) { if (!this.sas) {
throw new Error("CrossSigning.startVerification did not return a sas object!"); throw new Error("CrossSigning.startVerification did not return a sas object!");