Skip to content

Conversation

simolus3
Copy link
Contributor

@simolus3 simolus3 commented Jan 24, 2025

Since sqlite3_web: ^0.3.0, we can pass additional options from the client to the DatabaseController when opening a database. This implementation uses that in two steps:

  1. In powersync_core, introduce an additional option in the worker that will make it use multipleciphers-$vfs when we've set up a VFS named $vfs for a database.
  2. In powersync_sqlcipher, add a web implementation and set that option to enable the multipleciphers-based VFS.

This ensures that we're using an encryption-compatible VFS for the database. Applying encryption is then only a matter of setting the key pragma, which we can also do in the open factory.

To aid in downloading web assets for powersync_sqlcipher, I've moved the setup_web.dart into powersync_core. Botth powersync and powersync_sqlcipher can use that library to download the web workers and WASM assets. The only difference is that powersync_sqlcipher will download sqlite3mc.wasm instead of the regular one.

Closes #216

@simolus3 simolus3 force-pushed the feat/web-encryption branch from 2325fc5 to 4adfbc1 Compare January 27, 2025 15:54
@simolus3 simolus3 marked this pull request as ready for review January 28, 2025 08:17
@simolus3
Copy link
Contributor Author

Pana is failing because powersync/powersync_sqlcipher depend on changes in powersync_core, this should get resolved once we start the releases. I've prepared the changelogs with melos version and I can push the tags after a review.

@simolus3 simolus3 merged commit 98ef589 into main Jan 29, 2025
9 checks passed
@simolus3 simolus3 deleted the feat/web-encryption branch January 29, 2025 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web compatibility for powersync_sqlcipher

2 participants