libves 3.1.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.
Files changed (4) hide show
  1. package/README.md +39 -4
  2. package/libVES.js +251 -63
  3. package/libVES.node.js +315 -86
  4. package/package.json +5 -2
package/README.md CHANGED
@@ -16,6 +16,10 @@
16
16
 
17
17
  # libVES.js
18
18
 
19
+ [![CI](https://github.com/vesvault/libVES/actions/workflows/ci.yml/badge.svg)](https://github.com/vesvault/libVES/actions/workflows/ci.yml)
20
+ [![npm](https://img.shields.io/npm/v/libves)](https://www.npmjs.com/package/libves)
21
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
22
+
19
23
  **End-to-end encryption for the browser and Node — that you can actually recover from.**
20
24
 
21
25
  The official VESvault JavaScript library. It does client-side end-to-end encryption
@@ -83,14 +87,43 @@ Runnable end-to-end examples live in [`tests/`](tests/) (`01-item.js`, `02-share
83
87
  npm install libves
84
88
  ```
85
89
 
86
- Or build from source (see below) and load `libVES-<version>.js` with a `<script>` tag.
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).
87
119
 
88
120
  ## Building
89
121
 
90
122
  - `node build.js` — produces version-stamped `libVES-<version>.js` (browser) and
91
123
  `libVES-<version>.node.js` (Node) for CDN/`<script>` delivery, plus stable `libVES.js`
92
- and `libVES.node.js` (the npm `browser` / `main` entry points). Cross-platform;
93
- `Makefile.bat` and `make all` both call it.
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.
94
127
  - `node build.js --minify` — also writes `libVES-<version>.min.js` and `libVES.min.js`
95
128
  (requires `npm i -D terser`).
96
129
  - Requires **Node 18+** (uses the built-in `fetch`).
@@ -135,7 +168,9 @@ open source under the Apache License 2.0. See current terms and pricing at
135
168
  Bug reports and small, focused fixes are welcome via issues and pull requests. Because
136
169
  this is security-critical software backed by a hosted service, larger changes — new
137
170
  cryptography, API-surface or protocol changes — should **start with an issue** before you
138
- write code; we can't always merge changes that affect the protocol or the service.
171
+ write code; we can't always merge changes that affect the protocol or the service. See
172
+ [CONTRIBUTING.md](CONTRIBUTING.md) for build, syntax-check, and test details, and our
173
+ [Code of Conduct](CODE_OF_CONDUCT.md).
139
174
 
140
175
  Security issues are different: **please don't open a public issue or PR** — follow
141
176
  [SECURITY.md](SECURITY.md).