1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Merge pull request #1252 from matrix-org/uhoreg/megolm_speed

refactor megolm encryption to improve perceived speed
This commit is contained in:
Hubert Chathi
2020-03-10 20:09:41 -04:00
committed by GitHub
6 changed files with 319 additions and 195 deletions

View File

@@ -1770,10 +1770,13 @@ MatrixBaseApis.prototype.downloadKeysForUsers = function(userIds, opts) {
*
* @param {string} [key_algorithm = signed_curve25519] desired key type
*
* @param {number} [timeout] the time (in milliseconds) to wait for keys from remote
* servers
*
* @return {Promise} Resolves: result object. Rejects: with
* an error response ({@link module:http-api.MatrixError}).
*/
MatrixBaseApis.prototype.claimOneTimeKeys = function(devices, key_algorithm) {
MatrixBaseApis.prototype.claimOneTimeKeys = function(devices, key_algorithm, timeout) {
const queries = {};
if (key_algorithm === undefined) {
@@ -1788,6 +1791,9 @@ MatrixBaseApis.prototype.claimOneTimeKeys = function(devices, key_algorithm) {
query[deviceId] = key_algorithm;
}
const content = {one_time_keys: queries};
if (timeout) {
content.timeout = timeout;
}
const path = "/keys/claim";
return this._http.authedRequest(undefined, "POST", path, undefined, content);
};