getRoomKeys method

Future<RoomKeys> getRoomKeys(
  1. String version
)
inherited

Retrieve the keys from the backup.

version The backup from which to retrieve the keys.

Implementation

Future<RoomKeys> getRoomKeys(String version) async {
  final requestUri =
      Uri(path: '_api/client/v3/room_keys/keys', queryParameters: {
    'version': version,
  });
  final request = Request('GET', baseUri!.resolveUri(requestUri));
  request.headers['authorization'] = 'Bearer ${bearerToken!}';
  final response = await httpClient.send(request);
  final responseBody = await response.stream.toBytes();
  if (response.statusCode != 200) unexpectedResponse(response, responseBody);
  final responseString = utf8.decode(responseBody);
  final json = jsonDecode(responseString);
  return RoomKeys.fromJson(json as Map<String, Object?>);
}