refactor: Remove dynamic in cross signing code
This commit is contained in:
parent
26226d9f31
commit
a6fc1a004d
|
|
@ -181,23 +181,24 @@ class CrossSigning {
|
||||||
}
|
}
|
||||||
if (signedKeys.isNotEmpty) {
|
if (signedKeys.isNotEmpty) {
|
||||||
// post our new keys!
|
// post our new keys!
|
||||||
final payload = <String, Map<String, Map<String, dynamic>>>{};
|
final payload = <String, Map<String, Map<String, Object?>>>{};
|
||||||
for (final key in signedKeys) {
|
for (final key in signedKeys) {
|
||||||
if (key.identifier == null ||
|
final signatures = key.signatures;
|
||||||
key.signatures == null ||
|
final identifier = key.identifier;
|
||||||
key.signatures?.isEmpty != false) {
|
if (identifier == null || signatures == null || signatures.isEmpty) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!payload.containsKey(key.userId)) {
|
if (!payload.containsKey(key.userId)) {
|
||||||
payload[key.userId] = <String, Map<String, dynamic>>{};
|
payload[key.userId] = <String, Map<String, Object?>>{};
|
||||||
}
|
}
|
||||||
if (payload[key.userId]?[key.identifier]?['signatures'] != null) {
|
if (payload[key.userId]?[key.identifier]?['signatures'] != null) {
|
||||||
// we need to merge signature objects
|
// we need to merge signature objects
|
||||||
payload[key.userId]![key.identifier]!['signatures']
|
payload[key.userId]![key.identifier]!
|
||||||
.addAll(key.signatures);
|
.tryGetMap<String, Map<String, String>>('signatures')!
|
||||||
|
.addAll(signatures);
|
||||||
} else {
|
} else {
|
||||||
// we can just add signatures
|
// we can just add signatures
|
||||||
payload[key.userId]![key.identifier!] = key.toJson();
|
payload[key.userId]![identifier] = key.toJson();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue