-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Encryption with mutliple ciphers #23
base: master
Are you sure you want to change the base?
Conversation
Makefile
Outdated
SQLITE_TARBALL_URL = https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=${SQLITE_VERSION} | ||
|
||
MC_SQLITE_URL = https://github.com/utelle/SQLite3MultipleCiphers/releases/download/v${MC_SQLITE_VERSION}/sqlite3mc-${MC_SQLITE_VERSION}-sqlite-3.47.0-amalgamation.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also use SQLITE_VERSION
here?
|
||
EMFLAGS_ASYNCIFY_DIST = \ | ||
$(EMFLAGS_ASYNCIFY_COMMON) \ | ||
-s ASYNCIFY_STACK_SIZE=16384 | ||
-s ASYNCIFY_STACK_SIZE=32768 | ||
# TODO sensible stack size increase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still a TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubled the size, I'm not entirely sure what size is best here and left the TODO there to make any changes.
@@ -28,192 +31,206 @@ const EXT_WASM = new Map([ | |||
* @property {object} [vfsOptions] VFS constructor arguments | |||
*/ | |||
|
|||
/** @type {Map<string, Config>} */ const VFS_CONFIGS = new Map([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we revert these formatting changes if possible? Keeping the formatting the same as upstream makes maintenance easier.
src/FacadeVFS.js
Outdated
// Exact copy of SQLite's calculation: | ||
// static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000; | ||
// *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000; | ||
const unixEpoch = 24405875n * 8640000n; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we store this unixEpoch
as a global const? This would avoid having to recalculate on each invocation.
src/FacadeVFS.js
Outdated
const seconds = BigInt(Math.floor(Date.now() / 1000)); | ||
const microseconds = BigInt(Date.now() % 1000) * 1000n; | ||
|
||
const value = unixEpoch + (1000n * seconds) + (microseconds / 1000n); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be confused by the logic here. The method comment mentions "Gets the current time as milliseconds since Unix epoch"
Could this not be simplified by returning Date.now()
which according to MDN returns The Date.now() static method returns the number of milliseconds elapsed since the [epoch](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#the_epoch_timestamps_and_invalid_date)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Find the current time (in Universal Coordinated Time). Write into *piNow
the current time and date as a Julian Day number times 86_400_000. In other words,
write into *piNow the number of milliseconds since the Julian epoch of noon in Greenwich
on November 24, 4714 B.C according to the proleptic Gregorian calendar.
static int unixCurrentTimeInt64(sqlite3_vfs *NotUsed, sqlite3_int64 *piNow){
...
}
This is how sqlite3 calculates the currentTime, I used the same formula and values to calculate it in the VFS.
Description
This pull request introduces support for encrypting the SQLite database using multiple ciphers. The changes include modifications to the VFS implementation, build scripts, and configuration to ensure that encryption is enabled and properly integrated.