quantum-resistant-rustykey 0.7.8 → 0.8.0

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 (2) hide show
  1. package/README.md +86 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -14,12 +14,10 @@ npm i quantum-resistant-rustykey
14
14
 
15
15
  - ***Recommendation***: Await v1.0.0 (following security audit) for production/regulated deployment.
16
16
  - includes NIST approved as well as riskier NIST 'on-ramp' variants eg SQISign
17
- - *signature algorithms:*
18
- - *FN-DSA (Falcon-512, Falcon-1024)*
19
- - *ML-DSA (Dilithium variants)*
20
- - *SQISign*
21
- - module-lattice-based key-encapsulation mechanism
22
- - **ML-KEM-512**, **ML-KEM-768**, and **ML-KEM-1024** using the same stack: [mlkem-native](https://github.com/pq-code-package/mlkem-native) built with **Emscripten**.
17
+ - **ML-DSA** (ML-DSA-65, ML-DSA-87)
18
+ - **FN-DSA** (FN-DSA-512, FN-DSA-1024)
19
+ - **SQIsign** (Level 1)
20
+ - **ML-KEM** (512, 768, 1024) using [mlkem-native](https://github.com/pq-code-package/mlkem-native).
23
21
 
24
22
  ### NOTE: Why we support SQISign when it is 'NIST-on-ramp' only
25
23
  *TLDR; to help hurdle the "silent" barrier to post-quantum adoption: 1024-byte buffer limit in many existing FIDO2/WebAuthn implementations*
@@ -249,16 +247,41 @@ pnpm build
249
247
 
250
248
  - Run `pnpm test` for ML-KEM-512 / 768 / 1024 round-trips.
251
249
 
252
- ## Browser example (local)
250
+ ### Digital Signatures (Node.js & Frontend)
253
251
 
254
- A Vite app under `examples/browser-demo` links this package from the workspace. From the repo root:
252
+ All signature algorithms (**FN-DSA**, **ML-DSA**, and **SQIsign**) share a common interface.
255
253
 
256
- ```bash
257
- pnpm build
258
- pnpm example:browser
254
+ ```typescript
255
+ import {
256
+ loadFnDsa512,
257
+ loadMlDsa3,
258
+ loadSqisignLvl1
259
+ } from "quantum-resistant-rustykey";
260
+
261
+ async function main() {
262
+ // 1. Load the algorithm (e.g., FN-DSA-512)
263
+ const fnDsa = await loadFnDsa512();
264
+
265
+ // 2. Generate a keypair
266
+ const kp = fnDsa.keypair();
267
+ const publicKey = await kp.get("public_key");
268
+ const privateKey = await kp.get("private_key");
269
+
270
+ // 3. Sign a message
271
+ const message = "Authored by RustyKey";
272
+ const signature = await fnDsa.sign(message, privateKey);
273
+ console.log("Signature (hex):", fnDsa.buffer_to_string(signature));
274
+
275
+ // 4. Verify the signature
276
+ const isValid = await fnDsa.verify(signature, message, publicKey);
277
+ console.log("Is signature valid?", isValid);
278
+ }
259
279
  ```
260
280
 
261
- See `examples/browser-demo/README.md` for details.
281
+ > [!NOTE]
282
+ > **SQIsign Performance**: Level 1 signing is extremely CPU-intensive (can take seconds to minutes depending on hardware). It is recommended for "sign-once, verify-many" scenarios like certificates or firmware updates.
283
+
284
+ ## Browser example (local)
262
285
 
263
286
  ## Project Structure
264
287
 
@@ -279,6 +302,42 @@ This implementation includes patches to withstand side-channel attacks. For more
279
302
 
280
303
  ISC
281
304
 
305
+
306
+ ## Performance Metrics
307
+
308
+ Measured on a standard development environment (Node.js/WASM). Individual results may vary based on hardware and runtime overhead.
309
+
310
+ | Algorithm | KeyGen (ms) | Sign (ms) | Verify (ms) |
311
+ | :--- | :---: | :---: | :---: |
312
+ | **FN-DSA-512** | 8.13 | 0.74 | 0.78 |
313
+ | **FN-DSA-1024** | 25.62 | 1.25 | 0.24 |
314
+ | **ML-DSA-3 (Level 3)** | 0.22 | 0.45 | 0.25 |
315
+ | **ML-DSA-5 (Level 5)** | 0.33 | 0.63 | 0.34 |
316
+ | **SQIsign L1** | 99.95 | 534.41 | 15.35 |
317
+
318
+ ---
319
+
320
+ ## Known Answer Tests (KAT)
321
+
322
+ To ensure implementation correctness, our WASM build is verified against official NIST and reference test vectors.
323
+
324
+ ### ML-DSA-3 (Level 3 / Dilithium-3)
325
+ * **Msg**: `6dbbc4375136df3b07f7c70e639e223e`
326
+ * **PK**: `e50d03fff3b3a70961abbb92a390008dec1283f603f50cdbaaa3d00bd659bc767c3f...`
327
+ * **Sig**: `a0c1af32f9ba4e4beea3016b96d1c780e8b5e020bb07c24478dbdd0ec875666b5a...`
328
+
329
+ ### ML-DSA-5 (Level 5 / Dilithium-5)
330
+ * **Msg**: `6dbbc4375136df3b07f7c70e639e223e`
331
+ * **PK**: `bc89b367d4288f47c71a74679d0fcffbe041de41b5da2f5fc66d8e28c589949404...`
332
+ * **Sig**: `47dc5764266841c1af3073fcead6a13d372979e6cca0b2952b349915f54ef66312...`
333
+
334
+ ### SQIsign Level 1
335
+ * **Msg**: `d81c4d8d734fcbfbeade3d3f8a039faa2a2c9957e835ad55b22e75bf57bb556ac8`
336
+ * **PK**: `07CCD21425136F6E865E497D2D4D208F0054AD81372066E817480787AAF7B2029...`
337
+ * **Sig**: `84228651f271b0f39f2f19f2e8718f31ed3365ac9e5cb303afe663d0cfc11f0455...`
338
+
339
+ *Full byte-perfect vectors are included in the `src/*.test.ts` files.*
340
+
282
341
  ## Funding
283
342
 
284
343
  This project was generously supported by:
@@ -303,3 +362,18 @@ This project was generously supported by:
303
362
  - people have differences of opinion, usually every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
304
363
  - go light on unstructured critique, encourage others!
305
364
  - if you feel you have been or are being harassed or made uncomfortable by a community member, contact BuzzyBee® our friendly multi-LLM on the chat widget on our testbed site
365
+
366
+ ## Appendix (WIP) testbed 'coming soon' features
367
+
368
+ Below our some examples of stats and interactivity we plan to add to the testbed depending on user-interest that will help users understand the trade-offs between lattice-based (ML-KEM/DSA) and isogeny-based (SQISign) crypto:
369
+
370
+ - Memory Peak (Heap Usage): WASM runs in a linear memory space. Tracking performance.memory.usedJSHeapSize (in supported browsers) or monitoring the WASM instance’s memory growth is vital, especially for ML-DSA (Dilithium), which can be memory-intensive.
371
+
372
+ - Serialized Payload Size: Explicitly display the "Over-the-wire" size for public keys and signatures. Seeing a 204-byte SQISign signature next to a 2,420-byte Dilithium-2 signature makes the WebAuthn buffer issue immediately obvious.
373
+
374
+ - WASM Instantiation Time: Measure how long it takes to compile and initialize the module. This is a "hidden" latency cost in web apps that users often overlook.
375
+
376
+ - Interactive "Live Insight" Buttons
377
+ - "Simulate CTAP2 Limit": A toggle that "clips" the buffer at 1024 bytes. If the user tries to run Dilithium, it throws a visual error, while SQISign passes—demonstrating that "silent barrier" they mentioned
378
+ - "Throttle CPU": An option to simulate mobile/embedded performance (standard in Chrome DevTools, but great as a one-click button). This highlights how SQISign is great for size but potentially slower on verification time compared to Falcon or Dilithium.
379
+ - "Batch Verification Run": A button to run 100 signatures in a loop. This generates a jitter chart to show if the Montgomery constant-time implementation stays flat or fluctuates under load
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quantum-resistant-rustykey",
3
- "version": "0.7.8",
3
+ "version": "0.8.0",
4
4
  "description": "WebAssembly post-quantum-resistant tools for web",
5
5
  "author": "Antony R Mott <a@auditcanary.com> (https://rustykey.app)",
6
6
  "license": "ISC",