Skip to content

Conversation

@simolus3
Copy link
Contributor

This adds the com.powersync:sqlite3multipleciphers package, providing encryption support.

The package works in different ways depending on the target:

  1. For konan targets, we replicate what static-sqlite3-driver does already, except that we download sqlite3mc instead of upstream SQLite.
  2. For Android and JVM targets, things are unfortunately much more complicated:
    • While the bundled-sqlite package technically allows using a custom native library, that library would have to contain JNI bindings matching the format expected by the current sources. Installing a custom native library happens through custom system sources, which breaks if some thing in the application loads the bundled driver before PowerSync.
    • So, this vendors both C++ and Kotlin sources for the bundled-sqlite package replacing the package with com.powersync.encryption.
    • For Android, we use the NDK integration for the Gradle plugin to build sources.
    • For the JVM, we have to compile the JNI library ourselves. This is super annoying in practice, I've ended up using llvm-mingw for Windows and a Docker-based build for Linux.

I think we should not build the JNI library as part of the CI given the massive hassle involved in setting up build dependencies. I've documented necessary steps for the build, but I think it would be easier to upload JNI binaries to the repository or with a custom GH release.

Todos:

  • Android: Add R8 rules, add device test.
  • JVM: Upload binaries somewhere, download them in build script.

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.

2 participants