1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Add API for checking IS account info

Part of https://github.com/vector-im/riot-web/issues/10452
This commit is contained in:
J. Ryan Stinnett
2019-07-31 17:31:19 +01:00
parent 5a70859593
commit 4ebe60b2ad

View File

@@ -1886,6 +1886,25 @@ MatrixBaseApis.prototype.lookupThreePid = async function(
}
};
/**
* Get account info from the Identity Server. This is useful as a neutral check
* to verify that other APIs are likely to approve access by testing that the
* token is valid, terms have been agreed, etc.
*
* @param {string} identityAccessToken The `access_token` field of the Identity
* Server `/account/register` response (see {@link registerWithIdentityServer}).
*
* @return {module:client.Promise} Resolves: an object with account info.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getIdentityAccount = function(
identityAccessToken,
) {
return this._http.idServerRequest(
undefined, "GET", "/account",
undefined, httpApi.PREFIX_IDENTITY_V2, identityAccessToken,
);
};
// Direct-to-device messaging
// ==========================