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