mirror of
https://github.com/element-hq/element-web
synced 2024-11-25 02:35:48 +03:00
Assume room should be unencrypted if homeserver does not implement keys/query
Dendrite (and others) do not support key fetching (or indeed, E2E at all). Rather than failing to create a room at all, leave it unencrypted. Fixes #13598
This commit is contained in:
parent
2aa7a6087c
commit
baa7a86e3e
1 changed files with 11 additions and 1 deletions
|
@ -212,7 +212,17 @@ export async function _waitForMember(client, roomId, userId, opts = { timeout: 1
|
|||
* can encrypt to.
|
||||
*/
|
||||
export async function canEncryptToAllUsers(client, userIds) {
|
||||
const usersDeviceMap = await client.downloadKeys(userIds);
|
||||
let usersDeviceMap;
|
||||
try {
|
||||
usersDeviceMap = await client.downloadKeys(userIds);
|
||||
} catch (ex) {
|
||||
if (ex.httpStatus === 404) {
|
||||
// The endpoint to fetch keys doesn't exist: force unencrypted.
|
||||
// See: https://github.com/vector-im/riot-web/issues/13598
|
||||
return false;
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
// { "@user:host": { "DEVICE": {...}, ... }, ... }
|
||||
return Object.values(usersDeviceMap).every((userDevices) =>
|
||||
// { "DEVICE": {...}, ... }
|
||||
|
|
Loading…
Reference in a new issue