From f460101f4ec0421e869cd6ca01bfb4346814f877 Mon Sep 17 00:00:00 2001 From: Kegan Dougal <7190048+kegsay@users.noreply.github.com> Date: Fri, 12 Jul 2024 17:59:22 +0100 Subject: [PATCH 1/2] Encrypt the rust DB by default, to match EX --- internal/api/rust/rust.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/api/rust/rust.go b/internal/api/rust/rust.go index e364c15..fb4b3ca 100644 --- a/internal/api/rust/rust.go +++ b/internal/api/rust/rust.go @@ -73,7 +73,8 @@ func NewRustClient(t ct.TestLike, opts api.ClientCreationOpts) (api.Client, erro } // @alice:hs1, FOOBAR => alice_hs1_FOOBAR username := strings.Replace(opts.UserID[1:], ":", "_", -1) + "_" + opts.DeviceID - ab = ab.SessionPath("rust_storage/" + username).Username(username) + passphrase := "complement-crypto" + ab = ab.SessionPath("rust_storage/" + username).Username(username).Passphrase(&passphrase) client, err := ab.Build() if err != nil { return nil, fmt.Errorf("ClientBuilder.Build failed: %s", err) From 77c70940ec87eddfa7f712aef8235377026d7210 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 28 May 2026 23:12:49 +0100 Subject: [PATCH 2/2] Update to modern API The `Passphrase` method got renamed to `SessionPassphrase`, and then removed altogether in https://github.com/matrix-org/matrix-rust-sdk/commit/7c6ff517d5bdd60f3f7f547bc3a7e016fc72dc51. The modern way is to make our own SqliteStoreBuilder, instead of having SessionPaths do it for us. --- internal/api/rust/rust.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/api/rust/rust.go b/internal/api/rust/rust.go index c0a0083..f00d363 100644 --- a/internal/api/rust/rust.go +++ b/internal/api/rust/rust.go @@ -96,9 +96,14 @@ func NewRustClient(t ct.TestLike, opts api.ClientCreationOpts) (api.Client, erro } // @alice:hs1, FOOBAR => alice_hs1_FOOBAR username := strings.Replace(opts.UserID[1:], ":", "_", -1) + "_" + opts.DeviceID + ab = ab.Username(username) + sessionPath := "rust_storage/" + username - passphrase := "complement-crypto" - ab = ab.SessionPaths(sessionPath, sessionPath).Username(username).Passphrase(&passphrase) + storeKey := []byte("my_secret_thirty-two_byte_string") + ab = ab.SqliteStore( + matrix_sdk_ffi.NewSqliteStoreBuilder(sessionPath, sessionPath).Key(&storeKey), + ) + client, err := ab.Build() if err != nil { return nil, fmt.Errorf("ClientBuilder.Build failed: %s", err)