react-nativeencryptionsqlcipher

Use encrypted database in react-native


I need to create an encrypted database using SQL-cipher in react-native. To do that I found a react-native-sqlite-storage fork modified by Dryganet but there is no documentation to use it.

I've just started to look into react-native so any lead would be appreciated.


Solution

  • So I looked into it and the syntax for the fork is this:

    errorCB(err) {
      console.log("SQL Error: " + err);
    },
    
    openCB() {
      console.log("Database OPENED");
    },
    
    var database = await SQLite.openDatabase({"name": "test.db", "key": "password"}, openCB, errorCB);
    

    And the funny thing is it was right in front me XD.

    One can also use Realm database. It's easy to use and well documented and it supports react-native.