All Projects → journeyapps → Node Sqlcipher

journeyapps / Node Sqlcipher

Licence: bsd-3-clause
SQLCipher bindings for Node

Projects that are alternatives of or similar to Node Sqlcipher

Bible Database
Bible databases as XML, JSON, SQL & SQLITE3 Database format for various languages. Developers can download it freely for their development works. Freely received, freely give.
Stars: ✭ 111 (-2.63%)
Mutual labels:  plpgsql, sqlite
Next
Directus is a real-time API and App dashboard for managing SQL database content. 🐰
Stars: ✭ 111 (-2.63%)
Mutual labels:  sqlite
Longevity
A Persistence Framework for Scala and NoSQL
Stars: ✭ 103 (-9.65%)
Mutual labels:  sqlite
Screampay
screamPay聚合支付,一个强大到让你尖叫的聚合支付系统,使用Java开发,spring-boot架构,已接入环讯、九派、杉德等主流支付渠道,可直接用于生产环境。
Stars: ✭ 107 (-6.14%)
Mutual labels:  plpgsql
Postgraphile Lambda Example
Simple serverless / Lambda example with caching and lightweight bundle
Stars: ✭ 104 (-8.77%)
Mutual labels:  plpgsql
Common schema
DBA's framework for MySQL
Stars: ✭ 108 (-5.26%)
Mutual labels:  plpgsql
Sqlite3 Encryption
The easiest way to build SQLite3 with encryption support on Windows. Compilation of DLL, SLL or shell is now a matter of minutes
Stars: ✭ 102 (-10.53%)
Mutual labels:  sqlite
Polysemycleanarchitecture
Showcasing how the Polysemy library can be used to implement a REST application conforming to the guidelines of the Clean Architecture model.
Stars: ✭ 106 (-7.02%)
Mutual labels:  sqlite
Sqlite For Beginners 2019
SQLite on Android with Room Persistence Library (beginner course)
Stars: ✭ 107 (-6.14%)
Mutual labels:  sqlite
Kripton
A Java/Kotlin library for Android platform, to manage bean's persistence in SQLite, SharedPreferences, JSON, XML, Properties, Yaml, CBOR.
Stars: ✭ 110 (-3.51%)
Mutual labels:  sqlite
Gtfspy
Public transport network analysis using Python 🚊🚇🚃🚌🛳️🚡🚠🚞
Stars: ✭ 104 (-8.77%)
Mutual labels:  sqlite
Aws Database Migration Samples
A set of sample database and associated items to allow customers to among other things follow along with published database migration recipes.
Stars: ✭ 105 (-7.89%)
Mutual labels:  plpgsql
Ugin
UGin is an API boilerplate written in Go (Golang) with Gin Framework.
Stars: ✭ 110 (-3.51%)
Mutual labels:  sqlite
Minisqlquery
Minimalist SQL Query tool for any .NET DB Provider - SQL, SQLite, SQL CE, Oracle, Access...
Stars: ✭ 103 (-9.65%)
Mutual labels:  sqlite
Triprecord
咔咔出行——基于高德地图API,Vue+Express实现的移动端webapp,服务器受到攻击网站暂时下掉了
Stars: ✭ 1,495 (+1211.4%)
Mutual labels:  plpgsql
Plpgunit
PostgreSQL Unit Testing Framework
Stars: ✭ 102 (-10.53%)
Mutual labels:  plpgsql
Panda Cloud
Base on SpringCloud MicroService Framework
Stars: ✭ 108 (-5.26%)
Mutual labels:  plpgsql
Sqhell.vim
An SQL wrapper for vim
Stars: ✭ 113 (-0.88%)
Mutual labels:  sqlite
Testable Nodejs Api
Código da série Node.js API testável disponivel no meu canal no youtube
Stars: ✭ 110 (-3.51%)
Mutual labels:  sqlite
Mhworlddata
Generate a SQLite file from MHW data
Stars: ✭ 110 (-3.51%)
Mutual labels:  sqlite

Fork of node-sqlite3, modified to use SQLCipher.

While the node-sqlite3 project does include support for compiling against sqlcipher, it requires manual work, and does not work out-of-the-box on Electron on Windows. This fork changes the default configuration to bundle SQLCipher directly, as well as OpenSSL where required.

Supported platforms

Binaries are built against N-API 3 and 6, on MacOS, Windows (ia32 and x64) and Linux (x64).

Node 10+ and Electron 6+ is supported.

Other platforms/architectures may work by building from source - see the section below.

Installation

yarn add "@journeyapps/sqlcipher"
# Or: npm install --save "@journeyapps/sqlcipher"

Usage

var sqlite3 = require('@journeyapps/sqlcipher').verbose();
var db = new sqlite3.Database('test.db');

db.serialize(function() {
  // This is the default, but it is good to specify explicitly:
  db.run("PRAGMA cipher_compatibility = 4");

  // To open a database created with SQLCipher 3.x, use this:
  // db.run("PRAGMA cipher_compatibility = 3");

  db.run("PRAGMA key = 'mysecret'");
  db.run("CREATE TABLE lorem (info TEXT)");

  var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
  for (var i = 0; i < 10; i++) {
      stmt.run("Ipsum " + i);
  }
  stmt.finalize();

  db.each("SELECT rowid AS id, info FROM lorem", function(err, row) {
      console.log(row.id + ": " + row.info);
  });
});

db.close();

SQLCipher

A copy of the source for SQLCipher 4.4.2 is bundled, which is based on SQLite 3.33.0.

Building from source.

This is done automatically by node-pre-gyp when installing on a platform without pre-built binaries. This should generally not be required with later versions, since two pre-built versions (N-API 3 and N-API 6) cover all electron and node versions.

However, this does require some additional setup, and is likely to run against obscure errors when installing.

Requirements:

Mac

Windows

  • Visual Studio 2015
  • Python 2.7

Usage with electron-forge / electron-rebuild

electron-forge uses electron-rebuild and attempts to rebuild this library from source by default, in a way that is not compatible with the way node-pre-gyp is used here.

The workaround is to disable the rebuilding:

  1. If using Electron 11+, use a node version that supports N-API 6+ (v10.20.0+ / v12.17.0+ / v14.0.0).

  2. After npm install / yarn install, make sure that the folder node_modules/@journeyapps/sqlcipher/lib/binding/napi-v6-linux-x64 exists. If not, check the previous step again, remove the node_modules folder, and try again.

  3. Disable rebuilding of this library using the onlyModules option of electron-rebuild in your package.json:

     "config": {
         "forge": {
             "electronRebuildConfig": {
                 "onlyModules": []  // Specify other native modules here if required
             }
         }
     }
    

Note: electron-builder does not appear to have this issue, and should work directly. Similarly, using electron directly should just work, but do check that a compatible node version is used (see above).

OpenSSL

SQLCipher depends on OpenSSL.

For Windows, we bundle OpenSSL 1.1.1i. Binaries are generated using vckpg (e.g., .\vcpkg\vcpkg install openssl:x64-windows-static).

On Mac we build against OpenSSL installed via brew, but statically link it so that end-users do not need to install it.

On Linux we dynamically link against the system OpenSSL.

API

See the API documentation in the wiki.

Documentation for the SQLCipher extension is available here.

Testing

mocha is required to run unit tests.

In sqlite3's directory (where its package.json resides) run the following:

npm install --build-from-source
npm test

Publishing

To publish a new version, run:

npm version minor -m "%s [publish binary]"
npm publish

Publishing of the prebuilt binaries is performed on CircleCI.

Acknowledgments

Most of the work in this library is from the node-sqlite3 library by MapBox.

Additionally, some of the SQLCipher-related changes are based on a fork by liubiggun.

License

node-sqlcipher is BSD licensed.

SQLCipher is Copyright (c) 2016, ZETETIC LLC under the BSD license.

SQLite is Public Domain

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].