Crates.io | matrix-sdk-sql |
lib.rs | matrix-sdk-sql |
version | 0.1.0-beta.2 |
source | src |
created_at | 2022-05-12 20:28:42.488301 |
updated_at | 2022-05-23 15:52:06.963215 |
description | SQL-Based State Storage for matrix-sdk |
homepage | |
repository | https://github.com/DarkKirb/matrix-sdk-statestore-sql |
max_upload_size | |
id | 585464 |
size | 194,200 |
This crate allows you to use your postgres/sqlite database as a state and crypto store for matrix-sdk.
rustls
: Enables the rustls TLS backend in sqlx and matrix-sdknative-tls
: Enables the native-tls TLS backend in sqlx and matrix-sdk (enabled by default)postgres
: Enables support for postgres databases (enabled by default)sqlite
: Enables support for sqlite databasese2e-encryption
Enables the CryptoStoreExactly one of rustls
and native-tls
need to be enabled. At least one of postgres
or sqlite
must be enabled.
The MSRV is currently 1.60.0.
Increasing the MSRV is a breaking change.
This crate integrates with your existing SQLx database pool.
let sql_pool: Arc<sqlx::Pool<DB>> = /* ... */;
// Create the store config
let store_config = matrix_sdk_sql::store_config(sql_pool, Some(std::env::var("MYAPP_SECRET_KEY")?)).await?;
After that you can pass it into your client builder as follows:
let client_builder = Client::builder()
/* ... */
.store_config(store_config)
Enabling the e2e-encryption
feature enables cryptostore functionality. To protect encryption session information, the contents of the tables are encrypted in the same manner as in matrix-sdk-sled
.
Before you can use cryptostore functionality, you need to unlock the cryptostore:
let mut state_store = /* as above */;
state_store.unlock_with_passphrase(std::env::var("MYAPP_SECRET_KEY")?).await?;
If you are using the store_config
function, the store will be automatically unlocked for you.
This project is licensed under the Apache-2.0 License - see the LICENSE.md file for details
Charlotte |