chore: use proper matchers in integration tests

This commit is contained in:
Nicolas Werner 2022-12-12 05:23:38 +01:00
parent 90e8d5b118
commit 8c2d7d78d8
No known key found for this signature in database
3 changed files with 349 additions and 286 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
*.swo *.swo
*.swn *.swn
*.dylib *.dylib
*.bakmacoscompat
.DS_Store .DS_Store
.atom/ .atom/
.buildlog/ .buildlog/

View File

@ -382,6 +382,14 @@ class KeyManager {
.where((e) => !e.value) .where((e) => !e.value)
.map((e) => e.key)) .map((e) => e.key))
: <String>{}; : <String>{};
// check if a device got removed
if (oldDeviceIds.difference(newDeviceIds).isNotEmpty) {
wipe = true;
break;
}
// check if any new devices need keys
final newDevices = newDeviceIds.difference(oldDeviceIds); final newDevices = newDeviceIds.difference(oldDeviceIds);
if (newDeviceIds.isNotEmpty) { if (newDeviceIds.isNotEmpty) {
devicesToReceive.addAll(newDeviceKeys.where( devicesToReceive.addAll(newDeviceKeys.where(

View File

@ -16,14 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import 'dart:io';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:olm/olm.dart' as olm; import 'package:olm/olm.dart' as olm;
import 'package:test/test.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import '../test/fake_database.dart'; import '../test/fake_database.dart';
import 'test_config.dart'; import 'test_config.dart';
void main() => test();
const String testMessage = 'Hello world'; const String testMessage = 'Hello world';
const String testMessage2 = 'Hello moon'; const String testMessage2 = 'Hello moon';
const String testMessage3 = 'Hello sun'; const String testMessage3 = 'Hello sun';
@ -31,7 +33,8 @@ const String testMessage4 = 'Hello star';
const String testMessage5 = 'Hello earth'; const String testMessage5 = 'Hello earth';
const String testMessage6 = 'Hello mars'; const String testMessage6 = 'Hello mars';
void test() async { void main() => group('Integration tests', () {
test('E2EE', () async {
Client? testClientA, testClientB; Client? testClientA, testClientB;
try { try {
@ -45,19 +48,19 @@ void test() async {
testClientA = Client('TestClientA', databaseBuilder: getDatabase); testClientA = Client('TestClientA', databaseBuilder: getDatabase);
await testClientA.checkHomeserver(Uri.parse(TestUser.homeserver)); await testClientA.checkHomeserver(Uri.parse(TestUser.homeserver));
await testClientA.login(LoginType.mLoginPassword, await testClientA.login(LoginType.mLoginPassword,
identifier: identifier: AuthenticationUserIdentifier(
AuthenticationUserIdentifier(user: TestUser.username.localpart!), user: TestUser.username.localpart!),
password: TestUser.password); password: TestUser.password);
assert(testClientA.encryptionEnabled); expect(testClientA.encryptionEnabled, true);
Logs().i('++++ Login Bob ++++'); Logs().i('++++ Login Bob ++++');
testClientB = Client('TestClientB', databaseBuilder: getDatabase); testClientB = Client('TestClientB', databaseBuilder: getDatabase);
await testClientB.checkHomeserver(Uri.parse(TestUser.homeserver)); await testClientB.checkHomeserver(Uri.parse(TestUser.homeserver));
await testClientB.login(LoginType.mLoginPassword, await testClientB.login(LoginType.mLoginPassword,
identifier: identifier: AuthenticationUserIdentifier(
AuthenticationUserIdentifier(user: TestUser.username2.localpart!), user: TestUser.username2.localpart!),
password: TestUser.password2); password: TestUser.password2);
assert(testClientB.encryptionEnabled); expect(testClientB.encryptionEnabled, true);
Logs().i('++++ (Alice) Leave all rooms ++++'); Logs().i('++++ (Alice) Leave all rooms ++++');
while (testClientA.rooms.isNotEmpty) { while (testClientA.rooms.isNotEmpty) {
@ -83,20 +86,28 @@ void test() async {
} }
Logs().i('++++ Check if own olm device is verified by default ++++'); Logs().i('++++ Check if own olm device is verified by default ++++');
assert(testClientA.userDeviceKeys.containsKey(TestUser.username)); expect(testClientA.userDeviceKeys, contains(TestUser.username));
assert(testClientA.userDeviceKeys[TestUser.username]!.deviceKeys expect(testClientA.userDeviceKeys[TestUser.username]!.deviceKeys,
.containsKey(testClientA.deviceID)); contains(testClientA.deviceID));
assert(testClientA.userDeviceKeys[TestUser.username]! expect(
.deviceKeys[testClientA.deviceID!]!.verified); testClientA.userDeviceKeys[TestUser.username]!
assert(!testClientA.userDeviceKeys[TestUser.username]! .deviceKeys[testClientA.deviceID!]!.verified,
.deviceKeys[testClientA.deviceID!]!.blocked); isTrue);
assert(testClientB.userDeviceKeys.containsKey(TestUser.username2)); expect(
assert(testClientB.userDeviceKeys[TestUser.username2]!.deviceKeys !testClientA.userDeviceKeys[TestUser.username]!
.containsKey(testClientB.deviceID)); .deviceKeys[testClientA.deviceID!]!.blocked,
assert(testClientB.userDeviceKeys[TestUser.username2]! isTrue);
.deviceKeys[testClientB.deviceID!]!.verified); expect(testClientB.userDeviceKeys, contains(TestUser.username2));
assert(!testClientB.userDeviceKeys[TestUser.username2]! expect(testClientB.userDeviceKeys[TestUser.username2]!.deviceKeys,
.deviceKeys[testClientB.deviceID!]!.blocked); contains(testClientB.deviceID));
expect(
testClientB.userDeviceKeys[TestUser.username2]!
.deviceKeys[testClientB.deviceID!]!.verified,
isTrue);
expect(
!testClientB.userDeviceKeys[TestUser.username2]!
.deviceKeys[testClientB.deviceID!]!.blocked,
isTrue);
Logs().i('++++ (Alice) Create room and invite Bob ++++'); Logs().i('++++ (Alice) Create room and invite Bob ++++');
await testClientA.startDirectChat( await testClientA.startDirectChat(
@ -111,225 +122,267 @@ void test() async {
final inviteRoom = testClientB.getRoomById(roomId)!; final inviteRoom = testClientB.getRoomById(roomId)!;
await inviteRoom.join(); await inviteRoom.join();
await Future.delayed(Duration(seconds: 1)); await Future.delayed(Duration(seconds: 1));
assert(inviteRoom.membership == Membership.join); expect(inviteRoom.membership, Membership.join);
Logs().i('++++ (Alice) Enable encryption ++++'); Logs().i('++++ (Alice) Enable encryption ++++');
assert(room.encrypted == false); expect(room.encrypted, false);
await room.enableEncryption(); await room.enableEncryption();
await Future.delayed(Duration(seconds: 5)); await Future.delayed(Duration(seconds: 5));
assert(room.encrypted == true); expect(room.encrypted, isTrue);
assert( expect(
room.client.encryption!.keyManager.getOutboundGroupSession(room.id) == room.client.encryption!.keyManager
.getOutboundGroupSession(room.id),
null); null);
Logs().i('++++ (Alice) Check known olm devices ++++'); Logs().i('++++ (Alice) Check known olm devices ++++');
assert(testClientA.userDeviceKeys.containsKey(TestUser.username2)); expect(testClientA.userDeviceKeys, contains(TestUser.username2));
assert(testClientA.userDeviceKeys[TestUser.username2]!.deviceKeys expect(testClientA.userDeviceKeys[TestUser.username2]!.deviceKeys,
.containsKey(testClientB.deviceID)); contains(testClientB.deviceID));
assert(!testClientA.userDeviceKeys[TestUser.username2]! expect(
.deviceKeys[testClientB.deviceID!]!.verified); testClientA.userDeviceKeys[TestUser.username2]!
assert(!testClientA.userDeviceKeys[TestUser.username2]! .deviceKeys[testClientB.deviceID!]!.verified,
.deviceKeys[testClientB.deviceID!]!.blocked); isFalse);
assert(testClientB.userDeviceKeys.containsKey(TestUser.username)); expect(
assert(testClientB.userDeviceKeys[TestUser.username]!.deviceKeys testClientA.userDeviceKeys[TestUser.username2]!
.containsKey(testClientA.deviceID)); .deviceKeys[testClientB.deviceID!]!.blocked,
assert(!testClientB.userDeviceKeys[TestUser.username]! isFalse);
.deviceKeys[testClientA.deviceID!]!.verified); expect(testClientB.userDeviceKeys, contains(TestUser.username));
assert(!testClientB.userDeviceKeys[TestUser.username]! expect(testClientB.userDeviceKeys[TestUser.username]!.deviceKeys,
.deviceKeys[testClientA.deviceID!]!.blocked); contains(testClientA.deviceID));
expect(
testClientB.userDeviceKeys[TestUser.username]!
.deviceKeys[testClientA.deviceID!]!.verified,
isFalse);
expect(
testClientB.userDeviceKeys[TestUser.username]!
.deviceKeys[testClientA.deviceID!]!.blocked,
isFalse);
await Future.wait([ await Future.wait([
testClientA.updateUserDeviceKeys(), testClientA.updateUserDeviceKeys(),
testClientB.updateUserDeviceKeys(), testClientB.updateUserDeviceKeys(),
]); ]);
await testClientA await testClientA.userDeviceKeys[TestUser.username2]!
.userDeviceKeys[TestUser.username2]!.deviceKeys[testClientB.deviceID!]! .deviceKeys[testClientB.deviceID!]!
.setVerified(true); .setVerified(true);
Logs().i('++++ Check if own olm device is verified by default ++++'); Logs().i('++++ Check if own olm device is verified by default ++++');
assert(testClientA.userDeviceKeys.containsKey(TestUser.username)); expect(testClientA.userDeviceKeys, contains(TestUser.username));
assert(testClientA.userDeviceKeys[TestUser.username]!.deviceKeys expect(testClientA.userDeviceKeys[TestUser.username]!.deviceKeys,
.containsKey(testClientA.deviceID)); contains(testClientA.deviceID));
assert(testClientA.userDeviceKeys[TestUser.username]! expect(
.deviceKeys[testClientA.deviceID!]!.verified); testClientA.userDeviceKeys[TestUser.username]!
assert(testClientB.userDeviceKeys.containsKey(TestUser.username2)); .deviceKeys[testClientA.deviceID!]!.verified,
assert(testClientB.userDeviceKeys[TestUser.username2]!.deviceKeys isTrue);
.containsKey(testClientB.deviceID)); expect(testClientB.userDeviceKeys, contains(TestUser.username2));
assert(testClientB.userDeviceKeys[TestUser.username2]! expect(testClientB.userDeviceKeys[TestUser.username2]!.deviceKeys,
.deviceKeys[testClientB.deviceID!]!.verified); contains(testClientB.deviceID));
expect(
testClientB.userDeviceKeys[TestUser.username2]!
.deviceKeys[testClientB.deviceID!]!.verified,
isTrue);
Logs().i("++++ (Alice) Send encrypted message: '$testMessage' ++++"); Logs().i("++++ (Alice) Send encrypted message: '$testMessage' ++++");
await room.sendTextEvent(testMessage); await room.sendTextEvent(testMessage);
await Future.delayed(Duration(seconds: 5)); await Future.delayed(Duration(seconds: 5));
assert( expect(
room.client.encryption!.keyManager.getOutboundGroupSession(room.id) != room.client.encryption!.keyManager
null); .getOutboundGroupSession(room.id),
isNotNull);
var currentSessionIdA = room.client.encryption!.keyManager var currentSessionIdA = room.client.encryption!.keyManager
.getOutboundGroupSession(room.id)! .getOutboundGroupSession(room.id)!
.outboundGroupSession! .outboundGroupSession!
.session_id(); .session_id();
/*assert(room.client.encryption.keyManager /*expect(room.client.encryption.keyManager
.getInboundGroupSession(room.id, currentSessionIdA, '') != .getInboundGroupSession(room.id, currentSessionIdA, '') !=
null);*/ null);*/
assert(testClientA.encryption!.olmManager expect(
.olmSessions[testClientB.identityKey]!.length == testClientA.encryption!.olmManager
.olmSessions[testClientB.identityKey]!.length,
1); 1);
assert(testClientB.encryption!.olmManager expect(
.olmSessions[testClientA.identityKey]!.length == testClientB.encryption!.olmManager
.olmSessions[testClientA.identityKey]!.length,
1); 1);
assert(testClientA.encryption!.olmManager expect(
.olmSessions[testClientB.identityKey]!.first.sessionId == testClientA.encryption!.olmManager
testClientB.encryption!.olmManager.olmSessions[testClientA.identityKey]! .olmSessions[testClientB.identityKey]!.first.sessionId,
.first.sessionId); testClientB.encryption!.olmManager
/*assert(inviteRoom.client.encryption.keyManager .olmSessions[testClientA.identityKey]!.first.sessionId);
/*expect(inviteRoom.client.encryption.keyManager
.getInboundGroupSession(inviteRoom.id, currentSessionIdA, '') != .getInboundGroupSession(inviteRoom.id, currentSessionIdA, '') !=
null);*/ null);*/
assert(room.lastEvent!.body == testMessage); expect(room.lastEvent!.body, testMessage);
assert(inviteRoom.lastEvent!.body == testMessage); expect(inviteRoom.lastEvent!.body, testMessage);
Logs().i( Logs().i(
"++++ (Bob) Received decrypted message: '${inviteRoom.lastEvent!.body}' ++++"); "++++ (Bob) Received decrypted message: '${inviteRoom.lastEvent!.body}' ++++");
Logs().i("++++ (Alice) Send again encrypted message: '$testMessage2' ++++"); Logs().i(
"++++ (Alice) Send again encrypted message: '$testMessage2' ++++");
await room.sendTextEvent(testMessage2); await room.sendTextEvent(testMessage2);
await Future.delayed(Duration(seconds: 5)); await Future.delayed(Duration(seconds: 5));
assert(testClientA.encryption!.olmManager expect(
.olmSessions[testClientB.identityKey]!.length == testClientA.encryption!.olmManager
.olmSessions[testClientB.identityKey]!.length,
1); 1);
assert(testClientB.encryption!.olmManager expect(
.olmSessions[testClientA.identityKey]!.length == testClientB.encryption!.olmManager
.olmSessions[testClientA.identityKey]!.length,
1); 1);
assert(testClientA.encryption!.olmManager expect(
.olmSessions[testClientB.identityKey]!.first.sessionId == testClientA.encryption!.olmManager
testClientB.encryption!.olmManager.olmSessions[testClientA.identityKey]! .olmSessions[testClientB.identityKey]!.first.sessionId,
.first.sessionId); testClientB.encryption!.olmManager
.olmSessions[testClientA.identityKey]!.first.sessionId);
assert(room.client.encryption!.keyManager expect(
room.client.encryption!.keyManager
.getOutboundGroupSession(room.id)! .getOutboundGroupSession(room.id)!
.outboundGroupSession! .outboundGroupSession!
.session_id() == .session_id(),
currentSessionIdA); currentSessionIdA);
/*assert(room.client.encryption.keyManager /*expect(room.client.encryption.keyManager
.getInboundGroupSession(room.id, currentSessionIdA, '') != .getInboundGroupSession(room.id, currentSessionIdA, '') !=
null);*/ null);*/
assert(room.lastEvent!.body == testMessage2); expect(room.lastEvent!.body, testMessage2);
assert(inviteRoom.lastEvent!.body == testMessage2); expect(inviteRoom.lastEvent!.body, testMessage2);
Logs().i( Logs().i(
"++++ (Bob) Received decrypted message: '${inviteRoom.lastEvent!.body}' ++++"); "++++ (Bob) Received decrypted message: '${inviteRoom.lastEvent!.body}' ++++");
Logs().i("++++ (Bob) Send again encrypted message: '$testMessage3' ++++"); Logs().i(
"++++ (Bob) Send again encrypted message: '$testMessage3' ++++");
await inviteRoom.sendTextEvent(testMessage3); await inviteRoom.sendTextEvent(testMessage3);
await Future.delayed(Duration(seconds: 5)); await Future.delayed(Duration(seconds: 5));
assert(testClientA.encryption!.olmManager expect(
.olmSessions[testClientB.identityKey]!.length == testClientA.encryption!.olmManager
.olmSessions[testClientB.identityKey]!.length,
1); 1);
assert(testClientB.encryption!.olmManager expect(
.olmSessions[testClientA.identityKey]!.length == testClientB.encryption!.olmManager
.olmSessions[testClientA.identityKey]!.length,
1); 1);
assert(room.client.encryption!.keyManager expect(
room.client.encryption!.keyManager
.getOutboundGroupSession(room.id)! .getOutboundGroupSession(room.id)!
.outboundGroupSession! .outboundGroupSession!
.session_id() == .session_id(),
currentSessionIdA); currentSessionIdA);
final inviteRoomOutboundGroupSession = inviteRoom final inviteRoomOutboundGroupSession = inviteRoom
.client.encryption!.keyManager .client.encryption!.keyManager
.getOutboundGroupSession(inviteRoom.id)!; .getOutboundGroupSession(inviteRoom.id)!;
assert(inviteRoomOutboundGroupSession.isValid); expect(inviteRoomOutboundGroupSession.isValid, isTrue);
/*assert(inviteRoom.client.encryption.keyManager.getInboundGroupSession( /*expect(inviteRoom.client.encryption.keyManager.getInboundGroupSession(
inviteRoom.id, inviteRoom.id,
inviteRoomOutboundGroupSession.outboundGroupSession.session_id(), inviteRoomOutboundGroupSession.outboundGroupSession.session_id(),
'') != '') !=
null); null);
assert(room.client.encryption.keyManager.getInboundGroupSession( expect(room.client.encryption.keyManager.getInboundGroupSession(
room.id, room.id,
inviteRoomOutboundGroupSession.outboundGroupSession.session_id(), inviteRoomOutboundGroupSession.outboundGroupSession.session_id(),
'') != '') !=
null);*/ null);*/
assert(inviteRoom.lastEvent!.body == testMessage3); expect(inviteRoom.lastEvent!.body, testMessage3);
assert(room.lastEvent!.body == testMessage3); expect(room.lastEvent!.body, testMessage3);
Logs().i( Logs().i(
"++++ (Alice) Received decrypted message: '${room.lastEvent!.body}' ++++"); "++++ (Alice) Received decrypted message: '${room.lastEvent!.body}' ++++");
Logs().i('++++ Login Bob in another client ++++'); Logs().i('++++ Login Bob in another client ++++');
final testClientC = Client('TestClientC', databaseBuilder: getDatabase); final testClientC =
Client('TestClientC', databaseBuilder: getDatabase);
await testClientC.checkHomeserver(Uri.parse(TestUser.homeserver)); await testClientC.checkHomeserver(Uri.parse(TestUser.homeserver));
// Workaround: Logging in with displayname instead of mxid // We can't sign in using the displayname, since that breaks e2ee on dendrite: https://github.com/matrix-org/dendrite/issues/2914
await testClientC.login(LoginType.mLoginPassword, await testClientC.login(LoginType.mLoginPassword,
identifier: AuthenticationUserIdentifier(user: TestUser.displayname2), identifier: AuthenticationUserIdentifier(
user: TestUser.username2.localpart!),
password: TestUser.password2); password: TestUser.password2);
await Future.delayed(Duration(seconds: 3)); await Future.delayed(Duration(seconds: 3));
Logs().i("++++ (Alice) Send again encrypted message: '$testMessage4' ++++"); Logs().i(
"++++ (Alice) Send again encrypted message: '$testMessage4' ++++");
await room.sendTextEvent(testMessage4); await room.sendTextEvent(testMessage4);
await Future.delayed(Duration(seconds: 5)); await Future.delayed(Duration(seconds: 5));
assert(testClientA.encryption!.olmManager expect(
.olmSessions[testClientB.identityKey]!.length == testClientA.encryption!.olmManager
.olmSessions[testClientB.identityKey]!.length,
1); 1);
assert(testClientB.encryption!.olmManager expect(
.olmSessions[testClientA.identityKey]!.length == testClientB.encryption!.olmManager
.olmSessions[testClientA.identityKey]!.length,
1); 1);
assert(testClientA.encryption!.olmManager expect(
.olmSessions[testClientB.identityKey]!.first.sessionId == testClientA.encryption!.olmManager
testClientB.encryption!.olmManager.olmSessions[testClientA.identityKey]! .olmSessions[testClientB.identityKey]!.first.sessionId,
.first.sessionId); testClientB.encryption!.olmManager
assert(testClientA.encryption!.olmManager .olmSessions[testClientA.identityKey]!.first.sessionId);
.olmSessions[testClientC.identityKey]!.length == expect(
testClientA.encryption!.olmManager
.olmSessions[testClientC.identityKey]!.length,
1); 1);
assert(testClientC.encryption!.olmManager expect(
.olmSessions[testClientA.identityKey]!.length == testClientC.encryption!.olmManager
.olmSessions[testClientA.identityKey]!.length,
1); 1);
assert(testClientA.encryption!.olmManager expect(
.olmSessions[testClientC.identityKey]!.first.sessionId == testClientA.encryption!.olmManager
testClientC.encryption!.olmManager.olmSessions[testClientA.identityKey]! .olmSessions[testClientC.identityKey]!.first.sessionId,
.first.sessionId); testClientC.encryption!.olmManager
assert(room.client.encryption!.keyManager .olmSessions[testClientA.identityKey]!.first.sessionId);
expect(
room.client.encryption!.keyManager
.getOutboundGroupSession(room.id)! .getOutboundGroupSession(room.id)!
.outboundGroupSession! .outboundGroupSession!
.session_id() != .session_id(),
currentSessionIdA); currentSessionIdA);
currentSessionIdA = room.client.encryption!.keyManager /*expect(inviteRoom.client.encryption.keyManager
.getOutboundGroupSession(room.id)!
.outboundGroupSession!
.session_id();
/*assert(inviteRoom.client.encryption.keyManager
.getInboundGroupSession(inviteRoom.id, currentSessionIdA, '') != .getInboundGroupSession(inviteRoom.id, currentSessionIdA, '') !=
null);*/ null);*/
assert(room.lastEvent!.body == testMessage4); expect(room.lastEvent!.body, testMessage4);
assert(inviteRoom.lastEvent!.body == testMessage4); expect(inviteRoom.lastEvent!.body, testMessage4);
Logs().i( Logs().i(
"++++ (Bob) Received decrypted message: '${inviteRoom.lastEvent!.body}' ++++"); "++++ (Bob) Received decrypted message: '${inviteRoom.lastEvent!.body}' ++++");
Logs().i('++++ Logout Bob another client ++++'); Logs()
.i('++++ Logout Bob another client ${testClientC.deviceID} ++++');
await testClientC.dispose(closeDatabase: false); await testClientC.dispose(closeDatabase: false);
await testClientC.logout(); await testClientC.logout();
await Future.delayed(Duration(seconds: 5)); await Future.delayed(Duration(seconds: 5));
Logs().i("++++ (Alice) Send again encrypted message: '$testMessage6' ++++"); Logs().i(
"++++ (Alice) Send again encrypted message: '$testMessage6' ++++");
await room.sendTextEvent(testMessage6); await room.sendTextEvent(testMessage6);
await Future.delayed(Duration(seconds: 5)); await Future.delayed(Duration(seconds: 5));
assert(testClientA.encryption!.olmManager expect(
.olmSessions[testClientB.identityKey]!.length == testClientA.encryption!.olmManager
.olmSessions[testClientB.identityKey]!.length,
1); 1);
assert(testClientB.encryption!.olmManager expect(
.olmSessions[testClientA.identityKey]!.length == testClientB.encryption!.olmManager
.olmSessions[testClientA.identityKey]!.length,
1); 1);
assert(testClientA.encryption!.olmManager expect(
.olmSessions[testClientB.identityKey]!.first.sessionId == testClientA.encryption!.olmManager
testClientB.encryption!.olmManager.olmSessions[testClientA.identityKey]! .olmSessions[testClientB.identityKey]!.first.sessionId,
.first.sessionId); testClientB.encryption!.olmManager
assert(room.client.encryption!.keyManager .olmSessions[testClientA.identityKey]!.first.sessionId);
// This does not work on conduit because of a server bug: https://gitlab.com/famedly/conduit/-/issues/325
if (Platform.environment['HOMESERVER'] != 'conduit') {
expect(
room.client.encryption!.keyManager
.getOutboundGroupSession(room.id)! .getOutboundGroupSession(room.id)!
.outboundGroupSession! .outboundGroupSession!
.session_id() != .session_id(),
currentSessionIdA); isNot(currentSessionIdA));
}
currentSessionIdA = room.client.encryption!.keyManager currentSessionIdA = room.client.encryption!.keyManager
.getOutboundGroupSession(room.id)! .getOutboundGroupSession(room.id)!
.outboundGroupSession! .outboundGroupSession!
.session_id(); .session_id();
/*assert(inviteRoom.client.encryption.keyManager /*expect(inviteRoom.client.encryption.keyManager
.getInboundGroupSession(inviteRoom.id, currentSessionIdA, '') != .getInboundGroupSession(inviteRoom.id, currentSessionIdA, '') !=
null);*/ null);*/
assert(room.lastEvent!.body == testMessage6); expect(room.lastEvent!.body, testMessage6);
assert(inviteRoom.lastEvent!.body == testMessage6); expect(inviteRoom.lastEvent!.body, testMessage6);
Logs().i( Logs().i(
"++++ (Bob) Received decrypted message: '${inviteRoom.lastEvent!.body}' ++++"); "++++ (Bob) Received decrypted message: '${inviteRoom.lastEvent!.body}' ++++");
@ -351,4 +404,5 @@ void test() async {
testClientB = null; testClientB = null;
} }
return; return;
} });
}, timeout: Timeout(Duration(minutes: 6)));