You've already forked matrix-js-sdk
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:
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user