quantum-resistant-rustykey 0.8.0 → 0.8.2

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 +74 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -16,11 +16,12 @@ npm i quantum-resistant-rustykey
16
16
  - includes NIST approved as well as riskier NIST 'on-ramp' variants eg SQISign
17
17
  - **ML-DSA** (ML-DSA-65, ML-DSA-87)
18
18
  - **FN-DSA** (FN-DSA-512, FN-DSA-1024)
19
- - **SQIsign** (Level 1)
19
+ - **SQIsign** (Level 1, Level 3, Level 5)
20
20
  - **ML-KEM** (512, 768, 1024) using [mlkem-native](https://github.com/pq-code-package/mlkem-native).
21
21
 
22
22
  ### NOTE: Why we support SQISign when it is 'NIST-on-ramp' only
23
23
  *TLDR; to help hurdle the "silent" barrier to post-quantum adoption: 1024-byte buffer limit in many existing FIDO2/WebAuthn implementations*
24
+ - please see our IETF standards track draft for inclusion of SQISign [cose-sqisign](https://www.ietf.org/archive/id/draft-mott-cose-sqisign-02.html)
24
25
 
25
26
  #### WebAuthn PQC Signature size constraints
26
27
  Dilithium variants, and Falcon-1024 are physical incompatibile with millions of existing FIDO2/WebAuthn authenticators that rely on the CTAP2 1024-byte buffer limit.
@@ -200,6 +201,78 @@ run().catch((err) => {
200
201
  });
201
202
  ```
202
203
 
204
+ ## Signatures
205
+
206
+ All signature variants expose the same API (`keypair()`, `sign()`, `verify()`, `buffer_to_string()`).
207
+
208
+ ### Node.js / backend (SQISign I, SQISign V, FN-DSA-512)
209
+
210
+ ```typescript
211
+ import {
212
+ loadSqisignLvl1,
213
+ loadSqisignLvl5,
214
+ loadFnDsa512,
215
+ } from "quantum-resistant-rustykey";
216
+
217
+ async function demo() {
218
+ const message = new TextEncoder().encode("RustyKey signature test");
219
+
220
+ const variants = [
221
+ ["SQIsign-I", await loadSqisignLvl1()],
222
+ ["SQIsign-V", await loadSqisignLvl5()],
223
+ ["FN-DSA-512", await loadFnDsa512()],
224
+ ] as const;
225
+
226
+ for (const [name, signer] of variants) {
227
+ const kp = signer.keypair();
228
+ const pk = await kp.get("public_key");
229
+ const sk = await kp.get("private_key");
230
+ const sig = await signer.sign(message, sk);
231
+ const ok = await signer.verify(sig, message, pk);
232
+ console.log(`${name}:`, ok ? "OK" : "FAIL");
233
+ }
234
+ }
235
+
236
+ demo().catch(console.error);
237
+ ```
238
+
239
+ ### Browser / frontend (SQISign I, SQISign V, FN-DSA-512)
240
+
241
+ ```typescript
242
+ import {
243
+ loadSqisignLvl1,
244
+ loadSqisignLvl5,
245
+ loadFnDsa512,
246
+ } from "quantum-resistant-rustykey";
247
+
248
+ const out = document.querySelector("#output") as HTMLPreElement;
249
+
250
+ async function runSignatures() {
251
+ const message = new TextEncoder().encode("hello from browser signatures");
252
+ const variants = [
253
+ ["SQIsign-I", await loadSqisignLvl1()],
254
+ ["SQIsign-V", await loadSqisignLvl5()],
255
+ ["FN-DSA-512", await loadFnDsa512()],
256
+ ] as const;
257
+
258
+ const lines: string[] = [];
259
+ for (const [name, signer] of variants) {
260
+ const kp = signer.keypair();
261
+ const pk = await kp.get("public_key");
262
+ const sk = await kp.get("private_key");
263
+ const sig = await signer.sign(message, sk);
264
+ const ok = await signer.verify(sig, message, pk);
265
+ lines.push(`${name}: ${ok ? "verify OK" : "verify FAILED"}`);
266
+ }
267
+ out.textContent = lines.join("\n");
268
+ }
269
+
270
+ runSignatures().catch((err) => {
271
+ console.error(err);
272
+ out.textContent = "signature demo failed";
273
+ });
274
+ ```
275
+
203
276
  Security note for web apps:
204
277
  - never store private keys in `localStorage`/`sessionStorage`
205
278
  - prefer HTTPS + short-lived keys
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quantum-resistant-rustykey",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
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",