fix: do not pass the verified device list
This commit is contained in:
parent
8f37466295
commit
dd4d0696b3
|
|
@ -159,21 +159,20 @@ class KeyVerification {
|
|||
return methods;
|
||||
}
|
||||
|
||||
Future<void> sendStart({List<Device>? verifiedDevices}) async {
|
||||
Future<void> sendStart() async {
|
||||
await send(
|
||||
EventTypes.KeyVerificationRequest,
|
||||
{
|
||||
'methods': knownVerificationMethods,
|
||||
if (room == null) 'timestamp': DateTime.now().millisecondsSinceEpoch,
|
||||
},
|
||||
verifiedDevices: verifiedDevices,
|
||||
);
|
||||
startedVerification = true;
|
||||
setState(KeyVerificationState.waitingAccept);
|
||||
lastActivity = DateTime.now();
|
||||
}
|
||||
|
||||
Future<void> start({List<Device>? verifiedDevices}) async {
|
||||
Future<void> start() async {
|
||||
if (room == null) {
|
||||
transactionId = client.generateUniqueTransactionId();
|
||||
}
|
||||
|
|
@ -183,9 +182,7 @@ class KeyVerification {
|
|||
setState(KeyVerificationState.askSSSS);
|
||||
_nextAction = 'request';
|
||||
} else {
|
||||
await sendStart(
|
||||
verifiedDevices: verifiedDevices,
|
||||
);
|
||||
await sendStart();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -610,8 +607,11 @@ class KeyVerification {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> send(String type, Map<String, dynamic> payload,
|
||||
{List<Device>? verifiedDevices}) async {
|
||||
Future<void> send(
|
||||
String type,
|
||||
Map<String, dynamic> payload,
|
||||
) async {
|
||||
Logs().e('payload is ', payload);
|
||||
makePayload(payload);
|
||||
Logs().i('[Key Verification] Sending type $type: $payload');
|
||||
if (room != null) {
|
||||
|
|
@ -635,22 +635,17 @@ class KeyVerification {
|
|||
EventTypes.KeyVerificationRequest,
|
||||
EventTypes.KeyVerificationCancel,
|
||||
}.contains(type)) {
|
||||
if (verifiedDevices == null || verifiedDevices.isEmpty) {
|
||||
await client.sendToDevicesOfUserIds({userId}, type, payload);
|
||||
} else {
|
||||
final deviceKeys = client.userDeviceKeys[userId]?.deviceKeys;
|
||||
deviceKeys?.removeWhere((key, _) => !verifiedDevices
|
||||
.map((device) => device.deviceId)
|
||||
.toList()
|
||||
.contains(key));
|
||||
if (deviceKeys != null && deviceKeys.isNotEmpty) {
|
||||
deviceKeys?.removeWhere((_, value) =>
|
||||
value.hasValidSignatureChain(verifiedByTheirMasterKey: true) ==
|
||||
false);
|
||||
if (deviceKeys != null) {
|
||||
await client.sendToDeviceEncrypted(
|
||||
deviceKeys.values.toList(),
|
||||
type,
|
||||
payload,
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logs().e(
|
||||
'[Key Verification] Tried to broadcast and un-broadcastable type: $type');
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@ class DeviceKeysList {
|
|||
Future<KeyVerification> startVerification({
|
||||
bool? newDirectChatEnableEncryption,
|
||||
List<StateEvent>? newDirectChatInitialState,
|
||||
List<Device>? verifiedDevices,
|
||||
}) async {
|
||||
final encryption = client.encryption;
|
||||
if (encryption == null) {
|
||||
|
|
@ -97,9 +96,7 @@ class DeviceKeysList {
|
|||
// start verification with verified devices
|
||||
final request = KeyVerification(
|
||||
encryption: encryption, userId: userId, deviceId: '*');
|
||||
await request.start(
|
||||
verifiedDevices: verifiedDevices,
|
||||
);
|
||||
await request.start();
|
||||
encryption.keyVerificationManager.addRequest(request);
|
||||
return request;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue