1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Merge pull request #336 from matrix-org/matthew/blacklist-unverified

Support for blacklisting unverified devices, both per-room and globally
This commit is contained in:
Richard van der Hoff
2017-02-03 10:26:59 +00:00
committed by GitHub
4 changed files with 74 additions and 2 deletions

View File

@@ -421,6 +421,32 @@ function _setDeviceVerification(client, userId, deviceId, verified, blocked, kno
client.emit("deviceVerificationChanged", userId, deviceId);
}
/**
* 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
*/
MatrixClient.prototype.setGlobalBlacklistUnverifiedDevices = function(value) {
if (this._crypto === null) {
throw new Error("End-to-end encryption disabled");
}
this._crypto.setGlobalBlacklistUnverifiedDevices(value);
};
/**
* @return {boolean} whether to unilaterally blacklist all
* unverified devices
*/
MatrixClient.prototype.getGlobalBlacklistUnverifiedDevices = function() {
if (this._crypto === null) {
throw new Error("End-to-end encryption disabled");
}
return this._crypto.getGlobalBlacklistUnverifiedDevices();
};
/**
* Get e2e information on the device that sent an event
*