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