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

Merge pull request #1007 from matrix-org/jryans/is-account-info

Add API for checking IS account info
This commit is contained in:
J. Ryan Stinnett
2019-08-01 17:28:08 +01:00
committed by GitHub

View File

@@ -1889,6 +1889,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 // Direct-to-device messaging
// ========================== // ==========================