libves 3.2.0 → 3.2.3
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 +32 -3
- package/libVES.js +114 -59
- package/libVES.node.js +178 -82
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,14 +87,43 @@ Runnable end-to-end examples live in [`tests/`](tests/) (`01-item.js`, `02-share
|
|
|
87
87
|
npm install libves
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
Or
|
|
90
|
+
Or load a released bundle with a `<script>` tag, pinned by its Subresource Integrity hash:
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<script src="https://ves.host/pub/libVES-<version>.js"
|
|
94
|
+
integrity="sha384-<hash>"
|
|
95
|
+
crossorigin="anonymous"></script>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Each release publishes its hashes in the GitHub release notes and at
|
|
99
|
+
`https://ves.host/pub/libVES-<version>.sri`. Take the hash from the release notes: a hash
|
|
100
|
+
fetched from the same server as the file proves nothing if that server is compromised.
|
|
101
|
+
To self-host the file, check it against the published hash first:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
openssl dgst -sha384 -binary libVES-<version>.js | openssl base64 -A
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
One hash covers the whole client. The ML-KEM engine is embedded in the bundle. The ECDH
|
|
108
|
+
engine, fetched only when WebCrypto lacks a curve, comes from
|
|
109
|
+
`https://ves.host/pub/wasm-<version>/` and is checked against hashes the bundle carries;
|
|
110
|
+
to self-host it, copy that directory and set `WasmECDHinit.baseUrl` to it.
|
|
111
|
+
|
|
112
|
+
- Pin a version-stamped file, never the unversioned `libVES.js`.
|
|
113
|
+
- The bundle starts with a UTF-8 byte-order mark, which makes browsers read it as UTF-8
|
|
114
|
+
whatever the page encoding. Keep it if you re-bundle or minify, or serve the file with
|
|
115
|
+
`charset=utf-8`.
|
|
116
|
+
- A page with a Content-Security-Policy needs `'wasm-unsafe-eval'` in `script-src`.
|
|
117
|
+
|
|
118
|
+
Or build from source (see below).
|
|
91
119
|
|
|
92
120
|
## Building
|
|
93
121
|
|
|
94
122
|
- `node build.js` — produces version-stamped `libVES-<version>.js` (browser) and
|
|
95
123
|
`libVES-<version>.node.js` (Node) for CDN/`<script>` delivery, plus stable `libVES.js`
|
|
96
|
-
and `libVES.node.js` (the npm `browser` / `main` entry points)
|
|
97
|
-
`
|
|
124
|
+
and `libVES.node.js` (the npm `browser` / `main` entry points), the lazy ECDH engine
|
|
125
|
+
laid out as served (`wasm-<version>/`), and `libVES-<version>.sri` with the SRI hash of
|
|
126
|
+
every version-stamped file. Cross-platform; `Makefile.bat` and `make all` both call it.
|
|
98
127
|
- `node build.js --minify` — also writes `libVES-<version>.min.js` and `libVES.min.js`
|
|
99
128
|
(requires `npm i -D terser`).
|
|
100
129
|
- Requires **Node 18+** (uses the built-in `fetch`).
|