fix: minor stuff

This commit is contained in:
Reza 2022-11-24 09:33:36 +01:00
parent 10cf979877
commit 8f37466295
2 changed files with 11 additions and 9 deletions

View File

@ -643,12 +643,14 @@ class KeyVerification {
.map((device) => device.deviceId) .map((device) => device.deviceId)
.toList() .toList()
.contains(key)); .contains(key));
if (deviceKeys != null && deviceKeys.isNotEmpty) {
await client.sendToDeviceEncrypted( await client.sendToDeviceEncrypted(
deviceKeys!.values.toList(), deviceKeys.values.toList(),
type, type,
payload, payload,
); );
} }
}
} else { } else {
Logs().e( Logs().e(
'[Key Verification] Tried to broadcast and un-broadcastable type: $type'); '[Key Verification] Tried to broadcast and un-broadcastable type: $type');

View File

@ -225,7 +225,7 @@ abstract class SignableKey extends MatrixSignableKey {
Set<String>? onlyValidateUserIds, Set<String>? onlyValidateUserIds,
/// Only check if this key is verified by any Master key. /// Only check if this key is verified by any Master key.
bool verifiedByAnyMasterKey = false, bool verifiedByTheirMasterKey = false,
}) { }) {
if (!client.encryptionEnabled) { if (!client.encryptionEnabled) {
return false; return false;
@ -307,16 +307,16 @@ abstract class SignableKey extends MatrixSignableKey {
if ((verifiedOnly && key.directVerified) || if ((verifiedOnly && key.directVerified) ||
(key is CrossSigningKey && (key is CrossSigningKey &&
key.usage.contains('master') && key.usage.contains('master') &&
(verifiedByAnyMasterKey || (verifiedByTheirMasterKey ||
(key.directVerified && key.userId == client.userID)))) { (key.directVerified && key.userId == client.userID)))) {
return true; // we verified this key and it is valid...all checks out! return true; // we verified this key and it is valid...all checks out!
} }
// or else we just recurse into that key and chack if it works out // or else we just recurse into that key and check if it works out
final haveChain = key.hasValidSignatureChain( final haveChain = key.hasValidSignatureChain(
verifiedOnly: verifiedOnly, verifiedOnly: verifiedOnly,
visited: visited_, visited: visited_,
onlyValidateUserIds: onlyValidateUserIds, onlyValidateUserIds: onlyValidateUserIds,
verifiedByAnyMasterKey: verifiedByAnyMasterKey); verifiedByTheirMasterKey: verifiedByTheirMasterKey);
if (haveChain) { if (haveChain) {
return true; return true;
} }