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