Unify import style across workspace

master
Devin Ragotzy 2020-08-02 08:05:43 -04:00
parent 230b2a229f
commit 0ac2b84c02
18 changed files with 164 additions and 182 deletions

View File

@ -19,44 +19,37 @@ use std::{
collections::HashMap, collections::HashMap,
convert::{TryFrom, TryInto}, convert::{TryFrom, TryInto},
fmt::{self, Debug}, fmt::{self, Debug},
future::Future,
path::Path, path::Path,
result::Result as StdResult, result::Result as StdResult,
sync::Arc, sync::Arc,
}; };
#[cfg(not(target_arch = "wasm32"))]
use crate::VERSION;
use crate::{Error, EventEmitter, Result};
use futures_timer::Delay as sleep;
use http::{Method as HttpMethod, Response as HttpResponse};
use matrix_sdk_base::{BaseClient, BaseClientConfig, Room, Session, StateStore};
#[cfg(feature = "encryption")]
use matrix_sdk_common::identifiers::DeviceId;
use matrix_sdk_common::{ use matrix_sdk_common::{
identifiers::ServerName, api,
events::{room::message::MessageEventContent, EventType},
identifiers::{EventId, RoomId, RoomIdOrAliasId, ServerName, UserId},
instant::{Duration, Instant}, instant::{Duration, Instant},
js_int::UInt, js_int::UInt,
locks::RwLock, locks::RwLock,
presence::PresenceState, presence::PresenceState,
uuid::Uuid, uuid::Uuid,
Endpoint,
}; };
use reqwest::header::{HeaderValue, InvalidHeaderValue, AUTHORIZATION};
use futures_timer::Delay as sleep;
use std::future::Future;
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
use tracing::{debug, warn}; use tracing::{debug, warn};
use tracing::{error, info, instrument, trace}; use tracing::{error, info, instrument, trace};
use http::{Method as HttpMethod, Response as HttpResponse};
use reqwest::header::{HeaderValue, InvalidHeaderValue, AUTHORIZATION};
use url::Url; use url::Url;
use crate::{
events::{room::message::MessageEventContent, EventType},
identifiers::{EventId, RoomId, RoomIdOrAliasId, UserId},
Endpoint,
};
#[cfg(feature = "encryption")]
use crate::identifiers::DeviceId;
#[cfg(not(target_arch = "wasm32"))]
use crate::VERSION;
use crate::{api, Error, EventEmitter, Result};
use matrix_sdk_base::{BaseClient, BaseClientConfig, Room, Session, StateStore};
const DEFAULT_SYNC_TIMEOUT: Duration = Duration::from_secs(30); const DEFAULT_SYNC_TIMEOUT: Duration = Duration::from_secs(30);
/// An async/await enabled Matrix client. /// An async/await enabled Matrix client.

View File

@ -14,16 +14,14 @@
//! Error conditions. //! Error conditions.
use reqwest::Error as ReqwestError;
use serde_json::Error as JsonError;
use thiserror::Error;
use matrix_sdk_base::Error as MatrixError; use matrix_sdk_base::Error as MatrixError;
use matrix_sdk_common::{
use crate::{
api::{r0::uiaa::UiaaResponse as UiaaError, Error as RumaClientError}, api::{r0::uiaa::UiaaResponse as UiaaError, Error as RumaClientError},
FromHttpResponseError as RumaResponseError, IntoHttpError as RumaIntoHttpError, FromHttpResponseError as RumaResponseError, IntoHttpError as RumaIntoHttpError,
}; };
use reqwest::Error as ReqwestError;
use serde_json::Error as JsonError;
use thiserror::Error;
/// Result type of the rust-sdk. /// Result type of the rust-sdk.
pub type Result<T> = std::result::Result<T, Error>; pub type Result<T> = std::result::Result<T, Error>;

View File

@ -42,17 +42,17 @@ pub use matrix_sdk_base::{
CustomOrRawEvent, Error as BaseError, EventEmitter, Room, RoomState, Session, StateStore, CustomOrRawEvent, Error as BaseError, EventEmitter, Room, RoomState, Session, StateStore,
SyncRoom, SyncRoom,
}; };
#[cfg(feature = "messages")]
pub use matrix_sdk_base::{MessageQueue, MessageWrapper, PossiblyRedactedExt};
pub use matrix_sdk_common::*;
pub use reqwest::header::InvalidHeaderValue;
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
pub use matrix_sdk_base::{Device, TrustState}; pub use matrix_sdk_base::{Device, TrustState};
#[cfg(feature = "messages")]
pub use matrix_sdk_base::{MessageQueue, PossiblyRedactedExt};
pub use matrix_sdk_common::*;
pub use reqwest::header::InvalidHeaderValue;
mod client; mod client;
mod error; mod error;
mod request_builder; mod request_builder;
pub use client::{Client, ClientConfig, SyncSettings}; pub use client::{Client, ClientConfig, SyncSettings};
pub use error::{Error, Result}; pub use error::{Error, Result};
pub use request_builder::{ pub use request_builder::{

View File

@ -18,58 +18,53 @@ use std::collections::{BTreeMap, HashSet};
use std::{ use std::{
collections::HashMap, collections::HashMap,
fmt, fmt,
ops::Deref,
path::{Path, PathBuf}, path::{Path, PathBuf},
result::Result as StdResult,
sync::Arc, sync::Arc,
}; };
use zeroize::Zeroizing;
use std::result::Result as StdResult;
use crate::{api::r0 as api, error::Result, events::presence::PresenceEvent};
// `NonRoomEvent` is what it is aliased as
use crate::{
event_emitter::CustomOrRawEvent,
events::{
ignored_user_list::IgnoredUserListEvent, push_rules::PushRulesEvent,
room::member::MemberEventContent,
},
identifiers::{RoomId, UserId},
models::Room,
push::Ruleset,
session::Session,
state::{AllRooms, ClientState, StateStore},
EventEmitter,
};
use matrix_sdk_common::{
events::{
AnyBasicEvent, AnyStrippedStateEvent, AnySyncEphemeralRoomEvent, AnySyncMessageEvent,
AnySyncRoomEvent, AnySyncStateEvent,
},
Raw,
};
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
use matrix_sdk_common::locks::Mutex; use matrix_sdk_common::locks::Mutex;
use matrix_sdk_common::locks::RwLock;
use std::ops::Deref;
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
use crate::api::r0::keys::{ use matrix_sdk_common::{
claim_keys::Response as KeysClaimResponse, get_keys::Response as KeysQueryResponse, api::r0 as api,
upload_keys::Response as KeysUploadResponse, DeviceKeys, KeyAlgorithm, api::r0::keys::{
claim_keys::Response as KeysClaimResponse, get_keys::Response as KeysQueryResponse,
upload_keys::Response as KeysUploadResponse, DeviceKeys, KeyAlgorithm,
},
api::r0::to_device::send_event_to_device,
events::room::{
encrypted::EncryptedEventContent, message::MessageEventContent as MsgEventContent,
},
identifiers::DeviceId,
}; };
#[cfg(feature = "encryption")] use matrix_sdk_common::{
use crate::api::r0::to_device::send_event_to_device; events::{
#[cfg(feature = "encryption")] ignored_user_list::IgnoredUserListEvent, push_rules::PushRulesEvent,
use crate::events::room::{ room::member::MemberEventContent, AnyBasicEvent, AnyStrippedStateEvent,
encrypted::EncryptedEventContent, message::MessageEventContent as MsgEventContent, AnySyncEphemeralRoomEvent, AnySyncMessageEvent, AnySyncRoomEvent, AnySyncStateEvent,
},
identifiers::{RoomId, UserId},
locks::RwLock,
push::Ruleset,
Raw,
}; };
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
use crate::identifiers::DeviceId;
#[cfg(not(target_arch = "wasm32"))]
use crate::JsonStore;
#[cfg(feature = "encryption")]
use matrix_sdk_crypto::{CryptoStore, OlmError, OlmMachine, OneTimeKeys}; use matrix_sdk_crypto::{CryptoStore, OlmError, OlmMachine, OneTimeKeys};
use zeroize::Zeroizing;
#[cfg(not(target_arch = "wasm32"))]
use crate::JsonStore;
use crate::{
error::Result,
event_emitter::CustomOrRawEvent,
events::presence::PresenceEvent,
models::Room,
session::Session,
state::{AllRooms, ClientState, StateStore},
EventEmitter,
};
pub type Token = String; pub type Token = String;

View File

@ -5,11 +5,12 @@
use std::{time::SystemTime, vec::IntoIter}; use std::{time::SystemTime, vec::IntoIter};
use matrix_sdk_common::identifiers::{EventId, UserId}; use matrix_sdk_common::{
events::AnyPossiblyRedactedSyncMessageEvent,
identifiers::{EventId, UserId},
};
use serde::{de, ser, Serialize}; use serde::{de, ser, Serialize};
use crate::events::AnyPossiblyRedactedSyncMessageEvent;
/// Exposes some of the field access methods found in the event held by /// Exposes some of the field access methods found in the event held by
/// `AnyPossiblyRedacted*` enums. /// `AnyPossiblyRedacted*` enums.
/// ///

View File

@ -20,13 +20,11 @@ use std::{
convert::TryFrom, convert::TryFrom,
}; };
use serde::{Deserialize, Serialize};
use tracing::{debug, error, trace};
#[cfg(feature = "messages")] #[cfg(feature = "messages")]
use super::message::MessageQueue; use matrix_sdk_common::events::{
use super::RoomMember; room::redaction::SyncRedactionEvent, AnyPossiblyRedactedSyncMessageEvent, AnySyncMessageEvent,
use crate::{ };
use matrix_sdk_common::{
api::r0::sync::sync_events::{RoomSummary, UnreadNotificationsCount}, api::r0::sync::sync_events::{RoomSummary, UnreadNotificationsCount},
events::{ events::{
presence::{PresenceEvent, PresenceEventContent}, presence::{PresenceEvent, PresenceEventContent},
@ -42,16 +40,15 @@ use crate::{
Algorithm, AnyStrippedStateEvent, AnySyncRoomEvent, AnySyncStateEvent, EventType, Algorithm, AnyStrippedStateEvent, AnySyncRoomEvent, AnySyncStateEvent, EventType,
StrippedStateEvent, SyncStateEvent, StrippedStateEvent, SyncStateEvent,
}, },
identifiers::{RoomAliasId, RoomId, UserId},
js_int::{int, uint, Int, UInt},
}; };
use serde::{Deserialize, Serialize};
use tracing::{debug, error, trace};
#[cfg(feature = "messages")] #[cfg(feature = "messages")]
use crate::events::{ use super::message::MessageQueue;
room::redaction::SyncRedactionEvent, AnyPossiblyRedactedSyncMessageEvent, AnySyncMessageEvent, use super::RoomMember;
};
use crate::identifiers::{RoomAliasId, RoomId, UserId};
use crate::js_int::{int, uint, Int, UInt};
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
/// `RoomName` allows the calculation of a text room name. /// `RoomName` allows the calculation of a text room name.

View File

@ -15,7 +15,7 @@
//! User sessions. //! User sessions.
use crate::identifiers::{DeviceId, UserId}; use matrix_sdk_common::identifiers::{DeviceId, UserId};
/// A user session, containing an access token and information about the /// A user session, containing an access token and information about the
/// associated user account. /// associated user account.

View File

@ -15,6 +15,10 @@
use std::collections::HashMap; use std::collections::HashMap;
use matrix_sdk_common::{
identifiers::{RoomId, UserId},
push::Ruleset,
};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
@ -24,8 +28,6 @@ pub use json_store::JsonStore;
use crate::{ use crate::{
client::{BaseClient, Token}, client::{BaseClient, Token},
identifiers::{RoomId, UserId},
push::Ruleset,
Result, Room, RoomState, Session, Result, Room, RoomState, Session,
}; };

View File

@ -1,6 +1,5 @@
pub use instant; pub use instant;
pub use js_int; pub use js_int;
pub use ruma::{ pub use ruma::{
api::{ api::{
client as api, client as api,

View File

@ -22,16 +22,15 @@ use std::{
}; };
use atomic::Atomic; use atomic::Atomic;
use serde_json::{json, Value};
#[cfg(test)]
use super::OlmMachine;
use matrix_sdk_common::{ use matrix_sdk_common::{
api::r0::keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, SignedKey}, api::r0::keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, SignedKey},
events::Algorithm, events::Algorithm,
identifiers::{DeviceId, UserId}, identifiers::{DeviceId, UserId},
}; };
use serde_json::{json, Value};
#[cfg(test)]
use super::OlmMachine;
use crate::{error::SignatureError, verify_json}; use crate::{error::SignatureError, verify_json};
/// A device represents a E2EE capable client of an user. /// A device represents a E2EE capable client of an user.

View File

@ -21,19 +21,12 @@ use std::{
result::Result as StdResult, result::Result as StdResult,
}; };
#[cfg(feature = "sqlite-cryptostore")] use api::r0::{
use super::store::sqlite::SqliteStore; keys,
use super::{ keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey},
device::Device, sync::sync_events::Response as SyncResponse,
error::{EventError, MegolmError, MegolmResult, OlmError, OlmResult}, to_device::{send_event_to_device::Request as ToDeviceRequest, DeviceIdOrAllDevices},
olm::{
Account, GroupSessionKey, IdentityKeys, InboundGroupSession, OlmMessage,
OutboundGroupSession,
},
store::{memorystore::MemoryStore, Result as StoreResult},
CryptoStore,
}; };
use matrix_sdk_common::{ use matrix_sdk_common::{
api, api,
events::{ events::{
@ -47,17 +40,22 @@ use matrix_sdk_common::{
uuid::Uuid, uuid::Uuid,
Raw, Raw,
}; };
use api::r0::{
keys,
keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey},
sync::sync_events::Response as SyncResponse,
to_device::{send_event_to_device::Request as ToDeviceRequest, DeviceIdOrAllDevices},
};
use serde_json::Value; use serde_json::Value;
use tracing::{debug, error, info, instrument, trace, warn}; use tracing::{debug, error, info, instrument, trace, warn};
#[cfg(feature = "sqlite-cryptostore")]
use super::store::sqlite::SqliteStore;
use super::{
device::Device,
error::{EventError, MegolmError, MegolmResult, OlmError, OlmResult},
olm::{
Account, GroupSessionKey, IdentityKeys, InboundGroupSession, OlmMessage,
OutboundGroupSession,
},
store::{memorystore::MemoryStore, Result as StoreResult},
CryptoStore,
};
/// A map from the algorithm and device id to a one-time key. /// A map from the algorithm and device id to a one-time key.
/// ///
/// These keys need to be periodically uploaded to the server. /// These keys need to be periodically uploaded to the server.

View File

@ -15,13 +15,15 @@
use std::{collections::HashMap, sync::Arc}; use std::{collections::HashMap, sync::Arc};
use dashmap::{DashMap, ReadOnlyView}; use dashmap::{DashMap, ReadOnlyView};
use matrix_sdk_common::locks::Mutex; use matrix_sdk_common::{
identifiers::{DeviceId, RoomId, UserId},
locks::Mutex,
};
use super::{ use super::{
device::Device, device::Device,
olm::{InboundGroupSession, Session}, olm::{InboundGroupSession, Session},
}; };
use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId};
/// In-memory store for Olm Sessions. /// In-memory store for Olm Sessions.
#[derive(Debug, Default)] #[derive(Debug, Default)]

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use matrix_sdk_common::instant::Instant;
use std::{ use std::{
collections::BTreeMap,
convert::{TryFrom, TryInto}, convert::{TryFrom, TryInto},
fmt, fmt,
sync::{ sync::{
@ -22,30 +22,28 @@ use std::{
}, },
}; };
use matrix_sdk_common::locks::Mutex; use matrix_sdk_common::{
use serde_json::{json, Value}; api::r0::keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey, SignedKey},
use std::collections::BTreeMap; events::Algorithm,
identifiers::{DeviceId, RoomId, UserId},
pub use olm_rs::account::IdentityKeys; instant::Instant,
locks::Mutex,
};
use olm_rs::{ use olm_rs::{
account::{OlmAccount, OneTimeKeys}, account::{OlmAccount, OneTimeKeys},
errors::{OlmAccountError, OlmSessionError}, errors::{OlmAccountError, OlmSessionError},
PicklingMode, PicklingMode,
}; };
use serde_json::{json, Value};
use crate::{device::Device, error::SessionCreationError};
pub use olm_rs::{ pub use olm_rs::{
account::IdentityKeys,
session::{OlmMessage, PreKeyMessage}, session::{OlmMessage, PreKeyMessage},
utility::OlmUtility, utility::OlmUtility,
}; };
use matrix_sdk_common::{
api::r0::keys::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey, SignedKey},
events::Algorithm,
identifiers::{DeviceId, RoomId, UserId},
};
use super::{InboundGroupSession, OutboundGroupSession, Session}; use super::{InboundGroupSession, OutboundGroupSession, Session};
use crate::{device::Device, error::SessionCreationError};
/// Account holding identity keys for which sessions can be created. /// Account holding identity keys for which sessions can be created.
/// ///

View File

@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use matrix_sdk_common::instant::Instant;
use std::{ use std::{
convert::TryInto, convert::TryInto,
fmt, fmt,
@ -22,31 +21,31 @@ use std::{
}, },
}; };
use matrix_sdk_common::locks::Mutex;
use serde::Serialize;
use serde_json::{json, Value};
use zeroize::Zeroize;
pub use olm_rs::account::IdentityKeys;
use olm_rs::{
errors::OlmGroupSessionError, inbound_group_session::OlmInboundGroupSession,
outbound_group_session::OlmOutboundGroupSession, PicklingMode,
};
use crate::error::{EventError, MegolmResult};
pub use olm_rs::{
session::{OlmMessage, PreKeyMessage},
utility::OlmUtility,
};
use matrix_sdk_common::{ use matrix_sdk_common::{
events::{ events::{
room::{encrypted::EncryptedEventContent, message::MessageEventContent}, room::{encrypted::EncryptedEventContent, message::MessageEventContent},
Algorithm, AnySyncRoomEvent, EventType, SyncMessageEvent, Algorithm, AnySyncRoomEvent, EventType, SyncMessageEvent,
}, },
identifiers::{DeviceId, RoomId}, identifiers::{DeviceId, RoomId},
instant::Instant,
locks::Mutex,
Raw, Raw,
}; };
use olm_rs::{
errors::OlmGroupSessionError, inbound_group_session::OlmInboundGroupSession,
outbound_group_session::OlmOutboundGroupSession, PicklingMode,
};
use serde::Serialize;
use serde_json::{json, Value};
use zeroize::Zeroize;
pub use olm_rs::{
account::IdentityKeys,
session::{OlmMessage, PreKeyMessage},
utility::OlmUtility,
};
use crate::error::{EventError, MegolmResult};
/// The private session key of a group session. /// The private session key of a group session.
/// Can be used to create a new inbound group session. /// Can be used to create a new inbound group session.

View File

@ -14,21 +14,6 @@
use std::{collections::BTreeMap, fmt, sync::Arc}; use std::{collections::BTreeMap, fmt, sync::Arc};
use olm_rs::{errors::OlmSessionError, session::OlmSession, PicklingMode};
use serde_json::{json, Value};
pub use olm_rs::{
session::{OlmMessage, PreKeyMessage},
utility::OlmUtility,
};
use super::IdentityKeys;
use crate::{
error::{EventError, OlmResult},
Device,
};
use matrix_sdk_common::{ use matrix_sdk_common::{
api::r0::keys::KeyAlgorithm, api::r0::keys::KeyAlgorithm,
events::{ events::{
@ -39,6 +24,19 @@ use matrix_sdk_common::{
instant::Instant, instant::Instant,
locks::Mutex, locks::Mutex,
}; };
use olm_rs::{errors::OlmSessionError, session::OlmSession, PicklingMode};
use serde_json::{json, Value};
use super::IdentityKeys;
use crate::{
error::{EventError, OlmResult},
Device,
};
pub use olm_rs::{
session::{OlmMessage, PreKeyMessage},
utility::OlmUtility,
};
/// Cryptographic session that enables secure communication between two /// Cryptographic session that enables secure communication between two
/// `Account`s /// `Account`s

View File

@ -15,15 +15,16 @@
use std::{collections::HashSet, sync::Arc}; use std::{collections::HashSet, sync::Arc};
use async_trait::async_trait; use async_trait::async_trait;
use matrix_sdk_common::locks::Mutex; use matrix_sdk_common::{
identifiers::{DeviceId, RoomId, UserId},
locks::Mutex,
};
use super::{Account, CryptoStore, InboundGroupSession, Result, Session}; use super::{Account, CryptoStore, InboundGroupSession, Result, Session};
use crate::{ use crate::{
device::Device, device::Device,
memory_stores::{DeviceStore, GroupSessionStore, SessionStore, UserDevices}, memory_stores::{DeviceStore, GroupSessionStore, SessionStore, UserDevices},
}; };
use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId};
#[derive(Debug)] #[derive(Debug)]
pub struct MemoryStore { pub struct MemoryStore {
sessions: SessionStore, sessions: SessionStore,

View File

@ -12,23 +12,25 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use core::fmt::Debug;
use std::{collections::HashSet, io::Error as IoError, sync::Arc}; use std::{collections::HashSet, io::Error as IoError, sync::Arc};
use url::ParseError;
use async_trait::async_trait; use async_trait::async_trait;
use matrix_sdk_common::locks::Mutex; use core::fmt::Debug;
use matrix_sdk_common::{
identifiers::{DeviceId, RoomId, UserId},
locks::Mutex,
};
use matrix_sdk_common_macros::send_sync;
use olm_rs::errors::{OlmAccountError, OlmGroupSessionError, OlmSessionError};
use serde_json::Error as SerdeError; use serde_json::Error as SerdeError;
use thiserror::Error; use thiserror::Error;
use url::ParseError;
use super::{ use super::{
device::Device, device::Device,
memory_stores::UserDevices, memory_stores::UserDevices,
olm::{Account, InboundGroupSession, Session}, olm::{Account, InboundGroupSession, Session},
}; };
use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId};
use matrix_sdk_common_macros::send_sync;
use olm_rs::errors::{OlmAccountError, OlmGroupSessionError, OlmSessionError};
pub mod memorystore; pub mod memorystore;

View File

@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use matrix_sdk_common::instant::{Duration, Instant};
use std::{ use std::{
collections::{BTreeMap, HashSet}, collections::{BTreeMap, HashSet},
convert::TryFrom, convert::TryFrom,
@ -20,12 +19,18 @@ use std::{
result::Result as StdResult, result::Result as StdResult,
sync::Arc, sync::Arc,
}; };
use url::Url;
use async_trait::async_trait; use async_trait::async_trait;
use matrix_sdk_common::locks::Mutex; use matrix_sdk_common::{
api::r0::keys::{AlgorithmAndDeviceId, KeyAlgorithm},
events::Algorithm,
identifiers::{DeviceId, RoomId, UserId},
instant::{Duration, Instant},
locks::Mutex,
};
use olm_rs::PicklingMode; use olm_rs::PicklingMode;
use sqlx::{query, query_as, sqlite::SqliteQueryAs, Connect, Executor, SqliteConnection}; use sqlx::{query, query_as, sqlite::SqliteQueryAs, Connect, Executor, SqliteConnection};
use url::Url;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use super::{CryptoStore, CryptoStoreError, Result}; use super::{CryptoStore, CryptoStoreError, Result};
@ -34,11 +39,6 @@ use crate::{
memory_stores::{DeviceStore, GroupSessionStore, SessionStore, UserDevices}, memory_stores::{DeviceStore, GroupSessionStore, SessionStore, UserDevices},
Account, IdentityKeys, InboundGroupSession, Session, Account, IdentityKeys, InboundGroupSession, Session,
}; };
use matrix_sdk_common::{
api::r0::keys::{AlgorithmAndDeviceId, KeyAlgorithm},
events::Algorithm,
identifiers::{DeviceId, RoomId, UserId},
};
/// SQLite based implementation of a `CryptoStore`. /// SQLite based implementation of a `CryptoStore`.
pub struct SqliteStore { pub struct SqliteStore {