You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Merge pull request #1040 from matrix-org/jryans/msisdn-submit-url
Add support for sending MSISDN tokens to alternate URLs
This commit is contained in:
@@ -1963,7 +1963,7 @@ MatrixBaseApis.prototype.requestMsisdnToken = async function(
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submits an MSISDN token to the identity server
|
* Submits a MSISDN token to the identity server
|
||||||
*
|
*
|
||||||
* This is used when submitting the code sent by SMS to a phone number.
|
* This is used when submitting the code sent by SMS to a phone number.
|
||||||
* The ID server has an equivalent API for email but the js-sdk does
|
* The ID server has an equivalent API for email but the js-sdk does
|
||||||
@@ -2013,6 +2013,41 @@ MatrixBaseApis.prototype.submitMsisdnToken = async function(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits a MSISDN token to an arbitrary URL.
|
||||||
|
*
|
||||||
|
* This is used when submitting the code sent by SMS to a phone number in the
|
||||||
|
* newer 3PID flow where the homeserver validates 3PID ownership (as part of
|
||||||
|
* `requestAdd3pidMsisdnToken`). The homeserver response may include a
|
||||||
|
* `submit_url` to specify where the token should be sent, and this helper can
|
||||||
|
* be used to pass the token to this URL.
|
||||||
|
*
|
||||||
|
* @param {string} url The URL to submit the token to
|
||||||
|
* @param {string} sid The sid given in the response to requestToken
|
||||||
|
* @param {string} clientSecret A secret binary string generated by the client.
|
||||||
|
* This must be the same value submitted in the requestToken call.
|
||||||
|
* @param {string} msisdnToken The MSISDN token, as enetered by the user.
|
||||||
|
*
|
||||||
|
* @return {module:client.Promise} Resolves: Object, currently with no parameters.
|
||||||
|
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||||
|
*/
|
||||||
|
MatrixBaseApis.prototype.submitMsisdnTokenOtherUrl = function(
|
||||||
|
url,
|
||||||
|
sid,
|
||||||
|
clientSecret,
|
||||||
|
msisdnToken,
|
||||||
|
) {
|
||||||
|
const params = {
|
||||||
|
sid: sid,
|
||||||
|
client_secret: clientSecret,
|
||||||
|
token: msisdnToken,
|
||||||
|
};
|
||||||
|
|
||||||
|
return this._http.requestOtherUrl(
|
||||||
|
undefined, "POST", url, undefined, params,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the V2 hashing information from the identity server. Primarily useful for
|
* Gets the V2 hashing information from the identity server. Primarily useful for
|
||||||
* lookups.
|
* lookups.
|
||||||
|
|||||||
Reference in New Issue
Block a user