npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@armortext/sqlcipher

v0.1.5

Published

Cross-platform SQLCipher

Downloads

4

Readme

@armortext/sqlcipher

Cross-platform (win32-x64, darwin-x64, linux-x64) binary distribution of sqlite3 with sqlcipher and fts support

This is experimental work and has not been tested in production deployments yet.

The intent of this package is to script use of node-sqlite3 and node-pre-gyp for building, packaging and deploying binaries of sqlite3 with sqlcipher and fts extensions targeting latest node-webkit (0.23.7, 0.24.4, 0.25.4, 0.26.6, 0.27.1), electron (1.7.x, 1.8.x) and node (8.9.3, 9.3.0).

When building app for node-webkit or electron we tend to prepare binary for target platform as part of the build process, so there is no need for node-pre-gyp and its dependencies at runtime, the only dependency that we need is semver.

In 0.1.x builds we are going to use the following:

  • OpenSSL will be rebuilt from node deps openssl source (node-9.3.0, openssl-1.0.2m) with crypto that is required for SQLCipher and linked statically (electron does not expose openssl crypto symbols, database gets corrupted on node-webkit if dynamically linking with its openssl on macOS).
  • When possible it will fallback to dynamically linked crypto that is bundled with node instead of rebuilding it.
  • SQLCipher will be based on https://github.com/sqlcipher/sqlcipher/tree/v3.4.1, patched (can be skipped) to build sqlite3 amalgamation tar file.

In the future we might consider switching to https://conan.io for openssl / sqlcipher libraries and get npm package rebuilt by TravisCI and Appveyor, but we are not there yet.

It does not seem likely that we can use dockcross to produce libraries for windows - https://github.com/nodejs/node-gyp/issues/660, so they have to be built on windows boxes (unless clang can be used for cross-builds, i.e. via wclang).

Currently we use curl and tar installed on the box when building from source, this should be moved to javascript or python (used via binding.gyp) to have less dependencies / make it more portable.

We should also consider supporting other crypto options, like LibTomCrypt / BoringSSL / LibreSSL and no-asm option for OpenSSL when linking crypto statically for electron / node-webkit.

In 0.2.x we probably should switch from NAN to N-API and move this module to github:

https://nodejs.org/docs/latest/api/n-api.html https://github.com/nodejs/abi-stable-node https://github.com/mhdawson/node-sqlite3/tree/node-addon-api

# some global setup to be able to build local modules
# on linux that might need to be prefixed with sudo and 
npm install -g node-gyp
npm install -g node-pre-gyp
npm install -g nw-gyp
# install run node-webkit and electron globally (optional)
npm install -g [email protected]
npm install -g [email protected]
# setup windows-build-tools if building from source on windows
npm install -g --prod --add-python-to-path windows-build-tools
# to prepare dependencies in case some tools (curl, tar) are not installed by running it via docker
npm run docker-deps
# patch nw-gyp if building from source on linux
./linux-patch-nw-gyp.sh
# for quick demo in node-webkit and electron that installed as dev dependencies
npm run quick-demo
npm run demo
npm run clean-all
# quick check with latest public version and globally installed node-webkit and electron
(cd /tmp &&\
 rm -rf sqlcipher-demo &&\
 mkdir -p sqlcipher-demo &&\
 cd sqlcipher-demo &&\
 npm install @armortext/sqlcipher --only=prod &&\
 cd node_modules/@armortext/sqlcipher &&\
 npm run demo &&\
 npm run electron-check &&\
 npm run nw-check &&\
 npm run clean-all)
# to download electron and node-webkit as part of the demo when they are not installed globally
(cd /tmp &&\
 rm -rf sqlcipher-demo &&\
 mkdir -p sqlcipher-demo &&\
 cd sqlcipher-demo &&\
 npm install @armortext/sqlcipher --only=prod &&\
 cd node_modules/@armortext/sqlcipher &&\
 npm run demo &&\
 npm run electron-demo &&\
 npm run nw-demo &&\
 npm run clean-all)
# to make latest binaries for a particular platform available and to publish package to npmjs.com
npm install
npm run deploy
npm publish --access public
npm run clean
# in case we are building for linux on some other platform (i.e. macOS) we'll just use docker
npm run linux-deploy
# to build and publish for node-webkit and electron
npm install --runtime=node-webkit --target=0.27.1 --target_arch=x64 --build-from-source
./node_modules/.bin/node-pre-gyp unpublish --runtime=node-webkit --target=0.27.1 --target_arch=x64
./node_modules/.bin/node-pre-gyp package publish --runtime=node-webkit --target=0.27.1 --target_arch=x64
npm install --runtime=electron --target=1.8.2-beta.3 --target_arch=x64 --build-from-source
./node_modules/.bin/node-pre-gyp unpublish --runtime=electron --target=1.8.2-beta.3 --target_arch=x64
./node_modules/.bin/node-pre-gyp package publish --runtime=electron --target=1.8.2-beta.3 --target_arch=x64
npm run clean
# to check binary published for node-webkit and electron distributions
npm run quick-check
npm run clean-all
# to (re)install binary for a specific node-webkit and electron distributions as part of build process
npm install --only=prod
node-pre-gyp install --runtime=node-webkit --target=0.27.1 --target_arch=x64 --target_platform=linux --update-binary
node-pre-gyp install --runtime=electron --target=1.8.2-beta.3 --target_arch=x64 --target_platform=linux --update-binary
npm install shelljs yargs --no-save && npm run clean
# install prod dependencies
npm i semver --save

# install dev dependencies
npm i shelljs yargs node-pre-gyp --save-dev

# for node.js
npm i @armortext/sqlcipher

# for node-webkit
npm i @armortext/sqlcipher --runtime=node-webkit --target=0.27.1 --target_arch=x64

# for electron
npm i @armortext/sqlcipher --runtime=electron --target=1.8.2-beta.3 --target_arch=x64

# from a mirror
npm i @armortext/sqlcipher --sqlcipher_binary_host_mirror=https://cdn.armortext.com
const sqlcipher = require('@armortext/sqlcipher').verbose();
const db = new sqlcipher.Database('test.db');

db.serialize(function() {
  db.run("PRAGMA KEY = 'secret'");
  db.run("PRAGMA CIPHER = 'aes-256-cbc'");

  db.run("DROP TABLE IF EXISTS lorem");
  db.run("CREATE TABLE lorem (info TEXT)");

  const stmt = db.prepare("INSERT INTO lorem VALUES (?)");
  for (let 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();