client-api: Rename SessionData to EncryptedSessionData

This commit is contained in:
Kévin Commaille 2023-10-02 10:56:54 +02:00 committed by Kévin Commaille
parent a5d62dca22
commit 4fa1846a88
2 changed files with 18 additions and 17 deletions

View File

@ -6,6 +6,7 @@ Breaking changes:
`search::search_events::v3::SearchResult` `search::search_events::v3::SearchResult`
- Remove the `token` field from `keys::get_keys::Request`, according to a spec clarification. - Remove the `token` field from `keys::get_keys::Request`, according to a spec clarification.
- `SpaceRoomJoinRule` has been moved to the `space` module of the ruma-common crate - `SpaceRoomJoinRule` has been moved to the `space` module of the ruma-common crate
- `backup::SessionData(Init)` were renamed to `EncryptedSessionData(Init)`
Improvements: Improvements:

View File

@ -57,7 +57,7 @@ pub enum BackupAlgorithm {
/// Information about the backup key. /// Information about the backup key.
/// ///
/// To create an instance of this type, first create a `KeyBackupDataInit` and convert it via /// To create an instance of this type, first create a [`KeyBackupDataInit`] and convert it via
/// `KeyBackupData::from` / `.into()`. /// `KeyBackupData::from` / `.into()`.
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
@ -71,13 +71,13 @@ pub struct KeyBackupData {
/// Whether the device backing up the key verified the device that the key is from. /// Whether the device backing up the key verified the device that the key is from.
pub is_verified: bool, pub is_verified: bool,
/// Data about the session. /// Encrypted data about the session.
pub session_data: SessionData, pub session_data: EncryptedSessionData,
} }
/// Information about the backup key. /// Information about the backup key.
/// ///
/// This struct will not be updated even if additional fields are added to `SessionData` in a /// This struct will not be updated even if additional fields are added to [`KeyBackupData`] in a
/// new (non-breaking) release of the Matrix specification. /// new (non-breaking) release of the Matrix specification.
#[derive(Debug)] #[derive(Debug)]
#[allow(clippy::exhaustive_structs)] #[allow(clippy::exhaustive_structs)]
@ -91,8 +91,8 @@ pub struct KeyBackupDataInit {
/// Whether the device backing up the key verified the device that the key is from. /// Whether the device backing up the key verified the device that the key is from.
pub is_verified: bool, pub is_verified: bool,
/// Data about the session. /// Encrypted data about the session.
pub session_data: SessionData, pub session_data: EncryptedSessionData,
} }
impl From<KeyBackupDataInit> for KeyBackupData { impl From<KeyBackupDataInit> for KeyBackupData {
@ -103,13 +103,13 @@ impl From<KeyBackupDataInit> for KeyBackupData {
} }
} }
/// The algorithm used for storing backups. /// The encrypted algorithm-dependent data for backups.
/// ///
/// To create an instance of this type, first create a `SessionDataInit` and convert it via /// To create an instance of this type, first create an [`EncryptedSessionDataInit`] and convert it
/// `SessionData::from` / `.into()`. /// via `EncryptedSessionData::from` / `.into()`.
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct SessionData { pub struct EncryptedSessionData {
/// Unpadded base64-encoded public half of the ephemeral key. /// Unpadded base64-encoded public half of the ephemeral key.
pub ephemeral: Base64, pub ephemeral: Base64,
@ -120,13 +120,13 @@ pub struct SessionData {
pub mac: Base64, pub mac: Base64,
} }
/// The algorithm used for storing backups. /// The encrypted algorithm-dependent data for backups.
/// ///
/// This struct will not be updated even if additional fields are added to `SessionData` in a /// This struct will not be updated even if additional fields are added to [`EncryptedSessionData`]
/// new (non-breaking) release of the Matrix specification. /// in a new (non-breaking) release of the Matrix specification.
#[derive(Debug)] #[derive(Debug)]
#[allow(clippy::exhaustive_structs)] #[allow(clippy::exhaustive_structs)]
pub struct SessionDataInit { pub struct EncryptedSessionDataInit {
/// Unpadded base64-encoded public half of the ephemeral key. /// Unpadded base64-encoded public half of the ephemeral key.
pub ephemeral: Base64, pub ephemeral: Base64,
@ -137,9 +137,9 @@ pub struct SessionDataInit {
pub mac: Base64, pub mac: Base64,
} }
impl From<SessionDataInit> for SessionData { impl From<EncryptedSessionDataInit> for EncryptedSessionData {
fn from(init: SessionDataInit) -> Self { fn from(init: EncryptedSessionDataInit) -> Self {
let SessionDataInit { ephemeral, ciphertext, mac } = init; let EncryptedSessionDataInit { ephemeral, ciphertext, mac } = init;
Self { ephemeral, ciphertext, mac } Self { ephemeral, ciphertext, mac }
} }
} }