mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Fix resolveStartMessages not working
This commit is contained in:
parent
1da93493f6
commit
fea5bc9c48
@ -18,10 +18,11 @@ import {CancelReason, VerificationEventType} from "../channel/types";
|
|||||||
import {KEY_AGREEMENT_LIST, HASHES_LIST, MAC_LIST, SAS_LIST} from "./constants";
|
import {KEY_AGREEMENT_LIST, HASHES_LIST, MAC_LIST, SAS_LIST} from "./constants";
|
||||||
import {SendAcceptVerificationStage} from "./SendAcceptVerificationStage";
|
import {SendAcceptVerificationStage} from "./SendAcceptVerificationStage";
|
||||||
import {SendKeyStage} from "./SendKeyStage";
|
import {SendKeyStage} from "./SendKeyStage";
|
||||||
|
import {Deferred} from "../../../../utils/Deferred";
|
||||||
import type {ILogItem} from "../../../../logging/types";
|
import type {ILogItem} from "../../../../logging/types";
|
||||||
|
|
||||||
export class SelectVerificationMethodStage extends BaseSASVerificationStage {
|
export class SelectVerificationMethodStage extends BaseSASVerificationStage {
|
||||||
private hasSentStartMessage = false;
|
private hasSentStartMessage?: Promise<void>;
|
||||||
private allowSelection = true;
|
private allowSelection = true;
|
||||||
public otherDeviceName: string;
|
public otherDeviceName: string;
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ export class SelectVerificationMethodStage extends BaseSASVerificationStage {
|
|||||||
// We received the start message
|
// We received the start message
|
||||||
this.allowSelection = false;
|
this.allowSelection = false;
|
||||||
if (this.hasSentStartMessage) {
|
if (this.hasSentStartMessage) {
|
||||||
|
await this.hasSentStartMessage;
|
||||||
await this.resolveStartConflict(log);
|
await this.resolveStartConflict(log);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -96,6 +98,8 @@ export class SelectVerificationMethodStage extends BaseSASVerificationStage {
|
|||||||
|
|
||||||
async selectEmojiMethod(log: ILogItem) {
|
async selectEmojiMethod(log: ILogItem) {
|
||||||
if (!this.allowSelection) { return; }
|
if (!this.allowSelection) { return; }
|
||||||
|
const deferred = new Deferred<void>();
|
||||||
|
this.hasSentStartMessage = deferred.promise;
|
||||||
const content = {
|
const content = {
|
||||||
method: "m.sas.v1",
|
method: "m.sas.v1",
|
||||||
from_device: this.ourUserDeviceId,
|
from_device: this.ourUserDeviceId,
|
||||||
@ -110,6 +114,6 @@ export class SelectVerificationMethodStage extends BaseSASVerificationStage {
|
|||||||
* to the next stage (where we will send the key).
|
* to the next stage (where we will send the key).
|
||||||
*/
|
*/
|
||||||
await this.channel.send(VerificationEventType.Start, content, log);
|
await this.channel.send(VerificationEventType.Start, content, log);
|
||||||
this.hasSentStartMessage = true;
|
deferred.resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user