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 and Android. 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) {
  // When using Commercial or Enterprise packages you must call PRAGMA cipher_license with a valid License Code.
  // Failure to provide a license code will result in an SQLITE_AUTH(23) error.
  // Trial licenses are available at https://www.zetetic.net/sqlcipher/trial/
  this.db = window.sqlcipherPlugin.openDatabase({ name: this.databaseFile, password: this.databasePassword, 
                     license: "YOUR LICENSE CODE 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;
  function () {
      console.log("deleted:" + self.databaseFile);
  }, function () {
      console.log("failed to delete:" + self.databaseFile);