crypto: Remove the sqlite store for now
parent
bc3ba3fab0
commit
bf4f32eccf
|
@ -37,7 +37,7 @@
|
||||||
//! The following crate feature flags are available:
|
//! The following crate feature flags are available:
|
||||||
//!
|
//!
|
||||||
//! * `encryption`: Enables end-to-end encryption support in the library.
|
//! * `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
|
//! 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
|
//! by default be stored only in memory and thus lost after the client is
|
||||||
//! destroyed.
|
//! destroyed.
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
//! The following crate feature flags are available:
|
//! The following crate feature flags are available:
|
||||||
//!
|
//!
|
||||||
//! * `encryption`: Enables end-to-end encryption support in the library.
|
//! * `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
|
//! 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
|
//! by default be stored only in memory and thus lost after the client is
|
||||||
//! destroyed.
|
//! destroyed.
|
||||||
|
|
|
@ -16,9 +16,8 @@ rustdoc-args = ["--cfg", "feature=\"docs\""]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
sqlite_cryptostore = ["sqlx"]
|
|
||||||
sled_cryptostore = ["sled"]
|
sled_cryptostore = ["sled"]
|
||||||
docs = ["sqlite_cryptostore"]
|
docs = ["sled_cryptostore"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
|
||||||
|
@ -43,12 +42,6 @@ hmac = "0.10.1"
|
||||||
base64 = "0.13.0"
|
base64 = "0.13.0"
|
||||||
byteorder = "1.4.2"
|
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]
|
[dev-dependencies]
|
||||||
tokio = { version = "1.1.0", default-features = false, features = ["rt-multi-thread", "macros"] }
|
tokio = { version = "1.1.0", default-features = false, features = ["rt-multi-thread", "macros"] }
|
||||||
futures = "0.3.12"
|
futures = "0.3.12"
|
||||||
|
|
|
@ -252,7 +252,7 @@ impl OlmMachine {
|
||||||
|
|
||||||
/// Create a new machine with the default crypto store.
|
/// 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
|
/// # Arguments
|
||||||
///
|
///
|
||||||
|
@ -260,7 +260,7 @@ impl OlmMachine {
|
||||||
///
|
///
|
||||||
/// * `device_id` - The unique id of the device that owns this machine.
|
/// * `device_id` - The unique id of the device that owns this machine.
|
||||||
#[cfg(feature = "sled_cryptostore")]
|
#[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(
|
pub async fn new_with_default_store(
|
||||||
user_id: &UserId,
|
user_id: &UserId,
|
||||||
device_id: &DeviceId,
|
device_id: &DeviceId,
|
||||||
|
@ -1162,8 +1162,6 @@ pub(crate) mod test {
|
||||||
|
|
||||||
use http::Response;
|
use http::Response;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
#[cfg(feature = "sqlite_cryptostore")]
|
|
||||||
use tempfile::tempdir;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
machine::OlmMachine,
|
machine::OlmMachine,
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
//! The storage layer for the [`OlmMachine`] can be customized using a trait.
|
//! The storage layer for the [`OlmMachine`] can be customized using a trait.
|
||||||
//! Implementing your own [`CryptoStore`]
|
//! 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
|
//! on your needs and targets a custom store may be implemented, e.g. for
|
||||||
//! `wasm-unknown-unknown` an indexeddb store would be needed
|
//! `wasm-unknown-unknown` an indexeddb store would be needed
|
||||||
//!
|
//!
|
||||||
|
@ -42,17 +42,11 @@ mod memorystore;
|
||||||
mod pickle_key;
|
mod pickle_key;
|
||||||
#[cfg(feature = "sled_cryptostore")]
|
#[cfg(feature = "sled_cryptostore")]
|
||||||
pub(crate) mod sled;
|
pub(crate) mod sled;
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
#[cfg(feature = "sqlite_cryptostore")]
|
|
||||||
pub(crate) mod sqlite;
|
|
||||||
|
|
||||||
#[cfg(feature = "sled_cryptostore")]
|
#[cfg(feature = "sled_cryptostore")]
|
||||||
pub use self::sled::SledStore;
|
pub use self::sled::SledStore;
|
||||||
pub use memorystore::MemoryStore;
|
pub use memorystore::MemoryStore;
|
||||||
pub use pickle_key::{EncryptedPickleKey, PickleKey};
|
pub use pickle_key::{EncryptedPickleKey, PickleKey};
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
#[cfg(feature = "sqlite_cryptostore")]
|
|
||||||
pub use sqlite::SqliteStore;
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
|
@ -67,11 +61,6 @@ use serde::{Deserialize, Serialize};
|
||||||
use serde_json::Error as SerdeError;
|
use serde_json::Error as SerdeError;
|
||||||
use thiserror::Error;
|
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::{
|
use matrix_sdk_common::{
|
||||||
async_trait,
|
async_trait,
|
||||||
identifiers::{
|
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")]
|
#[error("can't save/load sessions or group sessions in the store before an account is stored")]
|
||||||
AccountUnset,
|
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
|
/// Error in the internal database
|
||||||
#[cfg(feature = "sled_cryptostore")]
|
#[cfg(feature = "sled_cryptostore")]
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue