better-sqlite3-multiple-ciphers 7.4.4 → 7.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ name: prebuild
3
3
  on:
4
4
  release:
5
5
  types:
6
- - released
6
+ - published
7
7
 
8
8
  jobs:
9
9
  prebuild:
@@ -22,9 +22,9 @@ jobs:
22
22
  node-version: 16
23
23
  - run: npm install --ignore-scripts
24
24
  - run: npx --no-install prebuild -r node -t 10.20.0 -t 12.0.0 -t 14.0.0 -t 16.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}
25
- - run: npx --no-install prebuild -r electron -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}
25
+ - run: npx --no-install prebuild -r electron -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -t 16.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}
26
26
  - if: matrix.os == 'windows-latest'
27
- run: npx --no-install prebuild -r electron -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 --include-regex 'better_sqlite3.node$' --arch ia32 -u ${{ secrets.GITHUB_TOKEN }}
27
+ run: npx --no-install prebuild -r electron -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -t 16.0.0 --include-regex 'better_sqlite3.node$' --arch ia32 -u ${{ secrets.GITHUB_TOKEN }}
28
28
 
29
29
  prebuild-alpine:
30
30
  name: Prebuild on alpine
@@ -35,3 +35,15 @@ jobs:
35
35
  - run: apk add build-base git python3 --update-cache
36
36
  - run: npm install --ignore-scripts
37
37
  - run: npx --no-install prebuild -r node -t 10.20.0 -t 12.0.0 -t 14.0.0 -t 16.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}
38
+
39
+ prebuild-alpine-arm64:
40
+ name: Prebuild on alpine (arm64)
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: docker/setup-qemu-action@v1
44
+ - run: |
45
+ docker run --rm --entrypoint /bin/sh --platform linux/arm64 node:16-alpine -c "apk add build-base git python3 --update-cache && \
46
+ git clone ${{ github.event.repository.clone_url }} && \
47
+ cd ${{ github.event.repository.name }} && \
48
+ npm install --ignore-scripts && \
49
+ npx --no-install prebuild -r node -t 10.20.0 -t 12.0.0 -t 14.0.0 -t 16.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}"
@@ -0,0 +1,59 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ - dev
8
+ pull_request:
9
+ branches:
10
+ - master
11
+ workflow_dispatch:
12
+
13
+ jobs:
14
+ test:
15
+ strategy:
16
+ matrix:
17
+ os:
18
+ - ubuntu-18.04
19
+ - macos-latest
20
+ - windows-latest
21
+ node:
22
+ - 10
23
+ - 12
24
+ - 14
25
+ - 16
26
+ name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
27
+ runs-on: ${{ matrix.os }}
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - uses: actions/setup-node@v2
31
+ with:
32
+ node-version: ${{ matrix.node }}
33
+ - run: npm install --ignore-scripts
34
+ - run: npm run build-debug
35
+ - run: npm test
36
+
37
+ test-alpine:
38
+ name: Testing Node 16 on apline
39
+ runs-on: ubuntu-latest
40
+ container: node:16-alpine
41
+ steps:
42
+ - uses: actions/checkout@v2
43
+ - run: apk add build-base git python3 --update-cache
44
+ - run: npm install --ignore-scripts
45
+ - run: npm run build-debug
46
+ - run: npm test
47
+
48
+ test-alpine-arm64:
49
+ name: Testing Node 16 on apline (arm64)
50
+ runs-on: ubuntu-latest
51
+ steps:
52
+ - uses: docker/setup-qemu-action@v1
53
+ - run: |
54
+ docker run --rm --entrypoint /bin/sh --platform linux/arm64 node:16-alpine -c "apk add build-base git python3 --update-cache && \
55
+ git clone ${{ github.event.repository.clone_url }} && \
56
+ cd ${{ github.event.repository.name }} && \
57
+ npm install --ignore-scripts && \
58
+ npm run build-debug && \
59
+ npm test"
package/LICENSE CHANGED
@@ -1,5 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
+ Copyright (c) 2021 Mahesh Bandara Wijerathna
3
4
  Copyright (c) 2017 Joshua Wise
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # better-sqlite3-multiple-ciphers
2
2
 
3
+ [![NPM version](https://img.shields.io/npm/v/better-sqlite3-multiple-ciphers?logo=npm&color=cc3838&style=for-the-badge)](https://www.npmjs.com/package/better-sqlite3-multiple-ciphers)
4
+ [![Downloads](https://img.shields.io/npm/dt/better-sqlite3-multiple-ciphers?logo=DocuSign&logoColor=FFF&color=2757c4&style=for-the-badge)](https://www.npmjs.com/package/better-sqlite3-multiple-ciphers)
5
+ [![Build status](https://img.shields.io/github/workflow/status/m4heshd/better-sqlite3-multiple-ciphers/test?label=Build%2FTest&logo=github&style=for-the-badge)](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/actions/workflows/test.yml)
6
+
3
7
  The fastest and simplest library for SQLite3 in Node.js. This particular fork supports multiple-cipher encryption using [SQLite3MultipleCiphers](https://github.com/utelle/SQLite3MultipleCiphers). Check [usage](#usage) to learn more.
4
8
 
5
9
  - Full transaction support
@@ -8,12 +12,19 @@ The fastest and simplest library for SQLite3 in Node.js. This particular fork su
8
12
  - Support for user-defined functions, aggregates, virtual tables, and extensions
9
13
  - 64-bit integers *(invisible until you need them)*
10
14
  - Worker thread support *(for large/slow queries)*
15
+ - Encryption support using multiple algorithms
11
16
 
12
17
  ## Current versions
13
18
 
14
- - **better-sqlite3-multiple-ciphers** - `7.4.4`
15
- - **SQLite** - `3.36.0`
16
- - **SQLite3 Multiple Ciphers** - `1.3.4`
19
+ - ### Stable
20
+ - **better-sqlite3-multiple-ciphers** - [`7.4.6`](https://www.npmjs.com/package/better-sqlite3-multiple-ciphers/v/7.4.6)
21
+ - **SQLite** - `3.36.0`
22
+ - **SQLite3 Multiple Ciphers** - `1.3.4`
23
+
24
+ - ### Beta
25
+ - **better-sqlite3-multiple-ciphers** - [`7.4.6-beta.0`](https://www.npmjs.com/package/better-sqlite3-multiple-ciphers/v/7.4.6-beta.0)
26
+ - **SQLite** - `3.37.0`
27
+ - **SQLite3 Multiple Ciphers** - `1.3.5`
17
28
 
18
29
  ## Help this project stay strong! 💪
19
30
 
@@ -25,6 +36,10 @@ The fastest and simplest library for SQLite3 in Node.js. This particular fork su
25
36
 
26
37
  Also head over to [SQLite3MultipleCiphers](https://github.com/utelle/SQLite3MultipleCiphers) repo and give some support to the developer to keep this very useful extension alive.
27
38
 
39
+ You can also support me (the maintainer of this fork) by buying me a coffee. 😊
40
+
41
+ [![ko-fi](https://i.ibb.co/QmQknmc/ko-fi.png)](https://ko-fi.com/m4heshd)
42
+
28
43
  ## How other libraries compare
29
44
 
30
45
  | |select 1 row  `get()` |select 100 rows   `all()`  |select 100 rows `iterate()` 1-by-1|insert 1 row `run()`|insert 100 rows in a transaction|
@@ -36,11 +51,19 @@ Also head over to [SQLite3MultipleCiphers](https://github.com/utelle/SQLite3Mult
36
51
 
37
52
  ## Installation
38
53
 
54
+ ### Stable
55
+
39
56
  ```bash
40
57
  npm install better-sqlite3-multiple-ciphers
41
58
  ```
42
59
 
43
- > You must be using Node.js v10.20.1 or above. Prebuilt binaries are available for [LTS versions](https://nodejs.org/en/about/releases/).
60
+ ### Beta
61
+
62
+ ```bash
63
+ npm install better-sqlite3-multiple-ciphers@beta
64
+ ```
65
+
66
+ > You must be using Node.js v10.20.1 or above. Prebuilt binaries are available for Node.js [LTS versions](https://nodejs.org/en/about/releases/) and Electron. If you have trouble installing, check the [troubleshooting guide](./docs/troubleshooting.md).
44
67
 
45
68
  > If you have trouble installing, check the [troubleshooting guide](./docs/troubleshooting.md).
46
69
 
@@ -53,6 +76,13 @@ const row = db.prepare('SELECT * FROM users WHERE id = ?').get(userId);
53
76
  console.log(row.firstName, row.lastName, row.email);
54
77
  ```
55
78
 
79
+ ##### In ES6 module notation:
80
+
81
+ ```js
82
+ import Database from 'better-sqlite3-multiple-ciphers';
83
+ const db = new Database('foobar.db', options);
84
+ ```
85
+
56
86
  ### Encryption
57
87
 
58
88
  A database can be encrypted and decrypted simply using `key` and `rekey` `PRAGMA` statements.
package/deps/setup.ps1 CHANGED
@@ -2,7 +2,7 @@
2
2
  $ErrorActionPreference = "Stop"
3
3
 
4
4
  # SQLite Info
5
- $SQLITEMC_VER = "v1.3.4"
5
+ $SQLITEMC_VER = "v1.3.5"
6
6
  $API_URL = "https://api.github.com/repos/utelle/SQLite3MultipleCiphers/releases/tags/" + $SQLITEMC_VER
7
7
 
8
8
  # Paths
package/deps/sqlite3.gyp CHANGED
@@ -63,6 +63,10 @@
63
63
  ['OS=="win"', {
64
64
  'cflags!': ['-maes', '-msse4.2'],
65
65
  }],
66
+ ['target_arch=="arm64"', {
67
+ 'cflags!': ['-maes', '-msse4.2'],
68
+ 'cflags': ['-march=native'],
69
+ }],
66
70
  ],
67
71
  'configurations': {
68
72
  'Debug': {
Binary file
@@ -1,17 +1,17 @@
1
1
  # Custom configuration
2
2
 
3
- If you want to use a customized version of [SQLite3](https://www.sqlite.org) with `better-sqlite3`, you can do so by specifying the directory of your [custom amalgamation](https://www.sqlite.org/amalgamation.html) during installation.
3
+ If you want to use a customized version of [SQLite3](https://www.sqlite.org) with `better-sqlite3-multiple-ciphers`, you can do so by specifying the directory of your [custom amalgamation](https://www.sqlite.org/amalgamation.html) during installation.
4
4
 
5
5
  ```bash
6
- npm install better-sqlite3 --build-from-source --sqlite3=/path/to/sqlite-amalgamation
6
+ npm install better-sqlite3-multiple-ciphers --build-from-source --sqlite3=/path/to/sqlite-amalgamation
7
7
  ```
8
8
 
9
- However, if you simply run `npm install` while `better-sqlite3` is listed as a dependency in your `package.json`, the required flags above will *not* be applied. Therefore, it's recommended that you remove `better-sqlite3` from your dependency list, and instead add a [`preinstall` script](https://docs.npmjs.com/misc/scripts) like the one shown below.
9
+ However, if you simply run `npm install` while `better-sqlite3-multiple-ciphers` is listed as a dependency in your `package.json`, the required flags above will *not* be applied. Therefore, it's recommended that you remove `better-sqlite3-multiple-ciphers` from your dependency list, and instead add a [`preinstall` script](https://docs.npmjs.com/misc/scripts) like the one shown below.
10
10
 
11
11
  ```json
12
12
  {
13
13
  "scripts": {
14
- "preinstall": "npm install better-sqlite3@'^7.0.0' --no-save --build-from-source --sqlite3=\"$(pwd)/sqlite-amalgamation\""
14
+ "preinstall": "npm install better-sqlite3-multiple-ciphers@'^7.0.0' --no-save --build-from-source --sqlite3=\"$(pwd)/sqlite-amalgamation\""
15
15
  }
16
16
  }
17
17
  ```
@@ -20,7 +20,7 @@ Your amalgamation directory must contain `sqlite3.c` and `sqlite3.h`. Any desire
20
20
 
21
21
  ### Step by step example
22
22
 
23
- If you're creating a package that relies on a custom build of `better-sqlite3`, you can follow these steps to get started.
23
+ If you're creating a package that relies on a custom build of `better-sqlite3-multiple-ciphers`, you can follow these steps to get started.
24
24
 
25
25
  1. Download the SQLite3 source code from [their website](https://sqlite.com/download.html) (e.g., `sqlite-amalgamation-1234567.zip`)
26
26
  2. Unzip the compressed archive
@@ -34,7 +34,7 @@ If you're using a SQLite3 encryption extension that is a drop-in replacement for
34
34
 
35
35
  # Bundled configuration
36
36
 
37
- By default, this distribution currently uses SQLite3 **version 3.36.0** with the following [compilation options](https://www.sqlite.org/compile.html):
37
+ By default, this distribution currently uses SQLite3 **version 3.37.0** with the following [compilation options](https://www.sqlite.org/compile.html):
38
38
 
39
39
  ```
40
40
  SQLITE_DQS=0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-sqlite3-multiple-ciphers",
3
- "version": "7.4.4",
3
+ "version": "7.4.6",
4
4
  "description": "better-sqlite3 with multiple-cipher encryption support",
5
5
  "homepage": "https://github.com/m4heshd/better-sqlite3-multiple-ciphers",
6
6
  "author": "Mahesh Bandara Wijerathna (m4heshd) <m4heshd@gmail.com>",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "bindings": "^1.5.0",
14
- "prebuild-install": "^6.1.4",
14
+ "prebuild-install": "^7.0.0",
15
15
  "tar": "^6.1.11"
16
16
  },
17
17
  "devDependencies": {
@@ -34,7 +34,16 @@
34
34
  "benchmark": "node benchmark",
35
35
  "download": "bash ./deps/download.sh",
36
36
  "setup": "powershell ./deps/setup.ps1",
37
- "lzz": "lzz -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz"
37
+ "lzz": "lzz -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz",
38
+ "bump:patch": "npm --no-git-tag-version version patch",
39
+ "bump:minor": "npm --no-git-tag-version version minor",
40
+ "bump:major": "npm --no-git-tag-version version major",
41
+ "bump:patch:beta": "npm --no-git-tag-version --preid=beta version prepatch",
42
+ "bump:minor:beta": "npm --no-git-tag-version --preid=beta version preminor",
43
+ "bump:major:beta": "npm --no-git-tag-version --preid=beta version premajor",
44
+ "bump:prerelease:beta": "npm --no-git-tag-version --preid=beta version prerelease",
45
+ "release": "npm publish",
46
+ "release:beta": "npm publish --tag beta"
38
47
  },
39
48
  "license": "MIT",
40
49
  "keywords": [
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+ const Database = require('../.');
3
+
4
+ describe('Encryption using default method (Sqleet)', () => {
5
+ afterEach(() => {
6
+ this.db.close();
7
+ });
8
+
9
+ it('should create an encrypted database', () => {
10
+ this.db = new Database(util.next());
11
+ this.db.pragma(`rekey='passphrase'`);
12
+ this.db.prepare('CREATE TABLE user ("name" TEXT)').run();
13
+ this.db.prepare("INSERT INTO user (name) VALUES ('octocat')").run();
14
+ this.db.prepare('VACUUM').run();
15
+ });
16
+ it('should not allow access without decryption', () => {
17
+ this.db = new Database(util.current());
18
+ expect(() => this.db.prepare('SELECT * FROM user')).to.throw(Database.SqliteError);
19
+ });
20
+ it('should not allow access with an incorrect passphrase', () => {
21
+ this.db = new Database(util.current());
22
+ this.db.pragma(`key='false_passphrase'`);
23
+ expect(() => this.db.prepare('SELECT * FROM user')).to.throw(Database.SqliteError);
24
+ });
25
+ it('should allow access with the correct passphrase', () => {
26
+ this.db = new Database(util.current());
27
+ this.db.pragma(`key='passphrase'`);
28
+ const stmt = this.db.prepare('SELECT * FROM user');
29
+ expect(stmt.get()).to.deep.equal({name: 'octocat'});
30
+ });
31
+ });