From 5627c5109e9153867764ee67ce818769f31325a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Wed, 9 Oct 2024 10:12:04 +0200 Subject: [PATCH] federation-api: Remove KeyObject It is unused and is actually supposed to be the same type as `ruma_common::encryption::SignedKey`. --- crates/ruma-federation-api/CHANGELOG.md | 5 ++++ .../src/keys/claim_keys.rs | 24 +------------------ 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/crates/ruma-federation-api/CHANGELOG.md b/crates/ruma-federation-api/CHANGELOG.md index 88a176fa..d727ccfe 100644 --- a/crates/ruma-federation-api/CHANGELOG.md +++ b/crates/ruma-federation-api/CHANGELOG.md @@ -1,5 +1,10 @@ # [unreleased] +Breaking changes: + +- Remove the unused `KeyObject` struct. It is actually supposed to be the same type + as `ruma_common::encryption::SignedKey`. + Bug fixes: - `ServerSigningKeys` can be deserialized when `old_verify_keys` is missing, due to a diff --git a/crates/ruma-federation-api/src/keys/claim_keys.rs b/crates/ruma-federation-api/src/keys/claim_keys.rs index 324036cc..d2f93681 100644 --- a/crates/ruma-federation-api/src/keys/claim_keys.rs +++ b/crates/ruma-federation-api/src/keys/claim_keys.rs @@ -13,10 +13,9 @@ pub mod v1 { api::{request, response, Metadata}, encryption::OneTimeKey, metadata, - serde::{Base64, Raw}, + serde::Raw, DeviceKeyAlgorithm, OwnedDeviceId, OwnedDeviceKeyId, OwnedUserId, }; - use serde::{Deserialize, Serialize}; const METADATA: Metadata = metadata! { method: POST, @@ -61,25 +60,4 @@ pub mod v1 { /// One time keys for use in pre-key messages pub type OneTimeKeys = BTreeMap>>>; - - /// A key and its signature - #[derive(Debug, Clone, Serialize, Deserialize)] - #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] - pub struct KeyObject { - /// The key, encoded using unpadded base64. - pub key: Base64, - - /// Signature of the key object. - pub signatures: BTreeMap>, - } - - impl KeyObject { - /// Creates a new `KeyObject` with the given key and signatures. - pub fn new( - key: Base64, - signatures: BTreeMap>, - ) -> Self { - Self { key, signatures } - } - } }