Skip to content

A SQLCipher module for nativescript application, inspired by nativescript-sqlite module.

License

Notifications You must be signed in to change notification settings

ZixiaoWang/nativescript-sqlcipher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nativescript Sqlcipher

A sqlcipher module for nativescript application.
Inspired by NathanaelA/Nativescript-Sqlite

Create/Open Database

Before creating database, nativescript-sqlcipher module must be imported.
var Database = require('nativescript-sqlcipher');
Then create a new database:
var sqlcipher = new Database(dbname, options, callbackFn)
where in nativescript-sqlite module, options only support readOnly property where now options can read key property as PRAGMA Key for database encryption.

  var options = {
    readOnly: false,
    key: 'Password'   // key must be a string
  }

If property key is missing, or in a wrong format. Database would not be encrypted.

Example

  var Database = require('nativescript-sqlcipher');

  var options = {
    key: 'Password'
  }
  var sqlcipher = new Database('myDatabase', options);  //sqlcipher is a Promise type
  sqlcipher
    .then( (db)=>{
      db.execSQL('CREATE TABLE my_first_table (name TEXT, age INTEGER);');
    }) 
    .catch( (err)=>{
      alert('Database creation failed.');
    })

Update Log

01 Dec 2017

Fixed Compiling Error in Xcode 9

06 Oct 2017

Added all updates to sqlcipher.ios.js from NathanaelA/Nativescript-Sqlite.

About

A SQLCipher module for nativescript application, inspired by nativescript-sqlite module.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published