Use the better Signatures type in the MegolmV1BackupKey type

This commit is contained in:
Damir Jelić
2023-10-03 13:17:49 +02:00
parent 1be7fab4fd
commit 1e9fab1e4e
2 changed files with 10 additions and 8 deletions

View File

@@ -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

View File

@@ -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<OwnedUserId, BTreeMap<OwnedDeviceKeyId, String>>,
signatures: Signatures,
version: Mutex<Option<String>>,
}
@@ -70,7 +69,7 @@ impl MegolmV1BackupKey {
}
/// Get all the signatures of this `MegolmV1BackupKey`.
pub fn signatures(&self) -> BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceKeyId, String>> {
pub fn signatures(&self) -> Signatures {
self.inner.signatures.to_owned()
}