fix: wait for online key backup key to be cached on reset

Otherwise uploading the keys won't work, since the key backup is
"disabled".
This commit is contained in:
Nicolas Werner 2023-09-18 16:28:09 +02:00
parent bbb157503d
commit 3fb77383a3
No known key found for this signature in database
1 changed files with 11 additions and 0 deletions

View File

@ -581,6 +581,17 @@ class Bootstrap {
);
Logs().v('Store the secret...');
await newSsssKey?.store(megolmKey, base64.encode(privKey));
Logs().v('Wait for secret to come down sync');
if (!await encryption.keyManager.isCached()) {
await client.onSync.stream
.firstWhere((syncUpdate) =>
syncUpdate.accountData != null &&
syncUpdate.accountData!
.any((accountData) => accountData.type == megolmKey))
.then((_) => Logs().v('New backup key was created'));
}
Logs().v(
'And finally set all megolm keys as needing to be uploaded again...');
await client.database?.markInboundGroupSessionsAsNeedingUpload();