crypto: Remove the sqlite store for now

This commit is contained in:
Damir Jelić 2021-01-27 15:29:42 +01:00
parent bc3ba3fab0
commit bf4f32eccf
6 changed files with 6 additions and 2502 deletions

View file

@ -37,7 +37,7 @@
//! The following crate feature flags are available:
//!
//! * `encryption`: Enables end-to-end encryption support in the library.
//! * `sqlite_cryptostore`: Enables a SQLite based store for the encryption
//! * `sled_cryptostore`: Enables a Sled based store for the encryption
//! keys. If this is disabled and `encryption` support is enabled the keys will
//! by default be stored only in memory and thus lost after the client is
//! destroyed.

View file

@ -20,7 +20,7 @@
//! The following crate feature flags are available:
//!
//! * `encryption`: Enables end-to-end encryption support in the library.
//! * `sqlite_cryptostore`: Enables a SQLite based store for the encryption
//! * `sled_cryptostore`: Enables a Sled based store for the encryption
//! keys. If this is disabled and `encryption` support is enabled the keys will
//! by default be stored only in memory and thus lost after the client is
//! destroyed.

View file

@ -16,9 +16,8 @@ rustdoc-args = ["--cfg", "feature=\"docs\""]
[features]
default = []
sqlite_cryptostore = ["sqlx"]
sled_cryptostore = ["sled"]
docs = ["sqlite_cryptostore"]
docs = ["sled_cryptostore"]
[dependencies]
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
@ -43,12 +42,6 @@ hmac = "0.10.1"
base64 = "0.13.0"
byteorder = "1.4.2"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.sqlx]
version = "0.4.2"
optional = true
default-features = false
features = ["runtime-tokio-native-tls", "sqlite", "macros"]
[dev-dependencies]
tokio = { version = "1.1.0", default-features = false, features = ["rt-multi-thread", "macros"] }
futures = "0.3.12"

View file

@ -252,7 +252,7 @@ impl OlmMachine {
/// Create a new machine with the default crypto store.
///
/// The default store uses a SQLite database to store the encryption keys.
/// The default store uses a Sled database to store the encryption keys.
///
/// # Arguments
///
@ -260,7 +260,7 @@ impl OlmMachine {
///
/// * `device_id` - The unique id of the device that owns this machine.
#[cfg(feature = "sled_cryptostore")]
#[cfg_attr(feature = "docs", doc(cfg(r#sqlite_cryptostore)))]
#[cfg_attr(feature = "docs", doc(cfg(sled_cryptostore)))]
pub async fn new_with_default_store(
user_id: &UserId,
device_id: &DeviceId,
@ -1162,8 +1162,6 @@ pub(crate) mod test {
use http::Response;
use serde_json::json;
#[cfg(feature = "sqlite_cryptostore")]
use tempfile::tempdir;
use crate::{
machine::OlmMachine,

View file

@ -17,7 +17,7 @@
//! The storage layer for the [`OlmMachine`] can be customized using a trait.
//! Implementing your own [`CryptoStore`]
//!
//! An in-memory only store is provided as well as a SQLite based one, depending
//! An in-memory only store is provided as well as a Sled based one, depending
//! on your needs and targets a custom store may be implemented, e.g. for
//! `wasm-unknown-unknown` an indexeddb store would be needed
//!
@ -42,17 +42,11 @@ mod memorystore;
mod pickle_key;
#[cfg(feature = "sled_cryptostore")]
pub(crate) mod sled;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "sqlite_cryptostore")]
pub(crate) mod sqlite;
#[cfg(feature = "sled_cryptostore")]
pub use self::sled::SledStore;
pub use memorystore::MemoryStore;
pub use pickle_key::{EncryptedPickleKey, PickleKey};
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "sqlite_cryptostore")]
pub use sqlite::SqliteStore;
use std::{
collections::{HashMap, HashSet},
@ -67,11 +61,6 @@ use serde::{Deserialize, Serialize};
use serde_json::Error as SerdeError;
use thiserror::Error;
#[cfg_attr(feature = "docs", doc(cfg(r#sqlite_cryptostore)))]
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "sqlite_cryptostore")]
use sqlx::Error as SqlxError;
use matrix_sdk_common::{
async_trait,
identifiers::{
@ -295,13 +284,6 @@ pub enum CryptoStoreError {
#[error("can't save/load sessions or group sessions in the store before an account is stored")]
AccountUnset,
/// SQL error occurred.
// TODO flatten the SqlxError to make it easier for other store
// implementations.
#[cfg(feature = "sqlite_cryptostore")]
#[error(transparent)]
Database(#[from] SqlxError),
/// Error in the internal database
#[cfg(feature = "sled_cryptostore")]
#[error(transparent)]

File diff suppressed because it is too large Load diff