Revert "Assume room should be unencrypted if homeserver does not implement keys/query"

This reverts commit baa7a86e3e.
pull/21833/head
Half-Shot 2020-05-08 16:36:13 +01:00
parent baa7a86e3e
commit 93f2a83774
1 changed files with 1 additions and 11 deletions

View File

@ -212,17 +212,7 @@ export async function _waitForMember(client, roomId, userId, opts = { timeout: 1
* can encrypt to. * can encrypt to.
*/ */
export async function canEncryptToAllUsers(client, userIds) { export async function canEncryptToAllUsers(client, userIds) {
let usersDeviceMap; const usersDeviceMap = await client.downloadKeys(userIds);
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": {...}, ... }, ... } // { "@user:host": { "DEVICE": {...}, ... }, ... }
return Object.values(usersDeviceMap).every((userDevices) => return Object.values(usersDeviceMap).every((userDevices) =>
// { "DEVICE": {...}, ... } // { "DEVICE": {...}, ... }