refactor: Use maxnumberofotk from olm instead hardcode 100
This commit is contained in:
parent
f61bab3e7d
commit
544888fe33
|
|
@ -128,6 +128,8 @@ class OlmManager {
|
||||||
bool _uploadKeysLock = false;
|
bool _uploadKeysLock = false;
|
||||||
CancelableOperation<Map<String, int>>? currentUpload;
|
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.
|
/// 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.
|
/// If `retry` is > 0, the request will be retried with new OTKs on upload failure.
|
||||||
Future<bool> uploadKeys({
|
Future<bool> uploadKeys({
|
||||||
|
|
|
||||||
|
|
@ -1815,7 +1815,9 @@ class Client extends MatrixApi {
|
||||||
/// Use this method only for testing utilities!
|
/// Use this method only for testing utilities!
|
||||||
Future<void> handleSync(SyncUpdate sync, {Direction? direction}) async {
|
Future<void> handleSync(SyncUpdate sync, {Direction? direction}) async {
|
||||||
// ensure we don't upload keys because someone forgot to set a key count
|
// 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);
|
await _handleSync(sync, direction: direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue