pub mod v1 {
use std::collections::BTreeMap;
use ruma_common::{
OneTimeKeyAlgorithm, OwnedDeviceId, OwnedOneTimeKeyId, OwnedUserId,
api::{request, response},
encryption::OneTimeKey,
metadata,
serde::Raw,
};
use crate::authentication::ServerSignatures;
metadata! {
method: POST,
rate_limited: false,
authentication: ServerSignatures,
path: "/_matrix/federation/v1/user/keys/claim",
}
#[request]
pub struct Request {
pub one_time_keys: OneTimeKeyClaims,
}
#[response]
pub struct Response {
pub one_time_keys: OneTimeKeys,
}
impl Request {
pub fn new(one_time_keys: OneTimeKeyClaims) -> Self {
Self { one_time_keys }
}
}
impl Response {
pub fn new(one_time_keys: OneTimeKeys) -> Self {
Self { one_time_keys }
}
}
pub type OneTimeKeyClaims = BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, OneTimeKeyAlgorithm>>;
pub type OneTimeKeys = BTreeMap<
OwnedUserId,
BTreeMap<OwnedDeviceId, BTreeMap<OwnedOneTimeKeyId, Raw<OneTimeKey>>>,
>;
}