Merge pull request #1535 from famedly/nico/fix-okb-reset
Make online key backup reset actually backup keys
This commit is contained in:
commit
b27fd4575d
|
|
@ -182,8 +182,6 @@ class KeyManager {
|
|||
if (uploaded) {
|
||||
await client.database
|
||||
?.markInboundGroupSessionAsUploaded(roomId, sessionId);
|
||||
} else {
|
||||
_haveKeysToUpload = true;
|
||||
}
|
||||
});
|
||||
final room = client.getRoomById(roomId);
|
||||
|
|
@ -750,7 +748,6 @@ class KeyManager {
|
|||
}
|
||||
|
||||
bool _isUploadingKeys = false;
|
||||
bool _haveKeysToUpload = true;
|
||||
|
||||
Future<void> backgroundTasks() async {
|
||||
final database = client.database;
|
||||
|
|
@ -760,12 +757,11 @@ class KeyManager {
|
|||
}
|
||||
_isUploadingKeys = true;
|
||||
try {
|
||||
if (!_haveKeysToUpload || !(await isCached())) {
|
||||
if (!(await isCached())) {
|
||||
return; // we can't backup anyways
|
||||
}
|
||||
final dbSessions = await database.getInboundGroupSessionsToUpload();
|
||||
if (dbSessions.isEmpty) {
|
||||
_haveKeysToUpload = false;
|
||||
return; // nothing to do
|
||||
}
|
||||
final privateKey =
|
||||
|
|
|
|||
|
|
@ -584,6 +584,8 @@ class Bootstrap {
|
|||
Logs().v(
|
||||
'And finally set all megolm keys as needing to be uploaded again...');
|
||||
await client.database?.markInboundGroupSessionsAsNeedingUpload();
|
||||
Logs().v('And uploading keys...');
|
||||
await client.encryption?.keyManager.backgroundTasks();
|
||||
} catch (e, s) {
|
||||
Logs().e('[Bootstrapping] Error setting up online key backup', e, s);
|
||||
state = BootstrapState.error;
|
||||
|
|
|
|||
Loading…
Reference in New Issue