@aztec/sqlite3mc-wasm 0.0.1-commit.e5a3663dd
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 +112 -0
- package/dest/index.js +6 -0
- package/dest/src/index.d.ts +9 -0
- package/dest/src/index.d.ts.map +1 -0
- package/package.json +77 -0
- package/src/index.ts +8 -0
- package/vendor/jswasm/.gitignore +9 -0
- package/vendor/jswasm/SHA256SUMS +11 -0
- package/vendor/jswasm/sqlite3-bundler-friendly.d.mts +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# @aztec/sqlite3mc-wasm
|
|
2
|
+
|
|
3
|
+
SQLite3 Multiple Ciphers v2.2.4 (based on SQLite 3.50.4) packaged as a WASM
|
|
4
|
+
module.
|
|
5
|
+
|
|
6
|
+
Upstream: https://github.com/utelle/SQLite3MultipleCiphers
|
|
7
|
+
|
|
8
|
+
Cipher schemes enabled: ChaCha20 (PRAGMA cipher = chacha20), SQLCipher v4,
|
|
9
|
+
AES-256, and others. See sqlite3mc upstream docs.
|
|
10
|
+
|
|
11
|
+
Usage: import sqlite3InitModule from @aztec/sqlite3mc-wasm. API is identical
|
|
12
|
+
to @sqlite.org/sqlite-wasm; sqlite3mc is a strict superset.
|
|
13
|
+
|
|
14
|
+
License: sqlite3mc is MIT-licensed.
|
|
15
|
+
|
|
16
|
+
## How vendoring works
|
|
17
|
+
|
|
18
|
+
Upstream WASM/JS artifacts under `vendor/jswasm/` are fetched at build time. The committed state of the directory is:
|
|
19
|
+
|
|
20
|
+
| File | Why |
|
|
21
|
+
|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
|
|
22
|
+
| `.gitignore` | Allowlist that keeps the rest of `vendor/jswasm/` out of git |
|
|
23
|
+
| `SHA256SUMS` | Per-file integrity manifest. Pinned at vendoring time; verified at every build |
|
|
24
|
+
| `sqlite3-bundler-friendly.d.mts` | Locally-authored TypeScript declaration companion for the upstream `.mjs`. Required by TS NodeNext module resolution. |
|
|
25
|
+
|
|
26
|
+
Everything else in `vendor/jswasm/` (the actual `.wasm`, `.mjs`, `.js`) is populated by `scripts/vendor.sh`, which is
|
|
27
|
+
invoked from `yarn-project/bootstrap.sh` before any package compiles. It downloads the upstream release zip, verifies
|
|
28
|
+
its SHA256 against the pinned value, extracts the WASM/JS files, and regenerates `SHA256SUMS`. On CI cache hits the
|
|
29
|
+
files come back via the build cache without re-fetching from upstream.
|
|
30
|
+
|
|
31
|
+
The pinned upstream version lives in `scripts/vendor.pin`:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
MC_VERSION=2.2.4
|
|
35
|
+
SQLITE_VERSION=3.50.4
|
|
36
|
+
SHA256=e73514200d76286d7d4a239589589b4f64d24ac4f4f7b2760e1f07b14ac5f6a5
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Verification (full chain)
|
|
40
|
+
|
|
41
|
+
Run from this package's root, after `scripts/vendor.sh ensure` has populated `vendor/jswasm/`.
|
|
42
|
+
|
|
43
|
+
### Step 1: zip matches the pinned SHA
|
|
44
|
+
|
|
45
|
+
The build script verifies this automatically. To check by hand:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
source scripts/vendor.pin
|
|
49
|
+
curl -sL "https://github.com/utelle/SQLite3MultipleCiphers/releases/download/v${MC_VERSION}/sqlite3mc-${MC_VERSION}-sqlite-${SQLITE_VERSION}-wasm.zip" \
|
|
50
|
+
| sha256sum
|
|
51
|
+
# Expected: matches $SHA256 from scripts/vendor.pin
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If this fails: upstream re-released the asset, or the artifact was tampered with in transit. Investigate before
|
|
55
|
+
trusting any subsequent check.
|
|
56
|
+
|
|
57
|
+
### Step 2: vendored files match the manifest
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cd vendor/jswasm && sha256sum -c SHA256SUMS
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Expected output: every file reports `OK`.
|
|
64
|
+
|
|
65
|
+
If any file reports `FAILED`: the file's bytes differ from what was recorded at vendoring time. Either the file was
|
|
66
|
+
modified post-fetch (via pre-commit hooks, accidental edits, etc.), or `SHA256SUMS` itself was tampered with. Both
|
|
67
|
+
cases need investigation, the build should not be trusted.
|
|
68
|
+
|
|
69
|
+
### Step 3 (optional, stronger): independently re-derive SHA256SUMS from the zip
|
|
70
|
+
|
|
71
|
+
A reviewer who wants to prove `SHA256SUMS` itself wasn't tampered with can regenerate it from the upstream zip:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
source scripts/vendor.pin
|
|
75
|
+
curl -sL "https://github.com/utelle/SQLite3MultipleCiphers/releases/download/v${MC_VERSION}/sqlite3mc-${MC_VERSION}-sqlite-${SQLITE_VERSION}-wasm.zip" -o /tmp/sqlite3mc.zip
|
|
76
|
+
unzip -q /tmp/sqlite3mc.zip -d /tmp/sqlite3mc-check
|
|
77
|
+
|
|
78
|
+
# Compute per-file hashes from the extracted jswasm/
|
|
79
|
+
(cd /tmp/sqlite3mc-check/sqlite3mc-wasm-* && cd jswasm && sha256sum -- * | sort -k2) > /tmp/upstream-sums
|
|
80
|
+
|
|
81
|
+
# Compare against repo's SHA256SUMS, excluding our locally-authored d.mts
|
|
82
|
+
grep -v 'sqlite3-bundler-friendly\.d\.mts' vendor/jswasm/SHA256SUMS | sort -k2 > /tmp/repo-sums
|
|
83
|
+
diff /tmp/upstream-sums /tmp/repo-sums
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Expected: empty diff. Any output means either upstream files have been modified or `SHA256SUMS` claims different hashes
|
|
87
|
+
than the zip.
|
|
88
|
+
|
|
89
|
+
## Bumping the pinned version
|
|
90
|
+
|
|
91
|
+
1. Edit `scripts/vendor.pin` with the new `MC_VERSION`, `SQLITE_VERSION`, and the SHA256 of the new release zip (find
|
|
92
|
+
it in the upstream release notes or compute it: `curl -sL <url> | sha256sum`).
|
|
93
|
+
2. Run `scripts/vendor.sh` (no args). It fetches the new release, verifies the SHA, replaces `vendor/jswasm/`, and
|
|
94
|
+
regenerates `SHA256SUMS`.
|
|
95
|
+
3. Re-run kv-store tests to confirm compatibility: `yarn workspace @aztec/kv-store test:browser`
|
|
96
|
+
4. Commit `scripts/vendor.pin` and `vendor/jswasm/SHA256SUMS` together.
|
|
97
|
+
|
|
98
|
+
To verify a candidate release before editing the pin file:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
scripts/vendor.sh <mc-version> <sqlite-version> <expected-sha256>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The 3-argument form overrides the pin file but does not modify it.
|
|
105
|
+
|
|
106
|
+
## Why `vendor/` is excluded from prettier
|
|
107
|
+
|
|
108
|
+
The repo's `.prettierignore` includes `sqlite3mc-wasm/vendor/`. Without this, pre-commit hooks would silently reformat
|
|
109
|
+
the upstream `.js` / `.mjs` files between fetch and the next commit (whitespace only, semantically identical, but
|
|
110
|
+
cryptographically different bytes), breaking the verification chain above.
|
|
111
|
+
|
|
112
|
+
If you see prettier formatting drift in this directory, the ignore entry is missing or misconfigured.
|
package/dest/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports sqlite3mc's bundler-friendly ES module default (sqlite3InitModule)
|
|
3
|
+
* and the TypeScript types expected by downstream consumers. Mirrors the
|
|
4
|
+
* `@sqlite.org/sqlite-wasm` package default export — sqlite3mc is a strict
|
|
5
|
+
* API-compatible superset, so upstream types apply unchanged.
|
|
6
|
+
*/ export { default } from '../vendor/jswasm/sqlite3-bundler-friendly.mjs';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports sqlite3mc's bundler-friendly ES module default (sqlite3InitModule)
|
|
3
|
+
* and the TypeScript types expected by downstream consumers. Mirrors the
|
|
4
|
+
* `@sqlite.org/sqlite-wasm` package default export — sqlite3mc is a strict
|
|
5
|
+
* API-compatible superset, so upstream types apply unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export { default } from '../vendor/jswasm/sqlite3-bundler-friendly.mjs';
|
|
8
|
+
export type { Database, SAHPoolUtil, Sqlite3Static } from '@sqlite.org/sqlite-wasm';
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7R0FLRztBQUNILE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSwrQ0FBK0MsQ0FBQztBQUN4RSxZQUFZLEVBQUUsUUFBUSxFQUFFLFdBQVcsRUFBRSxhQUFhLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AACxE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aztec/sqlite3mc-wasm",
|
|
3
|
+
"version": "0.0.1-commit.e5a3663dd",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dest/src/index.d.ts",
|
|
8
|
+
"import": "./dest/index.js"
|
|
9
|
+
},
|
|
10
|
+
"./vendor/jswasm/sqlite3.wasm": "./vendor/jswasm/sqlite3.wasm",
|
|
11
|
+
"./vendor/jswasm/sqlite3-opfs-async-proxy.js": "./vendor/jswasm/sqlite3-opfs-async-proxy.js"
|
|
12
|
+
},
|
|
13
|
+
"inherits": [
|
|
14
|
+
"../package.common.json",
|
|
15
|
+
"./package.local.json"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
19
|
+
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
20
|
+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
21
|
+
"build:dev": "../scripts/tsc.sh --watch"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@jest/globals": "^30.0.0",
|
|
25
|
+
"@sqlite.org/sqlite-wasm": "3.50.4-build1",
|
|
26
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
27
|
+
"jest": "^30.0.0",
|
|
28
|
+
"ts-node": "^10.9.1",
|
|
29
|
+
"typescript": "^5.3.3"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"src",
|
|
33
|
+
"vendor",
|
|
34
|
+
"dest",
|
|
35
|
+
"!*.test.*"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20.10"
|
|
39
|
+
},
|
|
40
|
+
"jest": {
|
|
41
|
+
"extensionsToTreatAsEsm": [
|
|
42
|
+
".ts"
|
|
43
|
+
],
|
|
44
|
+
"transform": {
|
|
45
|
+
"^.+\\.tsx?$": [
|
|
46
|
+
"@swc/jest",
|
|
47
|
+
{
|
|
48
|
+
"jsc": {
|
|
49
|
+
"parser": {
|
|
50
|
+
"syntax": "typescript",
|
|
51
|
+
"decorators": true
|
|
52
|
+
},
|
|
53
|
+
"transform": {
|
|
54
|
+
"decoratorVersion": "2022-03"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"moduleNameMapper": {
|
|
61
|
+
"^(\\.{1,2}/.*)\\.[cm]?js$": "$1"
|
|
62
|
+
},
|
|
63
|
+
"reporters": [
|
|
64
|
+
"default"
|
|
65
|
+
],
|
|
66
|
+
"testTimeout": 120000,
|
|
67
|
+
"testRegex": "./src/.*\\.test\\.(js|mjs|ts)$",
|
|
68
|
+
"rootDir": "./src",
|
|
69
|
+
"setupFiles": [
|
|
70
|
+
"../../foundation/src/jest/setup.mjs"
|
|
71
|
+
],
|
|
72
|
+
"setupFilesAfterEnv": [
|
|
73
|
+
"../../foundation/src/jest/setupAfterEnv.mjs"
|
|
74
|
+
],
|
|
75
|
+
"testEnvironment": "../../foundation/src/jest/env.mjs"
|
|
76
|
+
}
|
|
77
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports sqlite3mc's bundler-friendly ES module default (sqlite3InitModule)
|
|
3
|
+
* and the TypeScript types expected by downstream consumers. Mirrors the
|
|
4
|
+
* `@sqlite.org/sqlite-wasm` package default export — sqlite3mc is a strict
|
|
5
|
+
* API-compatible superset, so upstream types apply unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export { default } from '../vendor/jswasm/sqlite3-bundler-friendly.mjs';
|
|
8
|
+
export type { Database, SAHPoolUtil, Sqlite3Static } from '@sqlite.org/sqlite-wasm';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Upstream sqlite3mc-wasm release artifacts are fetched at build time by
|
|
2
|
+
# scripts/vendor.sh (driven by scripts/vendor.pin). Don't commit them.
|
|
3
|
+
#
|
|
4
|
+
# Allowlist: keep this .gitignore, the integrity manifest, and our
|
|
5
|
+
# locally-authored TypeScript declaration tracked in git.
|
|
6
|
+
*
|
|
7
|
+
!.gitignore
|
|
8
|
+
!SHA256SUMS
|
|
9
|
+
!sqlite3-bundler-friendly.d.mts
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
812bca8052d0e43bd8668dbd99430ee76c1cbd1be2d42087590c5c29018083c7 sqlite3-bundler-friendly.d.mts
|
|
2
|
+
85b8e8eb2b63ec08e106f82820a1942a07651c15a6204bc2c3510138a43b36bd sqlite3-bundler-friendly.mjs
|
|
3
|
+
f07714bd13b703c1917b02e73f4b3a8514c2b37e2b00afe1375d4a30faa2461d sqlite3-node.mjs
|
|
4
|
+
fc499c666c095929b5614dfa34d3f6e01cff77df2ea98abade30de97ac8db324 sqlite3-opfs-async-proxy.js
|
|
5
|
+
9386ab42a3fe80fddf21e5651aa898eb1a674355b070f6d1338d93ebbc6779c6 sqlite3-worker1-bundler-friendly.mjs
|
|
6
|
+
ff0581756d86ca1397ce3f53810c29af1d8db34c4814e77271f85d4d11df108f sqlite3-worker1-promiser.js
|
|
7
|
+
e1f0b46abdc61b45b9f64bc522324ccddfe385308ef772eef054e66ba3b013f8 sqlite3-worker1-promiser.mjs
|
|
8
|
+
1bed25837f00f7b68943cfcabed62dfd202cae863a72af24a0d6487d7d7b0e61 sqlite3-worker1.js
|
|
9
|
+
0c473584c02a07793b3c320e166c25aead8131880d5ae3e719f976ccc5081fa0 sqlite3.js
|
|
10
|
+
4677d6c8e66fe99c29307fe2b782fce83272b760a3a617202fae8e3f3434dab5 sqlite3.mjs
|
|
11
|
+
e0e94e4ac5221c19aefe7e59fe88ceab93bff56ec1d966c21c6cf39ac0f26735 sqlite3.wasm
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Type declaration for the sqlite3mc bundler-friendly ES module.
|
|
2
|
+
// sqlite3mc is API-compatible with @sqlite.org/sqlite-wasm, so we reuse its
|
|
3
|
+
// Sqlite3Static type directly.
|
|
4
|
+
import type { Sqlite3Static } from '@sqlite.org/sqlite-wasm';
|
|
5
|
+
|
|
6
|
+
declare function sqlite3InitModule(opts?: Record<string, unknown>): Promise<Sqlite3Static>;
|
|
7
|
+
export default sqlite3InitModule;
|