Use DeviceIdBox in ruma-events, ruma-*-api
This commit is contained in:
parent
f210f91611
commit
4a1b6d5607
@ -1,7 +1,7 @@
|
|||||||
//! [POST /_matrix/client/r0/register](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-register)
|
//! [POST /_matrix/client/r0/register](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-register)
|
||||||
|
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_identifiers::{DeviceId, UserId};
|
use ruma_identifiers::{DeviceId, DeviceIdBox, UserId};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::r0::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
use crate::r0::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
||||||
@ -78,7 +78,7 @@ ruma_api! {
|
|||||||
/// ID of the registered device.
|
/// ID of the registered device.
|
||||||
///
|
///
|
||||||
/// Will be the same as the corresponding parameter in the request, if one was specified.
|
/// Will be the same as the corresponding parameter in the request, if one was specified.
|
||||||
pub device_id: Option<Box<DeviceId>>,
|
pub device_id: Option<DeviceIdBox>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: UiaaResponse
|
error: UiaaResponse
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use ruma_identifiers::DeviceId;
|
use ruma_identifiers::DeviceIdBox;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub mod delete_device;
|
pub mod delete_device;
|
||||||
@ -15,7 +15,7 @@ pub mod update_device;
|
|||||||
#[derive(Clone, Debug, Deserialize, Hash, PartialEq, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Hash, PartialEq, Serialize)]
|
||||||
pub struct Device {
|
pub struct Device {
|
||||||
/// Device ID
|
/// Device ID
|
||||||
pub device_id: Box<DeviceId>,
|
pub device_id: DeviceIdBox,
|
||||||
|
|
||||||
/// Public display name of the device.
|
/// Public display name of the device.
|
||||||
pub display_name: Option<String>,
|
pub display_name: Option<String>,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! [POST /_matrix/client/r0/delete_devices](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-delete-devices)
|
//! [POST /_matrix/client/r0/delete_devices](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-delete-devices)
|
||||||
|
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_identifiers::DeviceId;
|
use ruma_identifiers::DeviceIdBox;
|
||||||
|
|
||||||
use crate::r0::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
use crate::r0::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ ruma_api! {
|
|||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// List of devices to delete.
|
/// List of devices to delete.
|
||||||
pub devices: &'a [Box<DeviceId>],
|
pub devices: &'a [DeviceIdBox],
|
||||||
|
|
||||||
/// Additional authentication information for the user-interactive authentication API.
|
/// Additional authentication information for the user-interactive authentication API.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -17,7 +17,7 @@ ruma_api! {
|
|||||||
request: {
|
request: {
|
||||||
/// The device to retrieve.
|
/// The device to retrieve.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub device_id: Box<DeviceId>,
|
pub device_id: &'a DeviceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
|
@ -16,7 +16,7 @@ ruma_api! {
|
|||||||
request: {
|
request: {
|
||||||
/// The device to update.
|
/// The device to update.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub device_id: Box<DeviceId>,
|
pub device_id: &'a DeviceId,
|
||||||
|
|
||||||
/// The new display name for this device. If this is `None`, the display name won't be
|
/// The new display name for this device. If this is `None`, the display name won't be
|
||||||
/// changed.
|
/// changed.
|
||||||
|
@ -5,7 +5,7 @@ use std::collections::BTreeMap;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_identifiers::{DeviceId, DeviceKeyAlgorithm, DeviceKeyId, UserId};
|
use ruma_identifiers::{DeviceIdBox, DeviceKeyAlgorithm, DeviceKeyId, UserId};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
use super::OneTimeKey;
|
use super::OneTimeKey;
|
||||||
@ -31,7 +31,7 @@ ruma_api! {
|
|||||||
pub timeout: Option<Duration>,
|
pub timeout: Option<Duration>,
|
||||||
|
|
||||||
/// The keys to be claimed.
|
/// The keys to be claimed.
|
||||||
pub one_time_keys: BTreeMap<UserId, BTreeMap<Box<DeviceId>, DeviceKeyAlgorithm>>,
|
pub one_time_keys: BTreeMap<UserId, BTreeMap<DeviceIdBox, DeviceKeyAlgorithm>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
@ -47,4 +47,4 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The one-time keys for a given device.
|
/// The one-time keys for a given device.
|
||||||
pub type OneTimeKeys = BTreeMap<Box<DeviceId>, BTreeMap<DeviceKeyId, OneTimeKey>>;
|
pub type OneTimeKeys = BTreeMap<DeviceIdBox, BTreeMap<DeviceKeyId, OneTimeKey>>;
|
||||||
|
@ -4,7 +4,7 @@ use std::{collections::BTreeMap, time::Duration};
|
|||||||
|
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_common::encryption::DeviceKeys;
|
use ruma_common::encryption::DeviceKeys;
|
||||||
use ruma_identifiers::{DeviceId, UserId};
|
use ruma_identifiers::{DeviceIdBox, UserId};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
@ -32,7 +32,7 @@ ruma_api! {
|
|||||||
|
|
||||||
/// The keys to be downloaded. An empty list indicates all devices for
|
/// The keys to be downloaded. An empty list indicates all devices for
|
||||||
/// the corresponding user.
|
/// the corresponding user.
|
||||||
pub device_keys: BTreeMap<UserId, Vec<Box<DeviceId>>>,
|
pub device_keys: BTreeMap<UserId, Vec<DeviceIdBox>>,
|
||||||
|
|
||||||
/// If the client is fetching keys as a result of a device update
|
/// If the client is fetching keys as a result of a device update
|
||||||
/// received in a sync request, this should be the 'since' token of that
|
/// received in a sync request, this should be the 'since' token of that
|
||||||
@ -52,7 +52,7 @@ ruma_api! {
|
|||||||
|
|
||||||
/// Information on the queried devices.
|
/// Information on the queried devices.
|
||||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||||
pub device_keys: BTreeMap<UserId, BTreeMap<Box<DeviceId>, DeviceKeys>>,
|
pub device_keys: BTreeMap<UserId, BTreeMap<DeviceIdBox, DeviceKeys>>,
|
||||||
|
|
||||||
/// Information on the master cross-signing keys of the queried users.
|
/// Information on the master cross-signing keys of the queried users.
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_common::thirdparty::Medium;
|
use ruma_common::thirdparty::Medium;
|
||||||
use ruma_identifiers::{DeviceId, ServerName, UserId};
|
use ruma_identifiers::{DeviceIdBox, ServerName, UserId};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
ruma_api! {
|
ruma_api! {
|
||||||
@ -26,7 +26,7 @@ ruma_api! {
|
|||||||
|
|
||||||
/// ID of the client device
|
/// ID of the client device
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub device_id: Option<Box<DeviceId>>,
|
pub device_id: Option<DeviceIdBox>,
|
||||||
|
|
||||||
/// A display name to assign to the newly-created device. Ignored if device_id corresponds
|
/// A display name to assign to the newly-created device. Ignored if device_id corresponds
|
||||||
/// to a known device.
|
/// to a known device.
|
||||||
@ -52,7 +52,7 @@ ruma_api! {
|
|||||||
///
|
///
|
||||||
/// Will be the same as the corresponding parameter in the request, if one was
|
/// Will be the same as the corresponding parameter in the request, if one was
|
||||||
/// specified.
|
/// specified.
|
||||||
pub device_id: Box<DeviceId>,
|
pub device_id: DeviceIdBox,
|
||||||
|
|
||||||
/// Client configuration provided by the server.
|
/// Client configuration provided by the server.
|
||||||
///
|
///
|
||||||
|
@ -5,7 +5,7 @@ use std::{
|
|||||||
fmt::{Display, Formatter, Result as FmtResult},
|
fmt::{Display, Formatter, Result as FmtResult},
|
||||||
};
|
};
|
||||||
|
|
||||||
use ruma_identifiers::DeviceId;
|
use ruma_identifiers::DeviceIdBox;
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{self, Unexpected},
|
de::{self, Unexpected},
|
||||||
Deserialize, Deserializer, Serialize, Serializer,
|
Deserialize, Deserializer, Serialize, Serializer,
|
||||||
@ -17,7 +17,7 @@ pub mod send_event_to_device;
|
|||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub enum DeviceIdOrAllDevices {
|
pub enum DeviceIdOrAllDevices {
|
||||||
/// Represents a device Id for one of a user's devices.
|
/// Represents a device Id for one of a user's devices.
|
||||||
DeviceId(Box<DeviceId>),
|
DeviceId(DeviceIdBox),
|
||||||
|
|
||||||
/// Represents all devices for a user.
|
/// Represents all devices for a user.
|
||||||
AllDevices,
|
AllDevices,
|
||||||
|
@ -117,7 +117,7 @@ use ruma_api::OutgoingRequest;
|
|||||||
use ruma_client_api::r0::sync::sync_events::{
|
use ruma_client_api::r0::sync::sync_events::{
|
||||||
Filter as SyncFilter, Request as SyncRequest, Response as SyncResponse,
|
Filter as SyncFilter, Request as SyncRequest, Response as SyncResponse,
|
||||||
};
|
};
|
||||||
use ruma_identifiers::DeviceId;
|
use ruma_identifiers::DeviceIdBox;
|
||||||
use ruma_serde::urlencoded;
|
use ruma_serde::urlencoded;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ where
|
|||||||
&self,
|
&self,
|
||||||
user: String,
|
user: String,
|
||||||
password: String,
|
password: String,
|
||||||
device_id: Option<Box<DeviceId>>,
|
device_id: Option<DeviceIdBox>,
|
||||||
initial_device_display_name: Option<String>,
|
initial_device_display_name: Option<String>,
|
||||||
) -> Result<Session, Error<ruma_client_api::Error>> {
|
) -> Result<Session, Error<ruma_client_api::Error>> {
|
||||||
use ruma_client_api::r0::session::login;
|
use ruma_client_api::r0::session::login;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! User sessions.
|
//! User sessions.
|
||||||
|
|
||||||
use ruma_identifiers::{DeviceId, UserId};
|
use ruma_identifiers::{DeviceId, DeviceIdBox, UserId};
|
||||||
|
|
||||||
/// A user session, containing an access token and information about the associated user account.
|
/// A user session, containing an access token and information about the associated user account.
|
||||||
#[derive(Clone, Debug, serde::Deserialize, Eq, Hash, PartialEq, serde::Serialize)]
|
#[derive(Clone, Debug, serde::Deserialize, Eq, Hash, PartialEq, serde::Serialize)]
|
||||||
@ -18,13 +18,13 @@ pub struct Identification {
|
|||||||
/// The user the access token was issued for.
|
/// The user the access token was issued for.
|
||||||
pub user_id: UserId,
|
pub user_id: UserId,
|
||||||
/// The ID of the client device
|
/// The ID of the client device
|
||||||
pub device_id: Box<DeviceId>,
|
pub device_id: DeviceIdBox,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Session {
|
impl Session {
|
||||||
/// Create a new user session from an access token and a user ID.
|
/// Create a new user session from an access token and a user ID.
|
||||||
#[deprecated]
|
#[deprecated]
|
||||||
pub fn new(access_token: String, user_id: UserId, device_id: Box<DeviceId>) -> Self {
|
pub fn new(access_token: String, user_id: UserId, device_id: DeviceIdBox) -> Self {
|
||||||
Self { access_token, identification: Some(Identification { user_id, device_id }) }
|
Self { access_token, identification: Some(Identification { user_id, device_id }) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma_identifiers::{DeviceId, DeviceKeyId, EventEncryptionAlgorithm, UserId};
|
use ruma_identifiers::{DeviceIdBox, DeviceKeyId, EventEncryptionAlgorithm, UserId};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Identity keys for a device.
|
/// Identity keys for a device.
|
||||||
@ -14,7 +14,7 @@ pub struct DeviceKeys {
|
|||||||
pub user_id: UserId,
|
pub user_id: UserId,
|
||||||
|
|
||||||
/// The ID of the device these keys belong to. Must match the device ID used when logging in.
|
/// The ID of the device these keys belong to. Must match the device ID used when logging in.
|
||||||
pub device_id: Box<DeviceId>,
|
pub device_id: DeviceIdBox,
|
||||||
|
|
||||||
/// The encryption algorithms supported by this device.
|
/// The encryption algorithms supported by this device.
|
||||||
pub algorithms: Vec<EventEncryptionAlgorithm>,
|
pub algorithms: Vec<EventEncryptionAlgorithm>,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use ruma_events_macros::BasicEventContent;
|
use ruma_events_macros::BasicEventContent;
|
||||||
use ruma_identifiers::DeviceId;
|
use ruma_identifiers::DeviceIdBox;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::VerificationMethod;
|
use super::VerificationMethod;
|
||||||
@ -19,7 +19,7 @@ pub type RequestEvent = BasicEvent<RequestEventContent>;
|
|||||||
#[ruma_event(type = "m.key.verification.request")]
|
#[ruma_event(type = "m.key.verification.request")]
|
||||||
pub struct RequestEventContent {
|
pub struct RequestEventContent {
|
||||||
/// The device ID which is initiating the request.
|
/// The device ID which is initiating the request.
|
||||||
pub from_device: Box<DeviceId>,
|
pub from_device: DeviceIdBox,
|
||||||
|
|
||||||
/// An opaque identifier for the verification request.
|
/// An opaque identifier for the verification request.
|
||||||
///
|
///
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use std::{collections::BTreeMap, convert::TryFrom};
|
use std::{collections::BTreeMap, convert::TryFrom};
|
||||||
|
|
||||||
use ruma_events_macros::BasicEventContent;
|
use ruma_events_macros::BasicEventContent;
|
||||||
use ruma_identifiers::DeviceId;
|
use ruma_identifiers::DeviceIdBox;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ pub type StartEvent = BasicEvent<StartEventContent>;
|
|||||||
#[ruma_event(type = "m.key.verification.start")]
|
#[ruma_event(type = "m.key.verification.start")]
|
||||||
pub struct StartEventContent {
|
pub struct StartEventContent {
|
||||||
/// The device ID which is initiating the process.
|
/// The device ID which is initiating the process.
|
||||||
pub from_device: Box<DeviceId>,
|
pub from_device: DeviceIdBox,
|
||||||
|
|
||||||
/// An opaque identifier for the verification process.
|
/// An opaque identifier for the verification process.
|
||||||
///
|
///
|
||||||
|
@ -4,7 +4,7 @@ use std::collections::BTreeMap;
|
|||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_events_macros::MessageEventContent;
|
use ruma_events_macros::MessageEventContent;
|
||||||
use ruma_identifiers::DeviceId;
|
use ruma_identifiers::DeviceIdBox;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::MessageEvent;
|
use crate::MessageEvent;
|
||||||
@ -80,7 +80,7 @@ pub struct MegolmV1AesSha2Content {
|
|||||||
pub sender_key: String,
|
pub sender_key: String,
|
||||||
|
|
||||||
/// The ID of the sending device.
|
/// The ID of the sending device.
|
||||||
pub device_id: Box<DeviceId>,
|
pub device_id: DeviceIdBox,
|
||||||
|
|
||||||
/// The ID of the session used to encrypt the message.
|
/// The ID of the session used to encrypt the message.
|
||||||
pub session_id: String,
|
pub session_id: String,
|
||||||
@ -99,7 +99,7 @@ pub struct MegolmV1AesSha2ContentInit {
|
|||||||
pub sender_key: String,
|
pub sender_key: String,
|
||||||
|
|
||||||
/// The ID of the sending device.
|
/// The ID of the sending device.
|
||||||
pub device_id: Box<DeviceId>,
|
pub device_id: DeviceIdBox,
|
||||||
|
|
||||||
/// The ID of the session used to encrypt the message.
|
/// The ID of the session used to encrypt the message.
|
||||||
pub session_id: String,
|
pub session_id: String,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! Types for the *m.room_key_request* event.
|
//! Types for the *m.room_key_request* event.
|
||||||
|
|
||||||
use ruma_events_macros::BasicEventContent;
|
use ruma_events_macros::BasicEventContent;
|
||||||
use ruma_identifiers::{DeviceId, EventEncryptionAlgorithm, RoomId};
|
use ruma_identifiers::{DeviceIdBox, EventEncryptionAlgorithm, RoomId};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use strum::{Display, EnumString};
|
use strum::{Display, EnumString};
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ pub struct RoomKeyRequestEventContent {
|
|||||||
pub body: Option<RequestedKeyInfo>,
|
pub body: Option<RequestedKeyInfo>,
|
||||||
|
|
||||||
/// ID of the device requesting the key.
|
/// ID of the device requesting the key.
|
||||||
pub requesting_device_id: Box<DeviceId>,
|
pub requesting_device_id: DeviceIdBox,
|
||||||
|
|
||||||
/// A random string uniquely identifying the request for a key.
|
/// A random string uniquely identifying the request for a key.
|
||||||
///
|
///
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_common::encryption::DeviceKeys;
|
use ruma_common::encryption::DeviceKeys;
|
||||||
use ruma_identifiers::{DeviceId, UserId};
|
use ruma_identifiers::{DeviceIdBox, UserId};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
ruma_api! {
|
ruma_api! {
|
||||||
@ -40,7 +40,7 @@ ruma_api! {
|
|||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
pub struct UserDevice {
|
pub struct UserDevice {
|
||||||
/// The device ID.
|
/// The device ID.
|
||||||
pub device_id: Box<DeviceId>,
|
pub device_id: DeviceIdBox,
|
||||||
|
|
||||||
/// Identity keys for the device.
|
/// Identity keys for the device.
|
||||||
pub keys: DeviceKeys,
|
pub keys: DeviceKeys,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_identifiers::{DeviceId, DeviceKeyAlgorithm, DeviceKeyId, UserId};
|
use ruma_identifiers::{DeviceIdBox, DeviceKeyAlgorithm, DeviceKeyId, UserId};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
ruma_api! {
|
ruma_api! {
|
||||||
@ -29,10 +29,10 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A claim for one time keys
|
/// A claim for one time keys
|
||||||
pub type OneTimeKeyClaims = BTreeMap<UserId, BTreeMap<Box<DeviceId>, DeviceKeyAlgorithm>>;
|
pub type OneTimeKeyClaims = BTreeMap<UserId, BTreeMap<DeviceIdBox, DeviceKeyAlgorithm>>;
|
||||||
|
|
||||||
/// One time keys for use in pre-key messages
|
/// One time keys for use in pre-key messages
|
||||||
pub type OneTimeKeys = BTreeMap<UserId, BTreeMap<Box<DeviceId>, BTreeMap<DeviceKeyId, KeyObject>>>;
|
pub type OneTimeKeys = BTreeMap<UserId, BTreeMap<DeviceIdBox, BTreeMap<DeviceKeyId, KeyObject>>>;
|
||||||
|
|
||||||
/// A key and its signature
|
/// A key and its signature
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
@ -4,7 +4,7 @@ use std::collections::BTreeMap;
|
|||||||
|
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_common::encryption::DeviceKeys;
|
use ruma_common::encryption::DeviceKeys;
|
||||||
use ruma_identifiers::{DeviceId, UserId};
|
use ruma_identifiers::{DeviceIdBox, UserId};
|
||||||
|
|
||||||
ruma_api! {
|
ruma_api! {
|
||||||
metadata: {
|
metadata: {
|
||||||
@ -19,25 +19,25 @@ ruma_api! {
|
|||||||
request: {
|
request: {
|
||||||
/// The keys to be downloaded. Gives all keys for a given user if the list of device ids is
|
/// The keys to be downloaded. Gives all keys for a given user if the list of device ids is
|
||||||
/// empty.
|
/// empty.
|
||||||
device_keys: BTreeMap<UserId, Vec<Box<DeviceId>>>,
|
device_keys: BTreeMap<UserId, Vec<DeviceIdBox>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// Keys from the queried devices.
|
/// Keys from the queried devices.
|
||||||
device_keys: BTreeMap<UserId, BTreeMap<Box<DeviceId>, DeviceKeys>>,
|
device_keys: BTreeMap<UserId, BTreeMap<DeviceIdBox, DeviceKeys>>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates a new `Request` asking for the given device keys.
|
/// Creates a new `Request` asking for the given device keys.
|
||||||
pub fn new(device_keys: BTreeMap<UserId, Vec<Box<DeviceId>>>) -> Self {
|
pub fn new(device_keys: BTreeMap<UserId, Vec<DeviceIdBox>>) -> Self {
|
||||||
Self { device_keys }
|
Self { device_keys }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Response {
|
impl Response {
|
||||||
/// Creates a new `Response` with the given device keys.
|
/// Creates a new `Response` with the given device keys.
|
||||||
pub fn new(device_keys: BTreeMap<UserId, BTreeMap<Box<DeviceId>, DeviceKeys>>) -> Self {
|
pub fn new(device_keys: BTreeMap<UserId, BTreeMap<DeviceIdBox, DeviceKeys>>) -> Self {
|
||||||
Self { device_keys }
|
Self { device_keys }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user