I am creating a database in Flutter by the following code, is there any way we can encrypt the database?
Is there any library available for Flutter?
initDb() async {
io.Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "test.db");
var theDb = await openDatabase(path, version: 1, onCreate: _onCreate);
return theDb;
}
Pointy Castle seems to be the encryption library of choice at the moment.
I am also looking for such a library today.
And finally I found flutter_sqlcipher in pub.dev, which really solved my problem.
Here is the description of it.
Hope it helps you.
Current sqflite uses whatever sqlite version the platform provides. There is a discussion about that here that you could follow here: https://github.com/tekartik/sqflite/issues/32
The only solution I am aware now is this one https://github.com/QwilApp/encrypted_sqlite which can be used as a drop-in replacement to sqflite which as you stated uses SQLCipher on the native side