- DATE:
- AUTHOR:
- PowerSync Product Team
Announcing SQLCipher Support for On-Device Database Encryption for PowerSync + React Native
We are excited to announce the release of SQLCipher support in the PowerSync OP-SQLite package, bringing robust on-device database encryption to apps utilizing our React Native SDK. This allows developers to protect sensitive data and meet legal requirements regarding the handling of personal user data.
SQLCipher provides transparent, secure 256-bit AES encryption of SQLite database files. It works by using an encryption key or passphrase which is used to derive an actual encryption key. This key/passphrase must be provided each time the database is accessed. SQL queries, inserts, updates, and other operations continue to work as they would with an unencrypted SQLite database.
Usage
Install @powersync/op-sqlite if you haven't yet.
To enable SQLCipher you need to add the following configuration option to your application's package.json
{
// your normal package.json
// ...
"op-sqlite": {
"sqlcipher": true
}
}
Additionally, add your SQLCipher encryption key to the OP-SQLite factory constructor:
const factory = new OPSqliteOpenFactory({
dbFilename: 'sqlite.db',
sqliteOptions: {
encryptionKey: 'sqlcipher-encryption-key'
}
});
See the PowerSync OP-SQLite package for more information.
Help and feedback
If you need any help getting started or have any questions, chat with us on Discord. We'd also love to hear your feedback.