2021-07-14 07:07:08 +00:00
|
|
|
use crate::{database::DatabaseGuard, ConduitResult, Error, Ruma};
|
2020-07-30 16:14:47 +00:00
|
|
|
use ruma::api::client::{
|
|
|
|
error::ErrorKind,
|
|
|
|
r0::backup::{
|
2020-08-27 12:48:20 +00:00
|
|
|
add_backup_key_session, add_backup_key_sessions, add_backup_keys, create_backup,
|
|
|
|
delete_backup, delete_backup_key_session, delete_backup_key_sessions, delete_backup_keys,
|
|
|
|
get_backup, get_backup_key_session, get_backup_key_sessions, get_backup_keys,
|
|
|
|
get_latest_backup, update_backup,
|
2020-07-30 16:14:47 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
#[cfg(feature = "conduit_bin")]
|
2020-08-27 12:48:20 +00:00
|
|
|
use rocket::{delete, get, post, put};
|
2020-07-30 16:14:47 +00:00
|
|
|
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
post("/_matrix/client/unstable/room_keys/version", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn create_backup_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-07-30 16:14:47 +00:00
|
|
|
body: Ruma<create_backup::Request>,
|
|
|
|
) -> ConduitResult<create_backup::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-07-30 16:14:47 +00:00
|
|
|
let version = db
|
|
|
|
.key_backups
|
2020-10-18 18:33:12 +00:00
|
|
|
.create_backup(&sender_user, &body.algorithm, &db.globals)?;
|
2020-07-30 16:14:47 +00:00
|
|
|
|
2021-08-02 08:13:34 +00:00
|
|
|
db.flush()?;
|
2020-10-21 19:28:02 +00:00
|
|
|
|
2020-07-30 16:14:47 +00:00
|
|
|
Ok(create_backup::Response { version }.into())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
put("/_matrix/client/unstable/room_keys/version/<_>", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn update_backup_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-09-08 15:32:03 +00:00
|
|
|
body: Ruma<update_backup::Request<'_>>,
|
2020-07-30 16:14:47 +00:00
|
|
|
) -> ConduitResult<update_backup::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-07-30 16:14:47 +00:00
|
|
|
db.key_backups
|
2020-10-18 18:33:12 +00:00
|
|
|
.update_backup(&sender_user, &body.version, &body.algorithm, &db.globals)?;
|
2020-07-30 16:14:47 +00:00
|
|
|
|
2021-08-02 08:13:34 +00:00
|
|
|
db.flush()?;
|
2020-10-21 19:28:02 +00:00
|
|
|
|
2021-07-15 21:17:58 +00:00
|
|
|
Ok(update_backup::Response {}.into())
|
2020-07-30 16:14:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
get("/_matrix/client/unstable/room_keys/version", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn get_latest_backup_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-07-30 16:14:47 +00:00
|
|
|
body: Ruma<get_latest_backup::Request>,
|
|
|
|
) -> ConduitResult<get_latest_backup::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-07-30 16:14:47 +00:00
|
|
|
|
|
|
|
let (version, algorithm) =
|
|
|
|
db.key_backups
|
2020-10-18 18:33:12 +00:00
|
|
|
.get_latest_backup(&sender_user)?
|
2020-07-30 16:14:47 +00:00
|
|
|
.ok_or(Error::BadRequest(
|
|
|
|
ErrorKind::NotFound,
|
|
|
|
"Key backup does not exist.",
|
|
|
|
))?;
|
|
|
|
|
|
|
|
Ok(get_latest_backup::Response {
|
|
|
|
algorithm,
|
2020-10-18 18:33:12 +00:00
|
|
|
count: (db.key_backups.count_keys(sender_user, &version)? as u32).into(),
|
|
|
|
etag: db.key_backups.get_etag(sender_user, &version)?,
|
2020-07-30 16:14:47 +00:00
|
|
|
version,
|
|
|
|
}
|
|
|
|
.into())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
get("/_matrix/client/unstable/room_keys/version/<_>", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn get_backup_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-09-08 15:32:03 +00:00
|
|
|
body: Ruma<get_backup::Request<'_>>,
|
2020-07-30 16:14:47 +00:00
|
|
|
) -> ConduitResult<get_backup::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-07-30 16:14:47 +00:00
|
|
|
let algorithm = db
|
|
|
|
.key_backups
|
2020-10-18 18:33:12 +00:00
|
|
|
.get_backup(&sender_user, &body.version)?
|
2020-07-30 16:14:47 +00:00
|
|
|
.ok_or(Error::BadRequest(
|
|
|
|
ErrorKind::NotFound,
|
|
|
|
"Key backup does not exist.",
|
|
|
|
))?;
|
|
|
|
|
|
|
|
Ok(get_backup::Response {
|
|
|
|
algorithm,
|
2020-10-18 18:33:12 +00:00
|
|
|
count: (db.key_backups.count_keys(sender_user, &body.version)? as u32).into(),
|
|
|
|
etag: db.key_backups.get_etag(sender_user, &body.version)?,
|
2020-09-08 15:32:03 +00:00
|
|
|
version: body.version.to_owned(),
|
2020-07-30 16:14:47 +00:00
|
|
|
}
|
|
|
|
.into())
|
|
|
|
}
|
|
|
|
|
2020-08-27 12:48:20 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
delete("/_matrix/client/unstable/room_keys/version/<_>", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn delete_backup_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-10-27 23:10:09 +00:00
|
|
|
body: Ruma<delete_backup::Request<'_>>,
|
2020-08-27 12:48:20 +00:00
|
|
|
) -> ConduitResult<delete_backup::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-08-27 12:48:20 +00:00
|
|
|
|
2020-10-18 18:33:12 +00:00
|
|
|
db.key_backups.delete_backup(&sender_user, &body.version)?;
|
2020-08-27 12:48:20 +00:00
|
|
|
|
2021-08-02 08:13:34 +00:00
|
|
|
db.flush()?;
|
2020-10-21 19:28:02 +00:00
|
|
|
|
2021-07-15 21:17:58 +00:00
|
|
|
Ok(delete_backup::Response {}.into())
|
2020-08-27 12:48:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Add the received backup keys to the database.
|
2020-07-30 16:14:47 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
put("/_matrix/client/unstable/room_keys/keys", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn add_backup_keys_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-09-08 15:32:03 +00:00
|
|
|
body: Ruma<add_backup_keys::Request<'_>>,
|
2020-07-30 16:14:47 +00:00
|
|
|
) -> ConduitResult<add_backup_keys::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-07-30 16:14:47 +00:00
|
|
|
|
|
|
|
for (room_id, room) in &body.rooms {
|
|
|
|
for (session_id, key_data) in &room.sessions {
|
|
|
|
db.key_backups.add_key(
|
2020-10-18 18:33:12 +00:00
|
|
|
&sender_user,
|
2020-07-30 16:14:47 +00:00
|
|
|
&body.version,
|
|
|
|
&room_id,
|
|
|
|
&session_id,
|
|
|
|
&key_data,
|
|
|
|
&db.globals,
|
|
|
|
)?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-02 08:13:34 +00:00
|
|
|
db.flush()?;
|
2020-10-21 19:28:02 +00:00
|
|
|
|
2020-07-30 16:14:47 +00:00
|
|
|
Ok(add_backup_keys::Response {
|
2020-10-18 18:33:12 +00:00
|
|
|
count: (db.key_backups.count_keys(sender_user, &body.version)? as u32).into(),
|
|
|
|
etag: db.key_backups.get_etag(sender_user, &body.version)?,
|
2020-07-30 16:14:47 +00:00
|
|
|
}
|
|
|
|
.into())
|
|
|
|
}
|
|
|
|
|
2020-08-27 12:48:20 +00:00
|
|
|
/// Add the received backup keys to the database.
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
put("/_matrix/client/unstable/room_keys/keys/<_>", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn add_backup_key_sessions_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-10-27 23:10:09 +00:00
|
|
|
body: Ruma<add_backup_key_sessions::Request<'_>>,
|
2020-08-27 12:48:20 +00:00
|
|
|
) -> ConduitResult<add_backup_key_sessions::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-08-27 12:48:20 +00:00
|
|
|
|
|
|
|
for (session_id, key_data) in &body.sessions {
|
|
|
|
db.key_backups.add_key(
|
2020-10-18 18:33:12 +00:00
|
|
|
&sender_user,
|
2020-08-27 12:48:20 +00:00
|
|
|
&body.version,
|
|
|
|
&body.room_id,
|
|
|
|
&session_id,
|
|
|
|
&key_data,
|
|
|
|
&db.globals,
|
|
|
|
)?
|
|
|
|
}
|
|
|
|
|
2021-08-02 08:13:34 +00:00
|
|
|
db.flush()?;
|
2020-10-21 19:28:02 +00:00
|
|
|
|
2020-08-27 12:48:20 +00:00
|
|
|
Ok(add_backup_key_sessions::Response {
|
2020-10-18 18:33:12 +00:00
|
|
|
count: (db.key_backups.count_keys(sender_user, &body.version)? as u32).into(),
|
|
|
|
etag: db.key_backups.get_etag(sender_user, &body.version)?,
|
2020-08-27 12:48:20 +00:00
|
|
|
}
|
|
|
|
.into())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Add the received backup key to the database.
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
put("/_matrix/client/unstable/room_keys/keys/<_>/<_>", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn add_backup_key_session_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-10-27 23:10:09 +00:00
|
|
|
body: Ruma<add_backup_key_session::Request<'_>>,
|
2020-08-27 12:48:20 +00:00
|
|
|
) -> ConduitResult<add_backup_key_session::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-08-27 12:48:20 +00:00
|
|
|
|
|
|
|
db.key_backups.add_key(
|
2020-10-18 18:33:12 +00:00
|
|
|
&sender_user,
|
2020-08-27 12:48:20 +00:00
|
|
|
&body.version,
|
|
|
|
&body.room_id,
|
|
|
|
&body.session_id,
|
|
|
|
&body.session_data,
|
|
|
|
&db.globals,
|
|
|
|
)?;
|
|
|
|
|
2021-08-02 08:13:34 +00:00
|
|
|
db.flush()?;
|
2020-10-21 19:28:02 +00:00
|
|
|
|
2020-08-27 12:48:20 +00:00
|
|
|
Ok(add_backup_key_session::Response {
|
2020-10-18 18:33:12 +00:00
|
|
|
count: (db.key_backups.count_keys(sender_user, &body.version)? as u32).into(),
|
|
|
|
etag: db.key_backups.get_etag(sender_user, &body.version)?,
|
2020-08-27 12:48:20 +00:00
|
|
|
}
|
|
|
|
.into())
|
|
|
|
}
|
|
|
|
|
2020-07-30 16:14:47 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
get("/_matrix/client/unstable/room_keys/keys", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn get_backup_keys_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-09-08 15:32:03 +00:00
|
|
|
body: Ruma<get_backup_keys::Request<'_>>,
|
2020-07-30 16:14:47 +00:00
|
|
|
) -> ConduitResult<get_backup_keys::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-07-30 16:14:47 +00:00
|
|
|
|
2020-10-18 18:33:12 +00:00
|
|
|
let rooms = db.key_backups.get_all(&sender_user, &body.version)?;
|
2020-07-30 16:14:47 +00:00
|
|
|
|
|
|
|
Ok(get_backup_keys::Response { rooms }.into())
|
|
|
|
}
|
2020-08-27 12:48:20 +00:00
|
|
|
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
get("/_matrix/client/unstable/room_keys/keys/<_>", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn get_backup_key_sessions_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-10-27 23:10:09 +00:00
|
|
|
body: Ruma<get_backup_key_sessions::Request<'_>>,
|
2020-08-27 12:48:20 +00:00
|
|
|
) -> ConduitResult<get_backup_key_sessions::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-08-27 12:48:20 +00:00
|
|
|
|
|
|
|
let sessions = db
|
|
|
|
.key_backups
|
2021-06-08 16:10:00 +00:00
|
|
|
.get_room(&sender_user, &body.version, &body.room_id)?;
|
2020-08-27 12:48:20 +00:00
|
|
|
|
|
|
|
Ok(get_backup_key_sessions::Response { sessions }.into())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
get("/_matrix/client/unstable/room_keys/keys/<_>/<_>", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn get_backup_key_session_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-10-27 23:10:09 +00:00
|
|
|
body: Ruma<get_backup_key_session::Request<'_>>,
|
2020-08-27 12:48:20 +00:00
|
|
|
) -> ConduitResult<get_backup_key_session::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-08-27 12:48:20 +00:00
|
|
|
|
2020-10-27 23:10:09 +00:00
|
|
|
let key_data = db
|
|
|
|
.key_backups
|
|
|
|
.get_session(&sender_user, &body.version, &body.room_id, &body.session_id)?
|
2021-03-24 10:52:10 +00:00
|
|
|
.ok_or(Error::BadRequest(
|
|
|
|
ErrorKind::NotFound,
|
|
|
|
"Backup key not found for this user's session.",
|
|
|
|
))?;
|
2020-08-27 12:48:20 +00:00
|
|
|
|
|
|
|
Ok(get_backup_key_session::Response { key_data }.into())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
delete("/_matrix/client/unstable/room_keys/keys", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn delete_backup_keys_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-10-27 23:10:09 +00:00
|
|
|
body: Ruma<delete_backup_keys::Request<'_>>,
|
2020-08-27 12:48:20 +00:00
|
|
|
) -> ConduitResult<delete_backup_keys::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-08-27 12:48:20 +00:00
|
|
|
|
2020-10-18 18:33:12 +00:00
|
|
|
db.key_backups
|
|
|
|
.delete_all_keys(&sender_user, &body.version)?;
|
2020-08-27 12:48:20 +00:00
|
|
|
|
2021-08-02 08:13:34 +00:00
|
|
|
db.flush()?;
|
2020-10-21 19:28:02 +00:00
|
|
|
|
2020-08-27 12:48:20 +00:00
|
|
|
Ok(delete_backup_keys::Response {
|
2020-10-18 18:33:12 +00:00
|
|
|
count: (db.key_backups.count_keys(sender_user, &body.version)? as u32).into(),
|
|
|
|
etag: db.key_backups.get_etag(sender_user, &body.version)?,
|
2020-08-27 12:48:20 +00:00
|
|
|
}
|
|
|
|
.into())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
delete("/_matrix/client/unstable/room_keys/keys/<_>", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn delete_backup_key_sessions_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-10-27 23:10:09 +00:00
|
|
|
body: Ruma<delete_backup_key_sessions::Request<'_>>,
|
2020-08-27 12:48:20 +00:00
|
|
|
) -> ConduitResult<delete_backup_key_sessions::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-08-27 12:48:20 +00:00
|
|
|
|
|
|
|
db.key_backups
|
2020-10-18 18:33:12 +00:00
|
|
|
.delete_room_keys(&sender_user, &body.version, &body.room_id)?;
|
2020-08-27 12:48:20 +00:00
|
|
|
|
2021-08-02 08:13:34 +00:00
|
|
|
db.flush()?;
|
2020-10-21 19:28:02 +00:00
|
|
|
|
2020-08-27 12:48:20 +00:00
|
|
|
Ok(delete_backup_key_sessions::Response {
|
2020-10-18 18:33:12 +00:00
|
|
|
count: (db.key_backups.count_keys(sender_user, &body.version)? as u32).into(),
|
|
|
|
etag: db.key_backups.get_etag(sender_user, &body.version)?,
|
2020-08-27 12:48:20 +00:00
|
|
|
}
|
|
|
|
.into())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "conduit_bin",
|
|
|
|
delete("/_matrix/client/unstable/room_keys/keys/<_>/<_>", data = "<body>")
|
|
|
|
)]
|
2021-02-28 11:41:03 +00:00
|
|
|
#[tracing::instrument(skip(db, body))]
|
2020-10-21 19:28:02 +00:00
|
|
|
pub async fn delete_backup_key_session_route(
|
2021-07-14 07:07:08 +00:00
|
|
|
db: DatabaseGuard,
|
2020-10-27 23:10:09 +00:00
|
|
|
body: Ruma<delete_backup_key_session::Request<'_>>,
|
2020-08-27 12:48:20 +00:00
|
|
|
) -> ConduitResult<delete_backup_key_session::Response> {
|
2020-10-18 18:33:12 +00:00
|
|
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
2020-08-27 12:48:20 +00:00
|
|
|
|
|
|
|
db.key_backups
|
2020-10-18 18:33:12 +00:00
|
|
|
.delete_room_key(&sender_user, &body.version, &body.room_id, &body.session_id)?;
|
2020-08-27 12:48:20 +00:00
|
|
|
|
2021-08-02 08:13:34 +00:00
|
|
|
db.flush()?;
|
2020-10-21 19:28:02 +00:00
|
|
|
|
2020-08-27 12:48:20 +00:00
|
|
|
Ok(delete_backup_key_session::Response {
|
2020-10-18 18:33:12 +00:00
|
|
|
count: (db.key_backups.count_keys(sender_user, &body.version)? as u32).into(),
|
|
|
|
etag: db.key_backups.get_etag(sender_user, &body.version)?,
|
2020-08-27 12:48:20 +00:00
|
|
|
}
|
|
|
|
.into())
|
|
|
|
}
|