1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

track whether we blacklist unverified devices per-room & globally

This commit is contained in:
Matthew Hodgson
2017-01-21 17:38:35 +00:00
parent e79926db6c
commit 512d5882c9
5 changed files with 63 additions and 2 deletions

View File

@@ -79,6 +79,8 @@ function Crypto(baseApis, eventEmitter, sessionStore, userId, deviceId) {
this._deviceKeys["curve25519:" + this._deviceId] =
this._olmDevice.deviceCurve25519Key;
this._globalBlacklistUnverifiedDevices = false;
let myDevices = this._sessionStore.getEndToEndDevicesForUser(
this._userId
);
@@ -169,6 +171,25 @@ Crypto.prototype.getDeviceEd25519Key = function() {
return this._olmDevice.deviceEd25519Key;
};
/**
* Set the global override for whether the client should ever send encrypted
* messages to unverified devices. If false, it can still be overridden
* per-room. If true, it overrides the per-room settings.
*
* @param {boolean} value whether to unilaterally blacklist all
* unverified devices
*/
Crypto.prototype.setGlobalBlacklistUnverifiedDevices = function(value) {
this._globalBlacklistUnverifiedDevices = value;
};
/**
* @return {boolean} whether to unilaterally blacklist all unverified devices
*/
Crypto.prototype.getGlobalBlacklistUnverifiedDevices = function() {
return this._globalBlacklistUnverifiedDevices;
};
/**
* Upload the device keys to the homeserver and ensure that the
* homeserver has enough one-time keys.