From 1e9fab1e4e2b91742ac4e13eb6243eff3d124099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 3 Oct 2023 13:17:49 +0200 Subject: [PATCH] Use the better Signatures type in the MegolmV1BackupKey type --- crates/matrix-sdk-crypto/CHANGELOG.md | 3 +++ .../matrix-sdk-crypto/src/backups/keys/backup.rs | 15 +++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/matrix-sdk-crypto/CHANGELOG.md b/crates/matrix-sdk-crypto/CHANGELOG.md index 314d000b3..2016f4b6d 100644 --- a/crates/matrix-sdk-crypto/CHANGELOG.md +++ b/crates/matrix-sdk-crypto/CHANGELOG.md @@ -1,5 +1,8 @@ # unreleased +- Use the `Signatures` type as the return value for the + `MegolmV1BackupKey::signatures()` method. + - Add two new methods to import room keys, `OlmMachine::store()::import_exported_room_keys()` for file exports and `OlmMachine::backup_machine()::import_backed_up_room_keys()` for backups. The diff --git a/crates/matrix-sdk-crypto/src/backups/keys/backup.rs b/crates/matrix-sdk-crypto/src/backups/keys/backup.rs index c550b2184..2dd8b0ba7 100644 --- a/crates/matrix-sdk-crypto/src/backups/keys/backup.rs +++ b/crates/matrix-sdk-crypto/src/backups/keys/backup.rs @@ -12,26 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{ - collections::BTreeMap, - sync::{Arc, Mutex}, -}; +use std::sync::{Arc, Mutex}; use ruma::{ api::client::backup::{EncryptedSessionDataInit, KeyBackupData, KeyBackupDataInit}, serde::Base64, - OwnedDeviceKeyId, OwnedUserId, }; use vodozemac::Curve25519PublicKey; use zeroize::Zeroizing; use super::{compat::PkEncryption, decryption::DecodeError}; -use crate::olm::InboundGroupSession; +use crate::{ + olm::InboundGroupSession, + types::{MegolmV1AuthData, RoomKeyBackupInfo, Signatures}, +}; #[derive(Debug)] struct InnerBackupKey { key: Curve25519PublicKey, - signatures: BTreeMap>, + signatures: Signatures, version: Mutex>, } @@ -70,7 +69,7 @@ impl MegolmV1BackupKey { } /// Get all the signatures of this `MegolmV1BackupKey`. - pub fn signatures(&self) -> BTreeMap> { + pub fn signatures(&self) -> Signatures { self.inner.signatures.to_owned() }