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

Refresh device list on startup

On initialsync, call the /keys/changes api to see which users have updated
their devices. (On failure, invalidate all of them).
This commit is contained in:
Richard van der Hoff
2017-02-01 19:58:45 +00:00
parent 732a764ec6
commit 8d502743a5
2 changed files with 121 additions and 18 deletions

View File

@@ -1082,6 +1082,28 @@ MatrixBaseApis.prototype.claimOneTimeKeys = function(devices, key_algorithm) {
);
};
/**
* Ask the server for a list of users who have changed their device lists
* between a pair of sync tokens
*
* @param {string} oldToken
* @param {string} newToken
*
* @return {module:client.Promise} Resolves: result object. Rejects: with
* an error response ({@link module:http-api.MatrixError}).
*/
MatrixBaseApis.prototype.getKeyChanges = function(oldToken, newToken) {
const qps = {
from: oldToken,
to: newToken,
};
return this._http.authedRequestWithPrefix(
undefined, "GET", "/keys/changes", qps, undefined,
httpApi.PREFIX_UNSTABLE,
);
};
// Identity Server Operations
// ==========================