SQLCipher Cordova Support

Enterprise Edition Feature

SQLCipher for Cordova encompasses a set of packages that provide full database encryption for applications which use standard web technologies for cross-platform development including iOS, Android, Windows UAP, and macOS. These libraries makes it quick and easy to integrate SQLCipher’s AES-256 full database encryption into any application, and they are fully interoperable with other SQLCipher platform libraries. No special knowledge of cryptography is required. SQLCipher takes care of data security behind the scenes with a small footprint and great performance. Support for Cordova is available only with the Enterprise Edition of SQLCipher.

Initialize database connection:

db: null,
databaseFile: "sqlcipher.db",
databasePassword: "test", 
runSQLCipher: function () { 
if (this.db == null) {
  this.db = window.sqlcipherPlugin.openDatabase({ name: this.databaseFile, password: this.databasePassword, 
                     license: "YOUR LICENSE KEY HERE" }); 
}

Executing a query:

this.db.transaction(function (tx) {
    tx.executeSql("PRAGMA cipher_version;", [], function (tx, res) {
       console.log("SQLCipher cipher version:" + res.rows.item(0).cipher_version); 
    });
});

Deleting the database:

var self = this;
window.sqlcipherPlugin.deleteDatabase(this.databaseFile,
  function () {
      console.log("deleted:" + self.databaseFile);
  }, function () {
      console.log("failed to delete:" + self.databaseFile);
});