requestKeys method

void requestKeys({
  1. bool tryOnlineBackup = true,
  2. bool onlineKeyBackupOnly = true,
})

Request the keys for undecryptable events of this timeline

Implementation

void requestKeys({
  bool tryOnlineBackup = true,
  bool onlineKeyBackupOnly = true,
}) {
  for (final event in events) {
    if (event.type == EventTypes.Encrypted &&
        event.messageType == MessageTypes.BadEncrypted &&
        event.content['can_request_session'] == true) {
      final sessionId = event.content.tryGet<String>('session_id');
      final senderKey = event.content.tryGet<String>('sender_key');
      if (sessionId != null && senderKey != null) {
        room.client.encryption?.keyManager.maybeAutoRequest(
          room.id,
          sessionId,
          senderKey,
          tryOnlineBackup: tryOnlineBackup,
          onlineKeyBackupOnly: onlineKeyBackupOnly,
        );
      }
    }
  }
}