getOlmSessionsForDevicesFromDatabase method

Future<void> getOlmSessionsForDevicesFromDatabase(
  1. List<String> senderKeys
)

Implementation

Future<void> getOlmSessionsForDevicesFromDatabase(
  List<String> senderKeys,
) async {
  final rows = await encryption.olmDatabase?.getOlmSessionsForDevices(
    senderKeys,
    client.userID!,
  );
  final res = <String, List<OlmSession>>{};
  for (final sess in rows ?? []) {
    res[sess.identityKey] ??= <OlmSession>[];
    if (sess.isValid) {
      res[sess.identityKey]!.add(sess);
    }
  }
  for (final entry in res.entries) {
    _olmSessions[entry.key] = entry.value;
  }
}