Skip to content

Encryption support#82

Merged
simolus3 merged 3 commits intomainfrom
encryption
Jan 20, 2026
Merged

Encryption support#82
simolus3 merged 3 commits intomainfrom
encryption

Conversation

@simolus3
Copy link
Contributor

@simolus3 simolus3 commented Oct 17, 2025

With the latest CSQLite and Kotlin SDK release, we can finally support encryption in the Swift SDK as well. On the SDK, the only change is that we add a parameter controlling which statements to run when databases are opened. This allows running a pragma key = to set encryption keys.

Actually using encryption is a bit trickier:

  • The CSQLite package exports encryption support as a SwiftPM package trait.
  • So ideally our Swift SDK would have the same trait and then depend on CSQLite, forwarding the trait. This is not supported by SwiftPM though.
  • And even if it were supported, XCode doesn't support setting package traits on dependencies.

As a workaround, users have to:

  • Add a local Package.swift setup somewhere in their project sources.
  • In that project, depend on CSQLite with the encryption trait.
  • Then depend on that local project from XCode. Since the CSQLite package can only appear once in the entire dependency graph, this makes XCode enable the trait.
  • Add an initializing statement to configure encryption.

This also adds a new Demo project following those steps.

@simolus3 simolus3 changed the title Experimenting with encryption Encryption support Jan 19, 2026
@simolus3 simolus3 marked this pull request as ready for review January 19, 2026 14:25
Copy link
Contributor

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I left some comments for some minor items I think may be outstanding.

Copy link
Contributor

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy with the changes :)

@simolus3 simolus3 merged commit 5b9e781 into main Jan 20, 2026
3 checks passed
@simolus3 simolus3 deleted the encryption branch January 20, 2026 10:29
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