From ad31540b101e550ea261d108aa59784a2d2e9922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Thu, 10 Mar 2022 11:27:35 +0100 Subject: [PATCH] sdk: Don't enable store encryption by default --- crates/matrix-sdk/Cargo.toml | 9 +++++---- crates/matrix-sdk/examples/autojoin.rs | 6 +++--- crates/matrix-sdk/examples/command_bot.rs | 6 +++--- crates/matrix-sdk/examples/wasm_command_bot/Cargo.toml | 4 ++-- crates/matrix-sdk/src/store.rs | 2 +- xtask/src/ci.rs | 4 ++-- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/crates/matrix-sdk/Cargo.toml b/crates/matrix-sdk/Cargo.toml index 4b2d4ccd9..dd95cfd6b 100644 --- a/crates/matrix-sdk/Cargo.toml +++ b/crates/matrix-sdk/Cargo.toml @@ -24,12 +24,13 @@ default = [ "native-tls" ] -indexeddb_stores = ["matrix-sdk-indexeddb"] +indexeddb_state_store = ["matrix-sdk-indexeddb"] +indexeddb_cryptostore = ["matrix-sdk-indexeddb/encryption", "encryption"] encryption = ["matrix-sdk-base/encryption"] qrcode = ["encryption", "matrix-sdk-base/qrcode"] # TODO merge those two sled features sled_state_store = ["matrix-sdk-sled"] -sled_cryptostore = ["matrix-sdk-sled", "encryption"] +sled_cryptostore = ["matrix-sdk-sled/encryption", "encryption"] markdown = ["ruma/markdown"] native-tls = ["reqwest/native-tls"] rustls-tls = ["reqwest/rustls-tls"] @@ -69,8 +70,8 @@ url = "2.2.2" zeroize = "1.3.0" async-stream = "0.3.2" -matrix-sdk-sled = { path = "../matrix-sdk-sled", optional = true } -matrix-sdk-indexeddb = { path = "../matrix-sdk-indexeddb", optional = true } +matrix-sdk-sled = { path = "../matrix-sdk-sled", default-features = false, optional = true } +matrix-sdk-indexeddb = { path = "../matrix-sdk-indexeddb", default-features = false, optional = true } [dependencies.image] version = "0.24.0" diff --git a/crates/matrix-sdk/examples/autojoin.rs b/crates/matrix-sdk/examples/autojoin.rs index 865460db1..82046bae4 100644 --- a/crates/matrix-sdk/examples/autojoin.rs +++ b/crates/matrix-sdk/examples/autojoin.rs @@ -45,9 +45,9 @@ async fn login_and_sync( username: &str, password: &str, ) -> Result<(), matrix_sdk::Error> { - #[cfg(not(any(feature = "sled_state_store", feature = "indexeddb_stores")))] + #[cfg(not(any(feature = "sled_state_store", feature = "indexeddb_state_store")))] let client_config = ClientConfig::new(); - #[cfg(any(feature = "sled_state_store", feature = "indexeddb_stores"))] + #[cfg(any(feature = "sled_state_store", feature = "indexeddb_state_store"))] let mut client_config = ClientConfig::new(); #[cfg(feature = "sled_state_store")] @@ -59,7 +59,7 @@ async fn login_and_sync( client_config = client_config.state_store(Box::new(state_store)); } - #[cfg(feature = "indexeddb_stores")] + #[cfg(feature = "indexeddb_state_store")] { let state_store = matrix_sdk_indexeddb::StateStore::open(); client_config = client_config.state_store(Box::new(state_store)); diff --git a/crates/matrix-sdk/examples/command_bot.rs b/crates/matrix-sdk/examples/command_bot.rs index c5da4b604..f5f930747 100644 --- a/crates/matrix-sdk/examples/command_bot.rs +++ b/crates/matrix-sdk/examples/command_bot.rs @@ -37,9 +37,9 @@ async fn login_and_sync( username: String, password: String, ) -> Result<(), matrix_sdk::Error> { - #[cfg(not(any(feature = "sled_state_store", feature = "indexeddb_stores")))] + #[cfg(not(any(feature = "sled_state_store", feature = "indexeddb_state_store")))] let client_config = ClientConfig::new(); - #[cfg(any(feature = "sled_state_store", feature = "indexeddb_stores"))] + #[cfg(any(feature = "sled_state_store", feature = "indexeddb_state_store"))] let mut client_config = ClientConfig::new(); #[cfg(feature = "sled_state_store")] @@ -51,7 +51,7 @@ async fn login_and_sync( client_config = client_config.state_store(Box::new(state_store)); } - #[cfg(feature = "indexeddb_stores")] + #[cfg(feature = "indexeddb_state_store")] { let state_store = matrix_sdk_indexeddb::StateStore::open(); client_config = client_config.state_store(Box::new(state_store)); diff --git a/crates/matrix-sdk/examples/wasm_command_bot/Cargo.toml b/crates/matrix-sdk/examples/wasm_command_bot/Cargo.toml index ab735e69e..519bccc07 100644 --- a/crates/matrix-sdk/examples/wasm_command_bot/Cargo.toml +++ b/crates/matrix-sdk/examples/wasm_command_bot/Cargo.toml @@ -25,9 +25,9 @@ getrandom = { version = "0.2.4", features = ["js"] } [dependencies.matrix-sdk] path = "../.." default-features = false -features = ["native-tls", "encryption", "indexeddb_stores"] +features = ["native-tls", "encryption", "indexeddb_state_store", "indexeddb_cryptostore"] [workspace] [dev-dependencies] -wasm-bindgen-test = "0.2" \ No newline at end of file +wasm-bindgen-test = "0.2" diff --git a/crates/matrix-sdk/src/store.rs b/crates/matrix-sdk/src/store.rs index 12512fd23..cebe82a6b 100644 --- a/crates/matrix-sdk/src/store.rs +++ b/crates/matrix-sdk/src/store.rs @@ -29,7 +29,7 @@ //! [`StoreConfig`]: crate::config::StoreConfig //! [`ClientConfig::with_store_config()`]: crate::config::ClientConfig::with_store_config() -#[cfg(feature = "indexeddb_stores")] +#[cfg(any(feature = "indexeddb_state_store", feature = "indexeddb_cryptostore"))] pub use matrix_sdk_indexeddb::*; #[cfg(any(feature = "sled_state_store", feature = "sled_cryptostore"))] pub use matrix_sdk_sled::*; diff --git a/xtask/src/ci.rs b/xtask/src/ci.rs index 824b822e2..593874a4e 100644 --- a/xtask/src/ci.rs +++ b/xtask/src/ci.rs @@ -187,14 +187,14 @@ fn run_wasm_checks(cmd: Option) -> Result<()> { WasmFeatureSet::MatrixSdkNoDefault, "-p matrix-sdk \ --no-default-features \ - --features qrcode,encryption,indexeddb_stores,rustls-tls", + --features qrcode,encryption,indexeddb_state_store,indexeddb_cryptostore,rustls-tls", ), (WasmFeatureSet::MatrixSdkBase, "-p matrix-sdk-base"), (WasmFeatureSet::MatrixSdkCommon, "-p matrix-sdk-common"), (WasmFeatureSet::MatrixSdkCrypto, "-p matrix-sdk-crypto"), ( WasmFeatureSet::MatrixSdkIndexeddbStores, - "-p matrix-sdk --no-default-features --features indexeddb_stores,encryption,rustls-tls", + "-p matrix-sdk --no-default-features --features indexeddb_state_store,indexeddb_cryptostore,encryption,rustls-tls", ), ]);