better-sqlite3-multiple-ciphers 7.6.3-beta.0 → 7.6.3-beta.1
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 +3 -3
- package/deps/setup.ps1 +1 -1
- package/deps/sqlite3/sqlite3.c +839 -355
- package/deps/sqlite3/sqlite3.h +99 -14
- package/package.json +5 -3
- package/src/better_sqlite3.cpp +9 -2
- package/src/better_sqlite3.hpp +6 -6
package/deps/sqlite3/sqlite3.h
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
** Purpose: Header file for SQLite3 Multiple Ciphers support
|
|
4
4
|
** Author: Ulrich Telle
|
|
5
5
|
** Created: 2020-03-01
|
|
6
|
-
** Copyright: (c) 2019-
|
|
6
|
+
** Copyright: (c) 2019-2022 Ulrich Telle
|
|
7
7
|
** License: MIT
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
#define SQLITE3MC_VERSION_H_
|
|
31
31
|
|
|
32
32
|
#define SQLITE3MC_VERSION_MAJOR 1
|
|
33
|
-
#define SQLITE3MC_VERSION_MINOR
|
|
34
|
-
#define SQLITE3MC_VERSION_RELEASE
|
|
33
|
+
#define SQLITE3MC_VERSION_MINOR 5
|
|
34
|
+
#define SQLITE3MC_VERSION_RELEASE 3
|
|
35
35
|
#define SQLITE3MC_VERSION_SUBRELEASE 0
|
|
36
|
-
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.
|
|
36
|
+
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.5.3"
|
|
37
37
|
|
|
38
38
|
#endif /* SQLITE3MC_VERSION_H_ */
|
|
39
39
|
/*** End of #include "sqlite3mc_version.h" ***/
|
|
@@ -192,9 +192,9 @@ extern "C" {
|
|
|
192
192
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
|
193
193
|
** [sqlite_version()] and [sqlite_source_id()].
|
|
194
194
|
*/
|
|
195
|
-
#define SQLITE_VERSION "3.39.
|
|
196
|
-
#define SQLITE_VERSION_NUMBER
|
|
197
|
-
#define SQLITE_SOURCE_ID "2022-
|
|
195
|
+
#define SQLITE_VERSION "3.39.4"
|
|
196
|
+
#define SQLITE_VERSION_NUMBER 3039004
|
|
197
|
+
#define SQLITE_SOURCE_ID "2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309"
|
|
198
198
|
|
|
199
199
|
/*
|
|
200
200
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -12989,13 +12989,13 @@ int sqlite3_user_delete(
|
|
|
12989
12989
|
/*
|
|
12990
12990
|
** Symbols for ciphers
|
|
12991
12991
|
*/
|
|
12992
|
-
#define CODEC_TYPE_UNKNOWN
|
|
12993
|
-
#define CODEC_TYPE_AES128
|
|
12994
|
-
#define CODEC_TYPE_AES256
|
|
12995
|
-
#define CODEC_TYPE_CHACHA20
|
|
12996
|
-
#define CODEC_TYPE_SQLCIPHER
|
|
12997
|
-
#define CODEC_TYPE_RC4
|
|
12998
|
-
#define
|
|
12992
|
+
#define CODEC_TYPE_UNKNOWN 0
|
|
12993
|
+
#define CODEC_TYPE_AES128 1
|
|
12994
|
+
#define CODEC_TYPE_AES256 2
|
|
12995
|
+
#define CODEC_TYPE_CHACHA20 3
|
|
12996
|
+
#define CODEC_TYPE_SQLCIPHER 4
|
|
12997
|
+
#define CODEC_TYPE_RC4 5
|
|
12998
|
+
#define CODEC_TYPE_MAX_BUILTIN 5
|
|
12999
12999
|
|
|
13000
13000
|
/*
|
|
13001
13001
|
** Definition of API functions
|
|
@@ -13064,6 +13064,9 @@ SQLITE_API void sqlite3_activate_see(const char* zPassPhrase);
|
|
|
13064
13064
|
/*
|
|
13065
13065
|
** Define functions for the configuration of the wxSQLite3 encryption extension
|
|
13066
13066
|
*/
|
|
13067
|
+
SQLITE_API int sqlite3mc_cipher_count();
|
|
13068
|
+
SQLITE_API int sqlite3mc_cipher_index(const char* cipherName);
|
|
13069
|
+
SQLITE_API const char* sqlite3mc_cipher_name(int cipherIndex);
|
|
13067
13070
|
SQLITE_API int sqlite3mc_config(sqlite3* db, const char* paramName, int newValue);
|
|
13068
13071
|
SQLITE_API int sqlite3mc_config_cipher(sqlite3* db, const char* cipherName, const char* paramName, int newValue);
|
|
13069
13072
|
SQLITE_API unsigned char* sqlite3mc_codec_data(sqlite3* db, const char* zDbName, const char* paramName);
|
|
@@ -13075,6 +13078,88 @@ SQLITE_API int wxsqlite3_config_cipher(sqlite3* db, const char* cipherName, cons
|
|
|
13075
13078
|
SQLITE_API unsigned char* wxsqlite3_codec_data(sqlite3* db, const char* zDbName, const char* paramName);
|
|
13076
13079
|
#endif
|
|
13077
13080
|
|
|
13081
|
+
/*
|
|
13082
|
+
** Structures and functions to dynamically register a cipher
|
|
13083
|
+
*/
|
|
13084
|
+
|
|
13085
|
+
/*
|
|
13086
|
+
** Structure for a single cipher configuration parameter
|
|
13087
|
+
**
|
|
13088
|
+
** Components:
|
|
13089
|
+
** m_name - name of parameter (1st char = alpha, rest = alphanumeric or underscore, max 63 characters)
|
|
13090
|
+
** m_value - current/transient parameter value
|
|
13091
|
+
** m_default - default parameter value
|
|
13092
|
+
** m_minValue - minimum valid parameter value
|
|
13093
|
+
** m_maxValue - maximum valid parameter value
|
|
13094
|
+
*/
|
|
13095
|
+
typedef struct _CipherParams
|
|
13096
|
+
{
|
|
13097
|
+
char* m_name;
|
|
13098
|
+
int m_value;
|
|
13099
|
+
int m_default;
|
|
13100
|
+
int m_minValue;
|
|
13101
|
+
int m_maxValue;
|
|
13102
|
+
} CipherParams;
|
|
13103
|
+
|
|
13104
|
+
/*
|
|
13105
|
+
** Structure for a cipher API
|
|
13106
|
+
**
|
|
13107
|
+
** Components:
|
|
13108
|
+
** m_name - name of cipher (1st char = alpha, rest = alphanumeric or underscore, max 63 characters)
|
|
13109
|
+
** m_allocateCipher - Function pointer for function AllocateCipher
|
|
13110
|
+
** m_freeCipher - Function pointer for function FreeCipher
|
|
13111
|
+
** m_cloneCipher - Function pointer for function CloneCipher
|
|
13112
|
+
** m_getLegacy - Function pointer for function GetLegacy
|
|
13113
|
+
** m_getPageSize - Function pointer for function GetPageSize
|
|
13114
|
+
** m_getReserved - Function pointer for function GetReserved
|
|
13115
|
+
** m_getSalt - Function pointer for function GetSalt
|
|
13116
|
+
** m_generateKey - Function pointer for function GenerateKey
|
|
13117
|
+
** m_encryptPage - Function pointer for function EncryptPage
|
|
13118
|
+
** m_decryptPage - Function pointer for function DecryptPage
|
|
13119
|
+
*/
|
|
13120
|
+
|
|
13121
|
+
typedef struct BtShared BtSharedMC;
|
|
13122
|
+
|
|
13123
|
+
typedef void* (*AllocateCipher_t)(sqlite3* db);
|
|
13124
|
+
typedef void (*FreeCipher_t)(void* cipher);
|
|
13125
|
+
typedef void (*CloneCipher_t)(void* cipherTo, void* cipherFrom);
|
|
13126
|
+
typedef int (*GetLegacy_t)(void* cipher);
|
|
13127
|
+
typedef int (*GetPageSize_t)(void* cipher);
|
|
13128
|
+
typedef int (*GetReserved_t)(void* cipher);
|
|
13129
|
+
typedef unsigned char* (*GetSalt_t)(void* cipher);
|
|
13130
|
+
typedef void (*GenerateKey_t)(void* cipher, BtSharedMC* pBt, char* userPassword, int passwordLength, int rekey, unsigned char* cipherSalt);
|
|
13131
|
+
typedef int (*EncryptPage_t)(void* cipher, int page, unsigned char* data, int len, int reserved);
|
|
13132
|
+
typedef int (*DecryptPage_t)(void* cipher, int page, unsigned char* data, int len, int reserved, int hmacCheck);
|
|
13133
|
+
|
|
13134
|
+
typedef struct _CipherDescriptor
|
|
13135
|
+
{
|
|
13136
|
+
char* m_name;
|
|
13137
|
+
AllocateCipher_t m_allocateCipher;
|
|
13138
|
+
FreeCipher_t m_freeCipher;
|
|
13139
|
+
CloneCipher_t m_cloneCipher;
|
|
13140
|
+
GetLegacy_t m_getLegacy;
|
|
13141
|
+
GetPageSize_t m_getPageSize;
|
|
13142
|
+
GetReserved_t m_getReserved;
|
|
13143
|
+
GetSalt_t m_getSalt;
|
|
13144
|
+
GenerateKey_t m_generateKey;
|
|
13145
|
+
EncryptPage_t m_encryptPage;
|
|
13146
|
+
DecryptPage_t m_decryptPage;
|
|
13147
|
+
} CipherDescriptor;
|
|
13148
|
+
|
|
13149
|
+
/*
|
|
13150
|
+
** Register a cipher
|
|
13151
|
+
**
|
|
13152
|
+
** Arguments:
|
|
13153
|
+
** desc - Cipher descriptor structure
|
|
13154
|
+
** params - Cipher configuration parameter table
|
|
13155
|
+
** makeDefault - flag whether to make the cipher the default cipher
|
|
13156
|
+
**
|
|
13157
|
+
** Returns:
|
|
13158
|
+
** SQLITE_OK - the cipher could be registered successfully
|
|
13159
|
+
** SQLITE_ERROR - the cipher could not be registered
|
|
13160
|
+
*/
|
|
13161
|
+
SQLITE_API int sqlite3mc_register_cipher(const CipherDescriptor* desc, const CipherParams* params, int makeDefault);
|
|
13162
|
+
|
|
13078
13163
|
#ifdef __cplusplus
|
|
13079
13164
|
}
|
|
13080
13165
|
#endif
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-sqlite3-multiple-ciphers",
|
|
3
|
-
"version": "7.6.3-beta.
|
|
3
|
+
"version": "7.6.3-beta.1",
|
|
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>",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"url": "git://github.com/m4heshd/better-sqlite3-multiple-ciphers.git"
|
|
10
10
|
},
|
|
11
11
|
"main": "lib/index.js",
|
|
12
|
+
"types": "index.d.ts",
|
|
12
13
|
"files": [
|
|
13
14
|
"binding.gyp",
|
|
14
15
|
"src/*.[ch]pp",
|
|
@@ -27,10 +28,11 @@
|
|
|
27
28
|
"nodemark": "^0.3.0",
|
|
28
29
|
"prebuild": "^11.0.4",
|
|
29
30
|
"sqlite": "^4.1.1",
|
|
30
|
-
"sqlite3": "^5.0.8"
|
|
31
|
+
"sqlite3": "^5.0.8",
|
|
32
|
+
"@types/better-sqlite3": "latest"
|
|
31
33
|
},
|
|
32
34
|
"scripts": {
|
|
33
|
-
"install": "prebuild-install ||
|
|
35
|
+
"install": "prebuild-install || node-gyp rebuild --release",
|
|
34
36
|
"build-release": "node-gyp rebuild --release",
|
|
35
37
|
"build-debug": "node-gyp rebuild --debug",
|
|
36
38
|
"rebuild-release": "npm run lzz && npm run build-release",
|
package/src/better_sqlite3.cpp
CHANGED
|
@@ -1748,6 +1748,13 @@ int CustomTable::xBestIndex (sqlite3_vtab * vtab, sqlite3_index_info * output)
|
|
|
1748
1748
|
auto item = output->aConstraint[i];
|
|
1749
1749
|
|
|
1750
1750
|
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
|
|
1754
|
+
if (item.op == SQLITE_INDEX_CONSTRAINT_LIMIT || item.op == SQLITE_INDEX_CONSTRAINT_OFFSET) {
|
|
1755
|
+
continue;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1751
1758
|
if (item.iColumn >= 0 && item.iColumn < parameter_count) {
|
|
1752
1759
|
if (item.op != SQLITE_INDEX_CONSTRAINT_EQ) {
|
|
1753
1760
|
sqlite3_free(vtab->zErrMsg);
|
|
@@ -1782,9 +1789,9 @@ int CustomTable::xBestIndex (sqlite3_vtab * vtab, sqlite3_index_info * output)
|
|
|
1782
1789
|
output->estimatedCost = output->estimatedRows = 1000000000 / (argument_count + 1);
|
|
1783
1790
|
return SQLITE_OK;
|
|
1784
1791
|
}
|
|
1785
|
-
#line
|
|
1792
|
+
#line 394 "./src/util/custom-table.lzz"
|
|
1786
1793
|
void CustomTable::PropagateJSError ()
|
|
1787
|
-
#line
|
|
1794
|
+
#line 394 "./src/util/custom-table.lzz"
|
|
1788
1795
|
{
|
|
1789
1796
|
assert(db->GetState()->was_js_error == false);
|
|
1790
1797
|
db->GetState()->was_js_error = true;
|
package/src/better_sqlite3.hpp
CHANGED
|
@@ -666,17 +666,17 @@ private:
|
|
|
666
666
|
static int xRowid (sqlite3_vtab_cursor * cursor, sqlite_int64 * output);
|
|
667
667
|
#line 343 "./src/util/custom-table.lzz"
|
|
668
668
|
static int xBestIndex (sqlite3_vtab * vtab, sqlite3_index_info * output);
|
|
669
|
-
#line
|
|
669
|
+
#line 394 "./src/util/custom-table.lzz"
|
|
670
670
|
void PropagateJSError ();
|
|
671
|
-
#line
|
|
671
|
+
#line 399 "./src/util/custom-table.lzz"
|
|
672
672
|
Addon * const addon;
|
|
673
|
-
#line
|
|
673
|
+
#line 400 "./src/util/custom-table.lzz"
|
|
674
674
|
v8::Isolate * const isolate;
|
|
675
|
-
#line
|
|
675
|
+
#line 401 "./src/util/custom-table.lzz"
|
|
676
676
|
Database * const db;
|
|
677
|
-
#line
|
|
677
|
+
#line 402 "./src/util/custom-table.lzz"
|
|
678
678
|
std::string const name;
|
|
679
|
-
#line
|
|
679
|
+
#line 403 "./src/util/custom-table.lzz"
|
|
680
680
|
CopyablePersistent <v8::Function> const factory;
|
|
681
681
|
};
|
|
682
682
|
#line 65 "./src/util/data.lzz"
|