Skip to content

Commit

Permalink
Merge pull request #159 from matrix-org/rav/device_name_for_e2e_keys
Browse files Browse the repository at this point in the history
client.listDeviceKeys: Expose device display name
  • Loading branch information
richvdh committed Aug 3, 2016
2 parents f139e6e + bb946c6 commit c288e6c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ function _updateStoredDeviceKeysForUser(userId, userStore, userResult) {

deviceStore.keys = deviceRes.keys;
deviceStore.algorithms = deviceRes.algorithms;
deviceStore.unsigned = deviceRes.unsigned;
updated = true;
}

Expand All @@ -500,8 +501,8 @@ function _updateStoredDeviceKeysForUser(userId, userStore, userResult) {
*
* @param {string} userId the user to list keys for.
*
* @return {object[]} list of devices with "id", "verified", "blocked", and
* "key" parameters.
* @return {object[]} list of devices with "id", "verified", "blocked",
* "key", and "display_name" parameters.
*/
MatrixClient.prototype.listDeviceKeys = function(userId) {
if (!this.sessionStore) {
Expand All @@ -522,12 +523,14 @@ MatrixClient.prototype.listDeviceKeys = function(userId) {
deviceId = deviceIds[i];
var device = devices[deviceId];
var ed25519Key = device.keys["ed25519:" + deviceId];
var unsigned = device.unsigned || {};
if (ed25519Key) {
result.push({
id: deviceId,
key: ed25519Key,
verified: Boolean(device.verified == DeviceVerification.VERIFIED),
blocked: Boolean(device.verified == DeviceVerification.BLOCKED),
display_name: unsigned.device_display_name,
});
}
}
Expand Down

0 comments on commit c288e6c

Please sign in to comment.