simplify key signing a tad
This commit is contained in:
parent
b4e83caa89
commit
45232be3a0
|
@ -123,14 +123,8 @@ class CrossSigning {
|
|||
if (key == null || signedWith == null || signature == null) {
|
||||
return;
|
||||
}
|
||||
final signedKey = signedKeys.firstWhere(
|
||||
(k) => k.userId == key.userId && k.identifier == key.identifier,
|
||||
orElse: () => null) ??
|
||||
key.cloneForSigning();
|
||||
signedKey.signatures ??= <String, Map<String, String>>{};
|
||||
if (!signedKey.signatures.containsKey(signedWith.userId)) {
|
||||
signedKey.signatures[signedWith.userId] = <String, String>{};
|
||||
}
|
||||
final signedKey = key.cloneForSigning();
|
||||
signedKey.signatures[signedWith.userId] = <String, String>{};
|
||||
signedKey.signatures[signedWith.userId]
|
||||
['ed25519:${signedWith.identifier}'] = signature;
|
||||
signedKeys.add(signedKey);
|
||||
|
|
|
@ -125,6 +125,7 @@ abstract class SignableKey extends MatrixSignableKey {
|
|||
MatrixSignableKey cloneForSigning() {
|
||||
final newKey =
|
||||
MatrixSignableKey.fromJson(Map<String, dynamic>.from(toJson()));
|
||||
newKey.signatures ??= <String, Map<String, String>>{};
|
||||
newKey.signatures.clear();
|
||||
return newKey;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue