1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

MatrixClient.getStoredDevicesForUser

Implement MatrixClient.getStoredDevicesForUser which uses
Crypto.getStoredDevicesForUser, which is more powerful than listDeviceKeys, and
isn't deprecated.

Also a couple of accessors for DeviceInfo.
This commit is contained in:
Richard van der Hoff
2016-09-04 23:31:38 +01:00
parent 692b3107ac
commit 5e0f09075d
3 changed files with 38 additions and 2 deletions

View File

@@ -308,6 +308,8 @@ MatrixClient.prototype.downloadKeys = function(userIds, forceDownload) {
/**
* List the stored device keys for a user id
*
* @deprecated prefer {@link module:client#getStoredDevicesForUser}
*
* @param {string} userId the user to list keys for.
*
* @return {object[]} list of devices with "id", "verified", "blocked",
@@ -320,6 +322,22 @@ MatrixClient.prototype.listDeviceKeys = function(userId) {
return this._crypto.listDeviceKeys(userId);
};
/**
* Get the stored device keys for a user id
*
* @param {string} userId the user to list keys for.
*
* @return {module:crypto-deviceinfo[]} list of devices
*/
MatrixClient.prototype.getStoredDevicesForUser = function(userId) {
if (this._crypto === null) {
throw new Error("End-to-end encryption disabled");
}
return this._crypto.getStoredDevicesForUser(userId);
};
/**
* Mark the given device as verified
*