diff --git a/src/client.js b/src/client.js index 3503530b7..df74f8a50 100644 --- a/src/client.js +++ b/src/client.js @@ -894,8 +894,8 @@ MatrixClient.prototype.acceptVerificationDM = function(event, method) { * @param {Array} devices array of device IDs to send requests to. Defaults to * all devices owned by the user * - * @returns {Promise} resolves to a verifier - * when the request is accepted by the other user + * @returns {Promise} resolves to a VerificationRequest + * when the request has been sent to the other party. */ MatrixClient.prototype.requestVerification = function(userId, methods, devices) { if (this._crypto === null) { diff --git a/src/crypto/index.js b/src/crypto/index.js index fa547c395..9c12a54f7 100644 --- a/src/crypto/index.js +++ b/src/crypto/index.js @@ -1515,48 +1515,27 @@ Crypto.prototype.setDeviceVerification = async function( return deviceObj; }; -Crypto.prototype.requestVerificationDM = async function(userId, roomId, methods) { +Crypto.prototype.requestVerificationDM = function(userId, roomId, methods) { const channel = new InRoomChannel(this._baseApis, roomId, userId); - const request = await this._requestVerificationWithChannel( + return this._requestVerificationWithChannel( userId, methods, channel, this._inRoomVerificationRequests, ); - return await request.waitForVerifier(); }; -Crypto.prototype.acceptVerificationDM = function(event, method) { - if(!InRoomChannel.validateEvent(event, this._baseApis)) { - return; - } - - const sender = event.getSender(); - const requestsByTxnId = this._inRoomVerificationRequests.get(sender); - if (!requestsByTxnId) { - return; - } - const transactionId = InRoomChannel.getTransactionId(event); - const request = requestsByTxnId.get(transactionId); - if (!request) { - return; - } - - return request.beginKeyVerification(method); -}; - -Crypto.prototype.requestVerification = async function(userId, methods, devices) { +Crypto.prototype.requestVerification = function(userId, methods, devices) { if (!devices) { devices = Object.keys(this._deviceList.getRawStoredDevicesForUser(userId)); } const channel = new ToDeviceChannel(this._baseApis, userId, devices); - const request = await this._requestVerificationWithChannel( + return this._requestVerificationWithChannel( userId, methods, channel, this._toDeviceVerificationRequests, ); - return await request.waitForVerifier(); }; Crypto.prototype._requestVerificationWithChannel = async function(