You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
client.listDeviceKeys: Expose device display name
This commit is contained in:
@@ -489,6 +489,7 @@ function _updateStoredDeviceKeysForUser(userId, userStore, userResult) {
|
|||||||
|
|
||||||
deviceStore.keys = deviceRes.keys;
|
deviceStore.keys = deviceRes.keys;
|
||||||
deviceStore.algorithms = deviceRes.algorithms;
|
deviceStore.algorithms = deviceRes.algorithms;
|
||||||
|
deviceStore.unsigned = deviceRes.unsigned;
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,8 +501,8 @@ function _updateStoredDeviceKeysForUser(userId, userStore, userResult) {
|
|||||||
*
|
*
|
||||||
* @param {string} userId the user to list keys for.
|
* @param {string} userId the user to list keys for.
|
||||||
*
|
*
|
||||||
* @return {object[]} list of devices with "id", "verified", "blocked", and
|
* @return {object[]} list of devices with "id", "verified", "blocked",
|
||||||
* "key" parameters.
|
* "key", and "display_name" parameters.
|
||||||
*/
|
*/
|
||||||
MatrixClient.prototype.listDeviceKeys = function(userId) {
|
MatrixClient.prototype.listDeviceKeys = function(userId) {
|
||||||
if (!this.sessionStore) {
|
if (!this.sessionStore) {
|
||||||
@@ -522,12 +523,14 @@ MatrixClient.prototype.listDeviceKeys = function(userId) {
|
|||||||
deviceId = deviceIds[i];
|
deviceId = deviceIds[i];
|
||||||
var device = devices[deviceId];
|
var device = devices[deviceId];
|
||||||
var ed25519Key = device.keys["ed25519:" + deviceId];
|
var ed25519Key = device.keys["ed25519:" + deviceId];
|
||||||
|
var unsigned = device.unsigned || {};
|
||||||
if (ed25519Key) {
|
if (ed25519Key) {
|
||||||
result.push({
|
result.push({
|
||||||
id: deviceId,
|
id: deviceId,
|
||||||
key: ed25519Key,
|
key: ed25519Key,
|
||||||
verified: Boolean(device.verified == DeviceVerification.VERIFIED),
|
verified: Boolean(device.verified == DeviceVerification.VERIFIED),
|
||||||
blocked: Boolean(device.verified == DeviceVerification.BLOCKED),
|
blocked: Boolean(device.verified == DeviceVerification.BLOCKED),
|
||||||
|
display_name: unsigned.device_display_name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user