diff --git a/src/client.js b/src/client.js index 3aff6213e..4de449256 100644 --- a/src/client.js +++ b/src/client.js @@ -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 *