refactor: Use maxnumberofotk from olm instead hardcode 100

This commit is contained in:
Krille 2024-01-15 13:56:54 +01:00
parent f61bab3e7d
commit 544888fe33
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652
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);
}