Merge pull request #1682 from famedly/krille/use-max-number-otk-from-olm

refactor: Use maxnumberofotk from olm instead hardcode 100
This commit is contained in:
Krille-chan 2024-01-22 12:48:56 +01:00 committed by GitHub
commit a50946d775
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -128,6 +128,8 @@ class OlmManager {
bool _uploadKeysLock = false;
CancelableOperation<Map<String, int>>? currentUpload;
int? get maxNumberOfOneTimeKeys => _olmAccount?.max_number_of_one_time_keys();
/// Generates new one time keys, signs everything and upload it to the server.
/// If `retry` is > 0, the request will be retried with new OTKs on upload failure.
Future<bool> uploadKeys({

View File

@ -1815,7 +1815,9 @@ class Client extends MatrixApi {
/// Use this method only for testing utilities!
Future<void> handleSync(SyncUpdate sync, {Direction? direction}) async {
// ensure we don't upload keys because someone forgot to set a key count
sync.deviceOneTimeKeysCount ??= {'signed_curve25519': 100};
sync.deviceOneTimeKeysCount ??= {
'signed_curve25519': encryption?.olmManager.maxNumberOfOneTimeKeys ?? 100,
};
await _handleSync(sync, direction: direction);
}