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

Change initial key backup to background

Alters the APIs used for initial key backup so that the actual upload happens in
the background after all session are marked for backup.
This commit is contained in:
J. Ryan Stinnett
2019-01-09 04:58:29 -06:00
parent 5cfd082b00
commit 25681e888c
2 changed files with 18 additions and 10 deletions

View File

@@ -997,12 +997,16 @@ MatrixClient.prototype.sendKeyBackup = function(roomId, sessionId, version, data
);
};
MatrixClient.prototype.backupAllGroupSessions = function(version) {
/**
* Marks all group sessions as needing to be backed up and schedules them to
* upload in the background as soon as possible.
*/
MatrixClient.prototype.scheduleAllGroupSessionsForBackup = async function() {
if (this._crypto === null) {
throw new Error("End-to-end encryption disabled");
}
return this._crypto.backupAllGroupSessions(version);
await this._crypto.scheduleAllGroupSessionsForBackup();
};
MatrixClient.prototype.isValidRecoveryKey = function(recoveryKey) {