mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
Dispose cross-signing
This commit is contained in:
parent
4a0e2c7308
commit
7e20440328
@ -252,7 +252,9 @@ export class Session {
|
||||
this._keyBackup.get().dispose();
|
||||
this._keyBackup.set(undefined);
|
||||
}
|
||||
if (this._crossSigning.get()) {
|
||||
const crossSigning = this._crossSigning.get();
|
||||
if (crossSigning) {
|
||||
crossSigning.dispose();
|
||||
this._crossSigning.set(undefined);
|
||||
}
|
||||
const key = await ssssKeyFromCredential(type, credential, this._storage, this._platform, this._olm);
|
||||
@ -317,7 +319,9 @@ export class Session {
|
||||
this._keyBackup.get().dispose();
|
||||
this._keyBackup.set(undefined);
|
||||
}
|
||||
if (this._crossSigning.get()) {
|
||||
const crossSigning = this._crossSigning.get();
|
||||
if (crossSigning) {
|
||||
crossSigning.dispose();
|
||||
this._crossSigning.set(undefined);
|
||||
}
|
||||
}
|
||||
@ -374,6 +378,9 @@ export class Session {
|
||||
if (await crossSigning.load(log)) {
|
||||
this._crossSigning.set(crossSigning);
|
||||
}
|
||||
else {
|
||||
crossSigning.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
@ -547,6 +554,7 @@ export class Session {
|
||||
this._e2eeAccount = undefined;
|
||||
this._callHandler?.dispose();
|
||||
this._callHandler = undefined;
|
||||
this._crossSigning.get()?.dispose();
|
||||
for (const room of this._rooms.values()) {
|
||||
room.dispose();
|
||||
}
|
||||
|
@ -119,10 +119,8 @@ export class CrossSigning {
|
||||
this.deviceId = options.deviceId;
|
||||
this.e2eeAccount = options.e2eeAccount
|
||||
this.deviceMessageHandler = options.deviceMessageHandler;
|
||||
|
||||
this.deviceMessageHandler.on("message", async ({ unencrypted: unencryptedEvent }) => {
|
||||
this._handleSASDeviceMessage(unencryptedEvent);
|
||||
})
|
||||
this.handleSASDeviceMessage = this.handleSASDeviceMessage.bind(this);
|
||||
this.deviceMessageHandler.on("message", this.handleSASDeviceMessage);
|
||||
}
|
||||
|
||||
/** @return {boolean} whether cross signing has been enabled on this account */
|
||||
@ -209,7 +207,7 @@ export class CrossSigning {
|
||||
return this.sasVerificationInProgress;
|
||||
}
|
||||
|
||||
private _handleSASDeviceMessage(event: any) {
|
||||
private handleSASDeviceMessage({ unencrypted: event }) {
|
||||
const txnId = event.content.transaction_id;
|
||||
/**
|
||||
* If we receive an event for the current/previously finished
|
||||
@ -376,6 +374,10 @@ export class CrossSigning {
|
||||
});
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.deviceMessageHandler.off("message", this.handleSASDeviceMessage);
|
||||
}
|
||||
|
||||
observeUserTrust(userId: string, log: ILogItem): BaseObservableValue<UserTrust | undefined> {
|
||||
const existingValue = this.observedUsers.get(userId);
|
||||
if (existingValue) {
|
||||
|
Loading…
Reference in New Issue
Block a user