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.

Using your existing application database

Make sure to set ignore_missing to true in your migrator, otherwise the migration will not find the migrations in this repository and fail.

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

Enums

Errors that can occur in the SQL Store

Functions

Creates a new store confiig

Type Definitions

Result type returned by SQL Store functions