better-sqlite3-multiple-ciphers 7.4.6 → 7.4.7-beta.0

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.
package/README.md CHANGED
@@ -18,14 +18,14 @@ The fastest and simplest library for SQLite3 in Node.js. This particular fork su
18
18
 
19
19
  - ### Stable
20
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
21
  - **SQLite** - `3.37.0`
27
22
  - **SQLite3 Multiple Ciphers** - `1.3.5`
28
23
 
24
+ - ### Beta
25
+ - **better-sqlite3-multiple-ciphers** - [`7.4.7-beta.0`](https://www.npmjs.com/package/better-sqlite3-multiple-ciphers/v/7.4.7-beta.0)
26
+ - **SQLite** - `3.37.1`
27
+ - **SQLite3 Multiple Ciphers** - `1.3.6`
28
+
29
29
  ## Help this project stay strong! 💪
30
30
 
31
31
  `better-sqlite3` is used by thousands of developers and engineers on a daily basis. Long nights and weekends were spent keeping this project strong and dependable, with no ask for compensation or funding, until now. If your company uses `better-sqlite3`, ask your manager to consider supporting the project:
package/deps/setup.ps1 CHANGED
@@ -2,7 +2,7 @@
2
2
  $ErrorActionPreference = "Stop"
3
3
 
4
4
  # SQLite Info
5
- $SQLITEMC_VER = "v1.3.5"
5
+ $SQLITEMC_VER = "v1.3.6"
6
6
  $API_URL = "https://api.github.com/repos/utelle/SQLite3MultipleCiphers/releases/tags/" + $SQLITEMC_VER
7
7
 
8
8
  # Paths
Binary file
@@ -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.37.0** with the following [compilation options](https://www.sqlite.org/compile.html):
37
+ By default, this distribution currently uses SQLite3 **version 3.37.1** 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.6",
3
+ "version": "7.4.7-beta.0",
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>",
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  const Database = require('../.');
3
3
 
4
- describe('Encryption using default method (Sqleet)', () => {
4
+ describe('Encryption using default cipher (Sqleet)', () => {
5
5
  afterEach(() => {
6
6
  this.db.close();
7
7
  });
@@ -29,3 +29,41 @@ describe('Encryption using default method (Sqleet)', () => {
29
29
  expect(stmt.get()).to.deep.equal({name: 'octocat'});
30
30
  });
31
31
  });
32
+
33
+ describe('Encryption using SQLCiper', () => {
34
+ afterEach(() => {
35
+ this.db.close();
36
+ });
37
+
38
+ it('should create an encrypted database', () => {
39
+ this.db = new Database(util.next());
40
+ this.db.pragma(`cipher='sqlcipher'`);
41
+ this.db.pragma(`rekey='passphrase'`);
42
+ this.db.prepare('CREATE TABLE user ("name" TEXT)').run();
43
+ this.db.prepare("INSERT INTO user (name) VALUES ('octocat')").run();
44
+ this.db.prepare('VACUUM').run();
45
+ });
46
+ it('should not allow access without decryption', () => {
47
+ this.db = new Database(util.current());
48
+ this.db.pragma(`cipher='sqlcipher'`);
49
+ expect(() => this.db.prepare('SELECT * FROM user')).to.throw(Database.SqliteError);
50
+ });
51
+ it('should not allow access with an incorrect passphrase', () => {
52
+ this.db = new Database(util.current());
53
+ this.db.pragma(`cipher='sqlcipher'`);
54
+ this.db.pragma(`key='false_passphrase'`);
55
+ expect(() => this.db.prepare('SELECT * FROM user')).to.throw(Database.SqliteError);
56
+ });
57
+ it('should not allow access with a different cipher', () => {
58
+ this.db = new Database(util.current());
59
+ this.db.pragma(`key='passphrase'`);
60
+ expect(() => this.db.prepare('SELECT * FROM user')).to.throw(Database.SqliteError);
61
+ });
62
+ it('should allow access with the correct passphrase and cipher', () => {
63
+ this.db = new Database(util.current());
64
+ this.db.pragma(`cipher='sqlcipher'`);
65
+ this.db.pragma(`key='passphrase'`);
66
+ const stmt = this.db.prepare('SELECT * FROM user');
67
+ expect(stmt.get()).to.deep.equal({name: 'octocat'});
68
+ });
69
+ });