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