You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-05 17:02:07 +03:00
return request instead of verifier from verification methods
as MSC2366 adds an extra interactive step to the verification process, we can't wait for the verifier after sending the request. This is a breaking change in the js-sdk as it changes the return type of an existing method.
This commit is contained in:
@@ -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<module:crypto/verification/Base>} resolves to a verifier
|
||||
* when the request is accepted by the other user
|
||||
* @returns {Promise<module:crypto/verification/request/VerificationRequest>} 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) {
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user