mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
check algorithm
This commit is contained in:
parent
c5c9505ce2
commit
c5efa582b1
@ -24,6 +24,7 @@ import {Decryption as OlmDecryption} from "./e2ee/olm/Decryption.js";
|
||||
import {Encryption as OlmEncryption} from "./e2ee/olm/Encryption.js";
|
||||
import {Decryption as MegOlmDecryption} from "./e2ee/megolm/Decryption.js";
|
||||
import {Encryption as MegOlmEncryption} from "./e2ee/megolm/Encryption.js";
|
||||
import {MEGOLM_ALGORITHM} from "./e2ee/common.js";
|
||||
import {RoomEncryption} from "./e2ee/RoomEncryption.js";
|
||||
import {DeviceTracker} from "./e2ee/DeviceTracker.js";
|
||||
import {LockMap} from "../utils/LockMap.js";
|
||||
@ -108,6 +109,10 @@ export class Session {
|
||||
if (!this._olmEncryption) {
|
||||
throw new Error("creating room encryption before encryption got globally enabled");
|
||||
}
|
||||
// only support megolm
|
||||
if (encryptionParams.algorithm !== MEGOLM_ALGORITHM) {
|
||||
return null;
|
||||
}
|
||||
return new RoomEncryption({
|
||||
room,
|
||||
deviceTracker: this._deviceTracker,
|
||||
|
@ -88,8 +88,10 @@ export class Room extends EventEmitter {
|
||||
// encryption got enabled
|
||||
if (!this._summary.encryption && summaryChanges.encryption && !this._roomEncryption) {
|
||||
this._roomEncryption = this._createRoomEncryption(this, summaryChanges.encryption);
|
||||
if (this._roomEncryption) {
|
||||
this._sendQueue.enableEncryption(this._roomEncryption);
|
||||
}
|
||||
}
|
||||
if (memberChanges.size) {
|
||||
if (this._changedMembersDuringSync) {
|
||||
for (const [userId, memberChange] of memberChanges.entries()) {
|
||||
@ -138,8 +140,10 @@ export class Room extends EventEmitter {
|
||||
this._summary.load(summary);
|
||||
if (this._summary.encryption) {
|
||||
this._roomEncryption = this._createRoomEncryption(this, this._summary.encryption);
|
||||
if (this._roomEncryption) {
|
||||
this._sendQueue.enableEncryption(this._roomEncryption);
|
||||
}
|
||||
}
|
||||
// need to load members for name?
|
||||
if (this._summary.needsHeroes) {
|
||||
this._heroes = new Heroes(this._roomId);
|
||||
|
Loading…
Reference in New Issue
Block a user