1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

Make Crypto.setDeviceVerification async

This commit is contained in:
Richard van der Hoff
2017-07-21 10:41:21 +01:00
parent 25ccd6bc6d
commit 23d66b9746
2 changed files with 5 additions and 4 deletions

View File

@@ -523,7 +523,7 @@ async function _setDeviceVerification(
if (!client._crypto) { if (!client._crypto) {
throw new Error("End-to-End encryption disabled"); throw new Error("End-to-End encryption disabled");
} }
const dev = client._crypto.setDeviceVerification( const dev = await client._crypto.setDeviceVerification(
userId, deviceId, verified, blocked, known, userId, deviceId, verified, blocked, known,
); );
client.emit("deviceVerificationChanged", userId, deviceId, dev); client.emit("deviceVerificationChanged", userId, deviceId, dev);

View File

@@ -439,10 +439,11 @@ Crypto.prototype.getStoredDevice = function(userId, deviceId) {
* @param {?boolean} known whether to mark that the user has been made aware of * @param {?boolean} known whether to mark that the user has been made aware of
* the existence of this device. Null to leave unchanged * the existence of this device. Null to leave unchanged
* *
* @return {module:crypto/deviceinfo} updated DeviceInfo * @return {Promise<module:crypto/deviceinfo>} updated DeviceInfo
*/ */
Crypto.prototype.setDeviceVerification = function(userId, deviceId, verified, Crypto.prototype.setDeviceVerification = async function(
blocked, known) { userId, deviceId, verified, blocked, known,
) {
const devices = this._sessionStore.getEndToEndDevicesForUser(userId); const devices = this._sessionStore.getEndToEndDevicesForUser(userId);
if (!devices || !devices[deviceId]) { if (!devices || !devices[deviceId]) {
throw new Error("Unknown device " + userId + ":" + deviceId); throw new Error("Unknown device " + userId + ":" + deviceId);