Expand description

SQL State Storage for matrix-sdk

Usage


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)

[CryptoStore]

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.

About Trait bounds

The list of trait bounds may seem daunting, however all enabled database backends are supported.

Structs

SQL State Storage for matrix-sdk

Functions

Creates a new store confiig