From 2f7ec887ba40ea3fb61ec339eba16fe228a4de8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 21 Apr 2020 10:41:08 +0200 Subject: [PATCH] crypto: Clean up the imports. --- src/crypto/machine.rs | 37 ++++++++++++++++++------------------- src/crypto/olm.rs | 7 ++++++- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/crypto/machine.rs b/src/crypto/machine.rs index 52c6a39c..f42b6aa8 100644 --- a/src/crypto/machine.rs +++ b/src/crypto/machine.rs @@ -21,28 +21,17 @@ use std::result::Result as StdResult; use uuid::Uuid; use super::error::{OlmError, Result, SignatureError, VerificationResult}; -use super::olm::{Account, GroupSessionKey, InboundGroupSession, OutboundGroupSession, Session}; +use super::olm::{ + Account, GroupSessionKey, InboundGroupSession, OlmMessage, OlmUtility, OutboundGroupSession, + Session, +}; use super::store::memorystore::MemoryStore; #[cfg(feature = "sqlite-cryptostore")] use super::store::sqlite::SqliteStore; use super::{device::Device, CryptoStore}; + use crate::api; - -use api::r0::keys; - -use cjson; -use olm_rs::{session::OlmMessage, utility::OlmUtility}; -use serde_json::{json, Value}; -use tracing::{debug, error, info, instrument, trace, warn}; - -use ruma_client_api::r0::client_exchange::{ - send_event_to_device::Request as ToDeviceRequest, DeviceIdOrAllDevices, -}; -use ruma_client_api::r0::keys::{ - AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey, SignedKey, -}; -use ruma_client_api::r0::sync::sync_events::IncomingResponse as SyncResponse; -use ruma_events::{ +use crate::events::{ collections::all::RoomEvent, room::encrypted::{ CiphertextInfo, EncryptedEvent, EncryptedEventContent, MegolmV1AesSha2Content, @@ -55,8 +44,18 @@ use ruma_events::{ }, Algorithm, EventResult, EventType, }; -use ruma_identifiers::RoomId; -use ruma_identifiers::{DeviceId, UserId}; +use crate::identifiers::{DeviceId, RoomId, UserId}; + +use api::r0::keys; +use api::r0::{ + client_exchange::{send_event_to_device::Request as ToDeviceRequest, DeviceIdOrAllDevices}, + keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey, SignedKey}, + sync::sync_events::IncomingResponse as SyncResponse, +}; + +use cjson; +use serde_json::{json, Value}; +use tracing::{debug, error, info, instrument, trace, warn}; pub type OneTimeKeys = HashMap; diff --git a/src/crypto/olm.rs b/src/crypto/olm.rs index 614f5bda..3d6d4ac4 100644 --- a/src/crypto/olm.rs +++ b/src/crypto/olm.rs @@ -26,9 +26,14 @@ use olm_rs::account::{IdentityKeys, OlmAccount, OneTimeKeys}; use olm_rs::errors::{OlmAccountError, OlmGroupSessionError, OlmSessionError}; use olm_rs::inbound_group_session::OlmInboundGroupSession; use olm_rs::outbound_group_session::OlmOutboundGroupSession; -use olm_rs::session::{OlmMessage, OlmSession, PreKeyMessage}; +use olm_rs::session::OlmSession; use olm_rs::PicklingMode; +pub use olm_rs::{ + session::{OlmMessage, PreKeyMessage}, + utility::OlmUtility, +}; + use crate::api::r0::keys::SignedKey; use crate::identifiers::RoomId;