Merge branch 'malin/correct-type-for-keys' into 'main'
fix: Assign correct type to signedOneTimeKeys See merge request famedly/company/frontend/famedlysdk!1316
This commit is contained in:
commit
6da81d0503
|
|
@ -144,7 +144,7 @@ class OlmManager {
|
|||
}
|
||||
_uploadKeysLock = true;
|
||||
|
||||
final signedOneTimeKeys = <String, dynamic>{};
|
||||
final signedOneTimeKeys = <String, Map<String, Object?>>{};
|
||||
try {
|
||||
int? uploadedOneTimeKeysCount;
|
||||
if (oldKeyCount != null) {
|
||||
|
|
@ -287,8 +287,11 @@ class OlmManager {
|
|||
try {
|
||||
final String identity =
|
||||
json.decode(olmAccount.identity_keys())['curve25519'];
|
||||
session.create_outbound(_olmAccount!, identity, otk['key']);
|
||||
olmAccount.remove_one_time_keys(session);
|
||||
final key = otk.tryGet<String>('key');
|
||||
if (key != null) {
|
||||
session.create_outbound(_olmAccount!, identity, key);
|
||||
olmAccount.remove_one_time_keys(session);
|
||||
}
|
||||
} finally {
|
||||
session.free();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ import 'package:http/http.dart';
|
|||
import 'package:matrix/matrix.dart' as sdk;
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
T? tryCast<T>(dynamic object) => object is T ? object : null;
|
||||
|
||||
Map<String, dynamic> decodeJson(dynamic data) {
|
||||
if (data is String) {
|
||||
return json.decode(data);
|
||||
|
|
@ -2167,7 +2169,11 @@ class FakeMatrixApi extends BaseClient {
|
|||
'one_time_key_counts': {
|
||||
'curve25519': 10,
|
||||
'signed_curve25519':
|
||||
decodeJson(req)['one_time_keys']?.keys?.length ?? 0,
|
||||
tryCast<Map<String, Object?>>(decodeJson(req))
|
||||
?.tryGetMap<String, Object?>('one_time_keys')
|
||||
?.keys
|
||||
.length ??
|
||||
0,
|
||||
}
|
||||
},
|
||||
'/client/v3/keys/query': (var req) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue