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

Add in a public api getStoredDevice allowing clients to get a specific device

Signed-off-by: Kit Sczudlo <kit@kitscz.com>
This commit is contained in:
Kit Sczudlo
2017-05-07 16:02:44 -07:00
parent a3f45b466a
commit 822380ac38

View File

@@ -359,6 +359,21 @@ MatrixClient.prototype.getStoredDevicesForUser = function(userId) {
return this._crypto.getStoredDevicesForUser(userId) || [];
};
/**
* Get the stored device key for a user id and device id
*
* @param {string} userId the user to list keys for.
* @param {string} deviceId unique identifier for the device
*
* @return {?module:crypto-deviceinfo} device or null
*/
MatrixClient.prototype.getStoredDevice = function(userId, deviceId) {
if (this._crypto === null) {
throw new Error("End-to-end encryption disabled");
}
return this._crypto.getStoredDevice(userId, deviceId) || null;
};
/**
* Mark the given device as verified
*