Fix more bugs

1. Create cross-signing from createIdentity as well
2. Don't try sending anything if this.id is undefined
This commit is contained in:
RMidhunSuresh 2023-06-20 14:47:42 +05:30
parent ae7f13c7e3
commit 071aa2c2a3
3 changed files with 18 additions and 2 deletions

View File

@ -168,7 +168,7 @@ export class DeviceVerificationViewModel extends ErrorReportViewModel<SegmentTyp
dispose(): void {
if (this.sas && !this.sas.finished) {
this.sas.abort().catch(() => {/** ignore */});
this.sas.abort().catch((e) => { console.error(e); });
}
super.dispose();
}

View File

@ -419,6 +419,7 @@ export class Session {
}
await this._e2eeAccount.generateOTKsIfNeeded(this._storage, log);
await log.wrap("uploadKeys", log => this._e2eeAccount.uploadKeys(this._storage, false, log));
await this._createCrossSigning();
}
}
@ -545,6 +546,12 @@ export class Session {
await this._tryLoadSecretStorage(ssssKey, log);
}
}
if (this._e2eeAccount) {
await this._createCrossSigning();
}
}
async _createCrossSigning() {
if (this._features.crossSigning) {
this._platform.logger.run("enable cross-signing", async log => {
const crossSigning = new CrossSigning({

View File

@ -103,7 +103,7 @@ export class RoomChannel extends Disposables implements IChannel {
}
async send(eventType: VerificationEventType, content: any, log: ILogItem): Promise<void> {
await log.wrap("RoomChannel.send", async () => {
await log.wrap("RoomChannel.send", async (_log) => {
if (this.isCancelled) {
throw new VerificationCancelledError();
}
@ -112,6 +112,15 @@ export class RoomChannel extends Disposables implements IChannel {
await this.handleRequestEventSpecially(eventType, content, log);
return;
}
if (!this.id) {
/**
* This might happen if the user cancelled the verification from the UI,
* but no verification messages were yet sent (maybe because the keys are
* missing etc..).
*/
return;
}
await this.room.ensureMessageKeyIsShared(_log);
Object.assign(content, createReference(this.id));
await this.room.sendEvent(eventType, content, undefined, log);
this.sentMessages.set(eventType, {content});