Update clients to interact with (new) server encrypted databases (#2113)
This patch enables client to send encryption key header for encrypted
databases. The header we are required to send is
`x-turso-encryption-key`.
To connect with encrypted database, either remote or offline write, you
may use the builder pattern to provide the encryption context. Ex.:
```rust
let encryption = if let Ok(key) = std::env::var("LIBSQL_ENCRYPTION_KEY") {
Some(EncryptionContext {
key: EncryptionKey::Base64Encoded(key),
})
} else {
None
};
let db_builder =
Builder::new_synced_database(db_path, sync_url, auth_token).remote_encryption(encryption);
```
This patch also comes with a full example:
https://github.com/avinassh/libsql/blob/5b95a1928b821855fced3880caf7871ce032c58b/libsql/examples/encryption_sync.rs P
Pekka Enberg committed
a2e9dd44fa0b08271211b36ac5c01287e1d82149
Committed by GitHub <noreply@github.com>
on 7/4/2025, 5:37:05 PM