litestream icon indicating copy to clipboard operation
litestream copied to clipboard

sync a libsql encrypted database ?

Open Fadlo31 opened this issue 5 months ago • 3 comments

i have encrypted libsql database .. is there any chance i can provide the key used and start transferring ?

Fadlo31 avatar Jul 19 '25 23:07 Fadlo31

See my SQLcipher integration for the WAL version of litestream. I'm using this with a Swift Vapor app backing up to S3-compatible storage.

New LTX litestream uses a different underlying SQLite driver. Dunno whether that supports SQLcipher.

talmeme avatar Oct 16 '25 01:10 talmeme

So, LTX uses modernc-sqlite, and the work to add SQLcipher to it appears to be substantially more than adding to mattn-sqlite3 which the WAL version uses.

talmeme avatar Oct 16 '25 03:10 talmeme

libsql uses SQLite3 Multiple Ciphers, not SQLcipher.

SQLite3 Multiple Ciphers uses SQLite's VFS mechanism, unlike SQLcipher which uses SQLite's old codec hooks. The question becomes: Does modernc-sqlite support SQLite3 Multiple Ciphers?

talmeme avatar Oct 16 '25 03:10 talmeme

@benbjohnson - wanted to get your input on this one before closing or pursuing.

Current situation:

  • Litestream v0.5+ uses modernc-sqlite (pure Go SQLite) which doesn't support SQLcipher or SQLite3 Multiple Ciphers
  • libsql uses SQLite3 Multiple Ciphers for encryption
  • The upstream issue for adding cipher support to modernc-sqlite is: https://gitlab.com/cznic/sqlite/-/issues/138

Question: Is this something worth pursuing? With AI assistance, creating a PR for the upstream modernc-sqlite project to add cipher support might be more feasible than it would have been previously. It would still be a significant undertaking, but potentially doable.

Options:

  1. Close as won't fix - encryption support is out of scope
  2. Keep open as long-term - track as dependent on upstream changes
  3. Actively pursue - we could attempt to contribute cipher support upstream to modernc-sqlite

What's your preference?

corylanou avatar Dec 20 '25 19:12 corylanou