Skip to content

SQLCipher support? #5

Answered by rkistner
lcarrasco asked this question in Q&A
Discussion options

You must be logged in to vote

It's possible, but requires some additional work at the moment.

Load the SQLCipher libraries instead of SQLite

For Flutter, use sqlcipher_flutter_libs instead of sqlite3_flutter_libs. See the linked documentation for details.

For CLI Dart apps, this may be a little more involved. See this example for manually providing the compiled library path.

Set the key in each connection

A custom SQLiteOpenFactory is required for this, for example:

class SqlcipherOpenFactory extends DefaultSqliteOpenFactory {
  String? key;

  SqlcipherOpenFactory({required super.path, super.sqliteOptions, this.key});

  @override
  sqlite.Database open(SqliteOpenOptions options) {
    final db = super.open(options);…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by phillvdm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants