evolu icon indicating copy to clipboard operation
evolu copied to clipboard

Reconsider wa-sqlite

Open steida opened this issue 1 year ago • 7 comments

"That said: i recognize that your understanding of the wider implications exceeds mine and i'm wide open to suggestions."

https://sqlite.org/forum/info/a2f573b00cda1372

Evolu used wa-sqlite, but switched to the official SQL WASM. I think we should rethink that decision.

https://github.com/rhashimoto/wa-sqlite/

steida avatar Jun 30 '24 19:06 steida

https://github.com/rhashimoto/wa-sqlite/discussions/173

steida avatar Jun 30 '24 19:06 steida

Maybe that one will work with Firefox Offilne Mode as well https://github.com/evoluhq/evolu/issues/424

negue avatar Jun 30 '24 20:06 negue

@negue That's perfectly possible.

steida avatar Jun 30 '24 20:06 steida

Would wa-sqlite support encryption as well? cc https://github.com/evoluhq/evolu/issues/291

negue avatar Jun 30 '24 22:06 negue

Sure

steida avatar Jul 01 '24 07:07 steida

Would wa-sqlite support encryption as well?

@negue None of the example VFS classes in the wa-sqlite project include encryption. I'm not aware of any third-party efforts to combine encryption with wa-sqlite.

SQLite3MultipleCiphers might work with some VFS classes if you can get it to build in your own wa-sqlite fork. I haven't used it myself, but its description says it is implemented as a shim VFS that calls an underlying VFS to perform the actual I/O. This won't work with a number of the example VFS classes because they parse the database header, but I think it would work with the OPFS classes other than OPFSPermutedVFS.

The SQLite3MultipleCiphers approach performs encryption above the actual VFS (i.e. the VFS only sees encrypted data). An alternative would be to modify the read and write operations in an existing VFS class to perform encryption below the VFS code. This would be more difficult and requires that you know/learn a bit more about both VFS internals and cryptography, but it is a viable option in case SQLite3MultipleCiphers doesn't work out.

rhashimoto avatar Jul 11 '24 17:07 rhashimoto

@rhashimoto Thank you for the correction.

steida avatar Jul 11 '24 19:07 steida

Closing as this is no longer relevant—the new Evolu launches tomorrow. Feel free to reopen if it becomes relevant with the new Evolu.

steida avatar May 24 '25 18:05 steida

Support for wa-sqlite would be nice, for using Evolu in browser extensions (even without encryption support). Background scripts in chrome extensions have issues with OPFS based sqlite-wasm worker.

ciju avatar Oct 06 '25 18:10 ciju

We can make it optional, let's discuss it on our discord

steida avatar Oct 07 '25 13:10 steida