@pinkparrot/qsafe-mayo-wasm 0.0.3 → 0.0.5
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/package.json +1 -1
- package/readme.md +17 -6
- package/gitignore +0 -2
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
JavaScript/WASM wrapper around [MAYO-C](https://github.com/PQCMayo/MAYO-C), a NIST post-quantum signature scheme finalist. Ships as two self-contained single-file modules with an unified JS API.
|
|
6
6
|
|
|
7
|
+
Special thanks to Ward Beullens and his team — post-quantum crypto is hard enough without having to invent it yourself.
|
|
8
|
+
|
|
7
9
|
## Links
|
|
8
10
|
|
|
9
|
-
- **NPM:**
|
|
11
|
+
- **NPM:** [npmjs.com/package/@pinkparrot/qsafe-mayo-wasm](https://www.npmjs.com/package/@pinkparrot/qsafe-mayo-wasm)
|
|
12
|
+
- **BROWSER** [unpkg.com/@pinkparrot/qsafe-mayo-wasm/dist/mayo.browser.min.js](https://unpkg.com/@pinkparrot/qsafe-mayo-wasm/dist/mayo.browser.min.js)
|
|
10
13
|
- **MAYO spec:** [pqmayo.org](https://pqmayo.org)
|
|
11
14
|
- **MAYO-C source:** [github.com/PQCMayo/MAYO-C](https://github.com/PQCMayo/MAYO-C)
|
|
12
15
|
|
|
13
16
|
## Install
|
|
14
17
|
```bash
|
|
15
|
-
npm install qsafe-mayo-wasm
|
|
18
|
+
npm install @pinkparrot/qsafe-mayo-wasm
|
|
16
19
|
```
|
|
17
20
|
|
|
18
21
|
## Usage
|
|
@@ -22,6 +25,7 @@ import { MayoSigner } from 'qsafe-mayo-wasm';
|
|
|
22
25
|
const mayo = await MayoSigner.create('mayo1'); // or 'mayo2'
|
|
23
26
|
|
|
24
27
|
// Generate a deterministic keypair from a 24-byte seed
|
|
28
|
+
// Param2 "storeSecretKey" (default true) -> set to false when you only need to generate keys without doing operations
|
|
25
29
|
const { publicKey, secretKey } = mayo.keypairFromSeed(seed);
|
|
26
30
|
|
|
27
31
|
// Sign
|
|
@@ -30,7 +34,7 @@ const signature = mayo.sign(msg);
|
|
|
30
34
|
// Verify (stateless — no secret key needed)
|
|
31
35
|
const valid = mayo.verify(msg, signature, publicKey);
|
|
32
36
|
|
|
33
|
-
//
|
|
37
|
+
// *Optional* Use loadSecretKey when you already have a key from a previous session
|
|
34
38
|
mayo.loadSecretKey(secretKey);
|
|
35
39
|
```
|
|
36
40
|
|
|
@@ -41,7 +45,7 @@ Factory method. Loads the WASM module and returns a ready instance.
|
|
|
41
45
|
- `variant`: `'mayo1'` (default) or `'mayo2'`
|
|
42
46
|
|
|
43
47
|
### `new MayoSigner(variant?)` + `await signer.init()`
|
|
44
|
-
Alternative if you need manual lifecycle control.
|
|
48
|
+
Alternative if you need manual lifecycle control. Use `signer.ready` to check initialization state.
|
|
45
49
|
|
|
46
50
|
### `keypairFromSeed(seed, storeSecretKey?)` → `Keypair | null`
|
|
47
51
|
Derives a keypair deterministically from a 24-byte `Uint8Array` seed.
|
|
@@ -65,9 +69,16 @@ Verifies a signature. Stateless — no secret key required.
|
|
|
65
69
|
|
|
66
70
|
## Building from source
|
|
67
71
|
|
|
68
|
-
|
|
72
|
+
Prerequisites:
|
|
73
|
+
- **Node.js** ≥ 22
|
|
74
|
+
- **Emscripten** (emcc) — see [emscripten.org](https://emscripten.org/docs/getting_started/downloads.html)
|
|
75
|
+
- **cmake** (tested with 4.x)
|
|
76
|
+
|
|
77
|
+
For exact Emscripten/cmake version requirements, see the [MAYO-C build notes](https://github.com/PQCMayo/MAYO-C).
|
|
78
|
+
|
|
69
79
|
```powershell
|
|
70
|
-
git clone --recurse-submodules https://github.com/
|
|
80
|
+
git clone --recurse-submodules https://github.com/Seigneur-Machiavel/qsafe-mayo-wasm
|
|
81
|
+
npm i --include=dev
|
|
71
82
|
.\build_mayo1.ps1 # → dist/mayo1.js
|
|
72
83
|
.\build_mayo2.ps1 # → dist/mayo2.js
|
|
73
84
|
```
|
package/gitignore
DELETED