@lib-q/core 0.0.1 → 0.0.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.
- package/README.md +7 -91
- package/integrity-manifest.json +6 -0
- package/nodejs/README.md +322 -0
- package/nodejs/libq.d.ts +810 -0
- package/nodejs/libq.js +2455 -0
- package/nodejs/libq_bg.wasm +0 -0
- package/nodejs/libq_bg.wasm.d.ts +123 -0
- package/nodejs/package.json +20 -0
- package/package.json +23 -12
- package/web/README.md +322 -0
- package/web/libq.d.ts +958 -0
- package/web/libq.js +2487 -0
- package/web/libq_bg.wasm +0 -0
- package/web/libq_bg.wasm.d.ts +123 -0
- package/web/package.json +24 -0
- package/.gitignore +0 -1
- package/LICENSE +0 -201
- package/libq.d.ts +0 -145
- package/libq.js +0 -801
- package/libq_bg.wasm +0 -0
- package/libq_bg.wasm.d.ts +0 -37
package/README.md
CHANGED
|
@@ -1,96 +1,12 @@
|
|
|
1
|
-
# lib-
|
|
1
|
+
# @lib-q/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Post-quantum cryptography library for Node.js (complete package)
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Key Features
|
|
10
|
-
|
|
11
|
-
- **Post-quantum first**: Post-quantum KEMs and signatures with tiered symmetric options
|
|
12
|
-
- **NIST-approved**: All algorithms are NIST PQC standardized
|
|
13
|
-
- **Memory safe**: Built in Rust with zero-cost abstractions
|
|
14
|
-
- **Cross-platform**: Native Rust + WASM compilation
|
|
15
|
-
- **Familiar API**: libsodium-style interface for easy migration
|
|
16
|
-
- **Zero dependencies**: Self-contained implementations
|
|
17
|
-
- **Three security tiers**: Ultra-secure, balanced, and performance-optimized options
|
|
18
|
-
|
|
19
|
-
## Supported Algorithms
|
|
20
|
-
|
|
21
|
-
### Key Encapsulation Mechanisms (KEMs)
|
|
22
|
-
- **CRYSTALS-Kyber** (Level 1, 3, 5)
|
|
23
|
-
- **Classic McEliece** (Level 1, 3, 4, 5)
|
|
24
|
-
- **HQC** (Level 1, 3, 4, 5)
|
|
25
|
-
|
|
26
|
-
### Digital Signatures
|
|
27
|
-
- **CRYSTALS-Dilithium** (Level 1, 3, 5)
|
|
28
|
-
- **Falcon** (Level 1, 5)
|
|
29
|
-
- **SPHINCS+** (Level 1, 3, 5)
|
|
30
|
-
|
|
31
|
-
### Hash Functions
|
|
32
|
-
- **SHAKE256** (for hash-based signatures)
|
|
33
|
-
- **SHAKE128** (for general hashing)
|
|
34
|
-
- **cSHAKE256** (customizable hashing)
|
|
35
|
-
|
|
36
|
-
### Hybrid Public Key Encryption (HPKE)
|
|
37
|
-
- **PQ-HPKE** (pure post-quantum)
|
|
38
|
-
- **Hybrid HPKE** (PQ KEM + classical symmetric)
|
|
39
|
-
- **Performance HPKE** (PQ KEM + optimized classical)
|
|
40
|
-
|
|
41
|
-
### Zero-Knowledge Proofs (ZKPs)
|
|
42
|
-
- **zk-STARKs** (scalable, transparent, post-quantum secure)
|
|
43
|
-
- **Proof generation and verification**
|
|
44
|
-
- **Privacy-preserving computation**
|
|
45
|
-
- **WASM compatible**
|
|
46
|
-
|
|
47
|
-
## Architecture
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
lib-Q/
|
|
51
|
-
├── src/
|
|
52
|
-
│ ├── kem/ # Key Encapsulation Mechanisms
|
|
53
|
-
│ ├── sig/ # Digital Signatures
|
|
54
|
-
│ ├── hash/ # Hash Functions
|
|
55
|
-
│ ├── aead/ # Authenticated Encryption
|
|
56
|
-
│ ├── zkp/ # Zero-Knowledge Proofs
|
|
57
|
-
│ ├── utils/ # Utilities and helpers
|
|
58
|
-
│ └── wasm/ # WASM bindings
|
|
59
|
-
├── tests/ # Comprehensive test suite
|
|
60
|
-
├── benches/ # Performance benchmarks
|
|
61
|
-
├── docs/ # Documentation
|
|
62
|
-
└── examples/ # Usage examples
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lib-q/core@0.0.2
|
|
63
9
|
```
|
|
64
10
|
|
|
65
|
-
##
|
|
66
|
-
|
|
67
|
-
- **Zero classical crypto**: No reliance on classical algorithms
|
|
68
|
-
- **Constant-time operations**: All cryptographic operations are constant-time
|
|
69
|
-
- **Secure memory**: Automatic secure memory zeroing
|
|
70
|
-
- **No side-channels**: Designed to prevent timing and power analysis attacks
|
|
71
|
-
|
|
72
|
-
## Development Status
|
|
73
|
-
|
|
74
|
-
**Planning Phase** - Architecture and algorithm selection complete
|
|
75
|
-
|
|
76
|
-
## Documentation
|
|
77
|
-
|
|
78
|
-
- [Development Plan](docs/development-plan.md)
|
|
79
|
-
- [Security Model](docs/security.md)
|
|
80
|
-
- [API Design](docs/api-design.md)
|
|
81
|
-
- [HPKE Architecture](docs/hpke-architecture.md)
|
|
82
|
-
- [Memory Architecture](docs/memory-architecture.md)
|
|
83
|
-
- [Interoperability](docs/interoperability.md)
|
|
84
|
-
- [Architecture Summary](docs/architecture-summary.md)
|
|
85
|
-
|
|
86
|
-
## License
|
|
87
|
-
|
|
88
|
-
Apache 2.0 License - see [LICENSE](LICENSE) for details.
|
|
89
|
-
|
|
90
|
-
## Contributing
|
|
91
|
-
|
|
92
|
-
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
93
|
-
|
|
94
|
-
## Security Notice
|
|
95
|
-
|
|
96
|
-
This library is in development. Do not use in production until a stable release is available.
|
|
11
|
+
## Subresource integrity (SHA-384)
|
|
12
|
+
Paths in `integrity-manifest.json` are relative to the package root.
|
package/nodejs/README.md
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# lib-Q - Post-Quantum Cryptography Library
|
|
2
|
+
|
|
3
|
+
A Rust cryptography workspace focused on **NIST-standardized post-quantum** key exchange and signatures, **SHA-3-family** hashes and XOFs, and a **transparent STARK**–based zero-knowledge stack. CI enforces `cargo check --workspace --exclude lib-q-examples --exclude lib-q-sca-test --target wasm32-unknown-unknown` (with the `getrandom` wasm_js cfg) so the **publishable library workspace** compiles for the WebAssembly target; npm bundles are produced for the `@lib-q/*` packages listed below (see [docs/npm-packages.md](docs/npm-packages.md)). For build modes, feature flags, and browser baselines, see [docs/wasm-compilation.md](docs/wasm-compilation.md).
|
|
4
|
+
|
|
5
|
+
## Mission
|
|
6
|
+
|
|
7
|
+
lib-Q provides a coherent Rust API surface over NIST-track post-quantum primitives, SHA-3–family hashing, Saturnin AEAD, HPKE, and optional STARK-based proofs, with the goal of keeping advanced cryptography approachable without hiding residual implementation risk.
|
|
8
|
+
|
|
9
|
+
## Key features
|
|
10
|
+
|
|
11
|
+
- **Post-quantum first**: Post-quantum KEMs and signatures with tiered symmetric options
|
|
12
|
+
- **Standards-aligned**: PQC KEMs and signatures track NIST-standardized modules (e.g. FIPS 203/204/205/206, HQC, Classic McEliece–family CB-KEM); hashes and XOFs use the SHA-3 family; symmetric design centers on Saturnin; ZKPs use a transparent STARK stack (complementary to the NIST PQC algorithm set)
|
|
13
|
+
- **Memory safe**: Built in Rust with zero-cost abstractions
|
|
14
|
+
- **Cross-platform**: Native Rust + WASM compilation
|
|
15
|
+
- **Intuitive API**: Clean, consistent interface designed for modern development
|
|
16
|
+
- **Self-contained algorithms**: No external non-Rust tooling required for core use
|
|
17
|
+
- **Three security tiers**: Ultra-secure, balanced, and performance-optimized options
|
|
18
|
+
- **Modular design**: Use only what you need with individual crates and npm packages
|
|
19
|
+
|
|
20
|
+
## no_std, embedded, and WebAssembly
|
|
21
|
+
|
|
22
|
+
- **Umbrella `lib-q` crate**: Disabling default features applies `#![no_std]` to this crate's own code, but some path dependencies are still declared with `std` enabled (for example unified signature support via `lib-q-sig`). The final artifact may still link the standard library. For a **true** `no_std` + `alloc` dependency tree, use the **workspace crates you need** (`lib-q-core`, `lib-q-kem`, `lib-q-ml-dsa`, etc.) with `--no-default-features` and each crate's `alloc` / algorithm features. Per-crate READMEs describe WASM and `no_std` where relevant (for example [lib-q-saturnin/README.md](lib-q-saturnin/README.md)).
|
|
23
|
+
|
|
24
|
+
- **WASM and `getrandom`**: Match CI when compiling for `wasm32-unknown-unknown`: set `CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS` to `--cfg getrandom_backend="wasm_js" -C panic=abort` (see [.github/actions/wasm-build/action.yml](.github/actions/wasm-build/action.yml), [scripts/build-wasm.ps1](scripts/build-wasm.ps1), [scripts/security-check.ps1](scripts/security-check.ps1)).
|
|
25
|
+
|
|
26
|
+
- **`lib-q-zkp`**: Ships a `cdylib` + `wasm` feature for `wasm-pack` / `@lib-q/zkp`; CI also `cargo check`s the ZKP stack on `wasm32-unknown-unknown`.
|
|
27
|
+
|
|
28
|
+
### Browser example
|
|
29
|
+
|
|
30
|
+
The minimal browser demo in [`examples/wasm-browser-demo`](examples/wasm-browser-demo) exposes an ML-DSA-44 smoke API:
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
import init, { wasm_smoke_ml_dsa_sign_verify } from "./pkg/wasm_browser_demo.js";
|
|
34
|
+
|
|
35
|
+
await init();
|
|
36
|
+
const ok = await wasm_smoke_ml_dsa_sign_verify();
|
|
37
|
+
console.log("ML-DSA wasm smoke:", ok);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Package structure
|
|
41
|
+
|
|
42
|
+
lib-Q is organized as a Rust workspace with individual crates and npm packages:
|
|
43
|
+
|
|
44
|
+
### Rust workspace crates
|
|
45
|
+
|
|
46
|
+
Publishing to [crates.io](https://crates.io/) is driven by [`.github/workflows/cd.yml`](.github/workflows/cd.yml) in dependency order. The `examples` umbrella and `examples/wasm-browser-demo` are integration harnesses (`publish = false` where set); other members follow `[workspace].members` in [Cargo.toml](Cargo.toml). The workspace-wide WASM compile gate excludes those example crates and `lib-q-sca-test`.
|
|
47
|
+
|
|
48
|
+
| Crate | Role |
|
|
49
|
+
|-------|------|
|
|
50
|
+
| **`lib-q`** | Umbrella library (feature-gated re-exports) |
|
|
51
|
+
| **`lib-q-types`** | Shared type definitions |
|
|
52
|
+
| **`lib-q-core`** | Core types, traits, provider surface, validation |
|
|
53
|
+
| **`lib-q-keccak`** | Keccak-f / sponge building blocks |
|
|
54
|
+
| **`lib-q-k12`** | KangarooTwelve (K12) |
|
|
55
|
+
| **`lib-q-sha3`** | SHA-3 / SHAKE / cSHAKE core |
|
|
56
|
+
| **`lib-q-keccak-digest`** | Digest adapter over Keccak |
|
|
57
|
+
| **`lib-q-kem`** | KEM façade (ML-KEM, CB-KEM, HQC integration) |
|
|
58
|
+
| **`lib-q-ml-kem`** | ML-KEM (FIPS 203) |
|
|
59
|
+
| **`lib-q-ml-dsa`** | ML-DSA (FIPS 204) |
|
|
60
|
+
| **`lib-q-ring`** | Negacyclic ring / NTT layer for ML-DSA |
|
|
61
|
+
| **`lib-q-sca-test`** | Statistical side-channel harness (TVLA-style) |
|
|
62
|
+
| **`lib-q-lattice-zkp`** | Module-lattice commitments / sigma research |
|
|
63
|
+
| **`lib-q-ring-sig`** | Ring-style openings / DualRing pilots |
|
|
64
|
+
| **`lib-q-prf`** | Legendre / Gold PRF building blocks |
|
|
65
|
+
| **`lib-q-platform`** | Platform helpers |
|
|
66
|
+
| **`lib-q-intrinsics`** | SIMD / intrinsics helpers |
|
|
67
|
+
| **`lib-q-sig`** | Signature façade (ML-DSA, SLH-DSA) |
|
|
68
|
+
| **`lib-q-hash`** | Hash façade (SHAKE, KMAC, TupleHash, etc.) |
|
|
69
|
+
| **`lib-q-aead`** | AEAD façade (Saturnin, Romulus, duplex, tweak) |
|
|
70
|
+
| **`lib-q-saturnin`** | Saturnin suite |
|
|
71
|
+
| **`lib-q-duplex-aead`** | Duplex-sponge AEAD |
|
|
72
|
+
| **`lib-q-tweak-aead`** | Tweakable CTR AEAD over Keccak |
|
|
73
|
+
| **`lib-q-romulus`** | Romulus AEAD (Skinny-based) |
|
|
74
|
+
| **`lib-q-hpke`** | HPKE (RFC 9180) |
|
|
75
|
+
| **`lib-q-utils`** | Shared utilities |
|
|
76
|
+
| **`lib-q-zkp`** | ZKP public API (STARK-backed) |
|
|
77
|
+
| **`lib-q-fn-dsa`** | FN-DSA (FIPS 206) |
|
|
78
|
+
| **`lib-q-slh-dsa`** | SLH-DSA (FIPS 205) |
|
|
79
|
+
| **`lib-q-cb-kem`** | Classic McEliece–family CB-KEM |
|
|
80
|
+
| **`lib-q-random`** | Randomness / entropy helpers |
|
|
81
|
+
| **`lib-q-hqc`** | HQC KEM |
|
|
82
|
+
| **`lib-q-hqc-traits`** | HQC shared traits (`lib-q-hqc/traits`) |
|
|
83
|
+
| **`lib-q-stark`** | STARK prover stack (top-level) |
|
|
84
|
+
| **`lib-q-stark-air`** | AIR definitions |
|
|
85
|
+
| **`lib-q-stark-challenger`** | Fiat–Shamir challenger |
|
|
86
|
+
| **`lib-q-stark-commit`** | Commitment layer |
|
|
87
|
+
| **`lib-q-stark-dft`** | DFT / NTT for STARKs |
|
|
88
|
+
| **`lib-q-stark-field`** | Field arithmetic |
|
|
89
|
+
| **`lib-q-stark-field-testing`** | Field test helpers |
|
|
90
|
+
| **`lib-q-stark-fri`** | FRI |
|
|
91
|
+
| **`lib-q-stark-interpolation`** | Interpolation |
|
|
92
|
+
| **`lib-q-stark-matrix`** | Matrix ops |
|
|
93
|
+
| **`lib-q-stark-mds`** | MDS layer |
|
|
94
|
+
| **`lib-q-stark-merkle`** | Merkle trees |
|
|
95
|
+
| **`lib-q-stark-mersenne31`** | Mersenne-31 field |
|
|
96
|
+
| **`lib-q-stark-monty31`** | Monty-31 field |
|
|
97
|
+
| **`lib-q-stark-rayon`** | Optional Rayon parallelism |
|
|
98
|
+
| **`lib-q-stark-symmetric`** | Symmetric primitives for STARKs |
|
|
99
|
+
| **`lib-q-stark-util`** | STARK utilities |
|
|
100
|
+
| **`lib-q-stark-shake256`** | SHAKE256 bindings |
|
|
101
|
+
| **`lib-q-stark-shake128`** | SHAKE128 bindings |
|
|
102
|
+
| **`lib-q-stark-sha3-256`** | SHA3-256 bindings |
|
|
103
|
+
| **`lib-q-poseidon`** | Poseidon permutation |
|
|
104
|
+
| **`lib-q-plonky-multilinear-util`** | Plonky3 multilinear utilities |
|
|
105
|
+
| **`lib-q-plonky-keccak-air`** | Keccak AIR |
|
|
106
|
+
| **`lib-q-plonky-lookup`** | Lookup argument support |
|
|
107
|
+
| **`lib-q-plonky-uni-stark`** | Univariate STARK |
|
|
108
|
+
| **`lib-q-plonky-batch-stark`** | Batch STARK |
|
|
109
|
+
| **`lib-q-plonky`** | Plonky3-derived integration |
|
|
110
|
+
|
|
111
|
+
### npm packages (npmjs.com)
|
|
112
|
+
|
|
113
|
+
These packages are built with `wasm-pack` in CD and correspond to stable JS entry points; other crates are **Rust-only** on crates.io but still participate in the workspace wasm compile gate.
|
|
114
|
+
|
|
115
|
+
- **`@lib-q/core`** — Umbrella WASM bundle (all algorithms path used in CD)
|
|
116
|
+
- **`@lib-q/ml-kem`** — ML-KEM (FIPS 203) only
|
|
117
|
+
- **`@lib-q/kem`** — Post-quantum KEM façade
|
|
118
|
+
- **`@lib-q/sig`** — Post-quantum signatures (ML-DSA path in CD)
|
|
119
|
+
- **`@lib-q/fn-dsa`** — FN-DSA (FIPS 206)
|
|
120
|
+
- **`@lib-q/hash`** — SHA-3–family hash façade
|
|
121
|
+
- **`@lib-q/utils`** — Utilities
|
|
122
|
+
- **`@lib-q/aead`** — Post-quantum AEAD (Saturnin, Romulus, duplex-sponge)
|
|
123
|
+
- **`@lib-q/hpke`** — Post-quantum HPKE (RFC 9180)
|
|
124
|
+
- **`@lib-q/zkp`** — ZKP / STARK proofs (high-level JSON API)
|
|
125
|
+
- **`@lib-q/random`** — Secure random bytes (`getrandom` / wasm_js)
|
|
126
|
+
- **`@lib-q/hqc`** — HQC KEM
|
|
127
|
+
- **`@lib-q/slh-dsa`** — SLH-DSA (FIPS 205)
|
|
128
|
+
- **`@lib-q/cb-kem`** — Classic McEliece CB-KEM (single compile-time parameter set per build)
|
|
129
|
+
- **`@lib-q/ring-sig`** — Federation / DualRing-LB pilot bindings
|
|
130
|
+
- **`@lib-q/prf`** — Legendre / Gold PRF pilots
|
|
131
|
+
|
|
132
|
+
## Installation
|
|
133
|
+
|
|
134
|
+
### Rust (Complete Library)
|
|
135
|
+
```bash
|
|
136
|
+
cargo add lib-q
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Rust (Individual Crates)
|
|
140
|
+
```bash
|
|
141
|
+
# For KEM operations only
|
|
142
|
+
cargo add lib-q-kem
|
|
143
|
+
|
|
144
|
+
# For signatures only
|
|
145
|
+
cargo add lib-q-sig
|
|
146
|
+
|
|
147
|
+
# For FN-DSA signatures only
|
|
148
|
+
cargo add lib-q-fn-dsa
|
|
149
|
+
|
|
150
|
+
# For hash functions only
|
|
151
|
+
cargo add lib-q-hash
|
|
152
|
+
|
|
153
|
+
# For utilities only
|
|
154
|
+
cargo add lib-q-utils
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Node.js (Complete Library)
|
|
158
|
+
```bash
|
|
159
|
+
npm install @lib-q/core
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Node.js (Individual Packages)
|
|
163
|
+
```bash
|
|
164
|
+
# For ML-KEM only
|
|
165
|
+
npm install @lib-q/ml-kem
|
|
166
|
+
|
|
167
|
+
# For KEM operations only
|
|
168
|
+
npm install @lib-q/kem
|
|
169
|
+
|
|
170
|
+
# For signatures only
|
|
171
|
+
npm install @lib-q/sig
|
|
172
|
+
|
|
173
|
+
# For FN-DSA signatures only
|
|
174
|
+
npm install @lib-q/fn-dsa
|
|
175
|
+
|
|
176
|
+
# For hash functions only
|
|
177
|
+
npm install @lib-q/hash
|
|
178
|
+
|
|
179
|
+
# For utilities only
|
|
180
|
+
npm install @lib-q/utils
|
|
181
|
+
|
|
182
|
+
# AEAD, HPKE, ZKP, RNG, HQC, SLH-DSA, CB-KEM, ring-sig, PRF
|
|
183
|
+
npm install @lib-q/aead @lib-q/hpke @lib-q/zkp @lib-q/random @lib-q/hqc @lib-q/slh-dsa @lib-q/cb-kem @lib-q/ring-sig @lib-q/prf
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Supported algorithms
|
|
187
|
+
|
|
188
|
+
### Key encapsulation mechanisms (KEMs)
|
|
189
|
+
- **ML-KEM** (FIPS 203; security levels 1, 3, and 5)
|
|
190
|
+
- **CB-KEM** (code-based KEM in the Classic McEliece family; five NIST parameter sets, selectable via crate features)
|
|
191
|
+
- **HQC** (NIST-standardized code-based KEM; parameter sets HQC-128, HQC-192, and HQC-256, corresponding to levels 1, 3, and 5)
|
|
192
|
+
|
|
193
|
+
### Digital signatures
|
|
194
|
+
- **ML-DSA** (FIPS 204; levels 1, 3, and 5)
|
|
195
|
+
- **FN-DSA** (FIPS 206; levels 1 and 5)
|
|
196
|
+
- **SLH-DSA** (FIPS 205; levels 1, 3, and 5)
|
|
197
|
+
|
|
198
|
+
### Hash functions
|
|
199
|
+
- **SHAKE256**, **SHAKE128**, **cSHAKE256** (SHA-3 family; used across signatures, KDFs, and protocols)
|
|
200
|
+
- Additional SHA-3–family APIs where exposed by `lib-q-hash` and related workspace crates (see crate documentation)
|
|
201
|
+
|
|
202
|
+
### Authenticated encryption
|
|
203
|
+
- **Saturnin** (post-quantum symmetric suite: AEAD, block cipher, hash, and stream modes)
|
|
204
|
+
|
|
205
|
+
### Hybrid public-key encryption (HPKE)
|
|
206
|
+
- **Tier 1: Ultra-Secure** (Pure post-quantum with SHAKE256-based AEAD)
|
|
207
|
+
- **Tier 2: Balanced** (Post-quantum KEM + Saturnin AEAD)
|
|
208
|
+
- **Tier 3: Performance** (Post-quantum KEM + optimized Saturnin)
|
|
209
|
+
|
|
210
|
+
### Zero-knowledge proofs (ZKPs)
|
|
211
|
+
- **zk-STARKs** (transparent, post-quantum-friendly proof system used in this stack)
|
|
212
|
+
- **Proof generation and verification** via `lib-q-zkp` (built on the workspace STARK crates)
|
|
213
|
+
- **WASM**: `lib-q-zkp` is checked for `wasm32-unknown-unknown` in CI when the relevant features are enabled
|
|
214
|
+
- **Deeper stack**: `lib-q-plonky` and related crates host the Plonky3-derived STARK pipeline (including univariate and batch STARK, Keccak AIR, and lookup support), gated by features for selective compilation
|
|
215
|
+
|
|
216
|
+
## Architecture
|
|
217
|
+
|
|
218
|
+
The workspace is centered on the umbrella **`lib-q`** crate and splits algorithms and infrastructure across focused crates. Conceptually:
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
lib-Q/ (repository root)
|
|
222
|
+
├── lib-q/ # Umbrella library (feature-gated re-exports)
|
|
223
|
+
├── lib-q-core/ # Types, traits, provider surface, validation
|
|
224
|
+
├── lib-q-kem/ # KEM façade and integrations
|
|
225
|
+
├── lib-q-ml-kem/, lib-q-cb-kem/, lib-q-hqc/ # Concrete KEM implementations
|
|
226
|
+
├── lib-q-ring/ # ML-DSA field / NTT shared layer
|
|
227
|
+
├── lib-q-prf/, lib-q-ring-sig/ # PRF pilots + lattice-backed ring-style openings (research)
|
|
228
|
+
├── lib-q-sig/, lib-q-ml-dsa/, lib-q-slh-dsa/, lib-q-fn-dsa/
|
|
229
|
+
├── lib-q-lattice-zkp/ # Module-lattice ZKP research (sigma, commitments)
|
|
230
|
+
├── lib-q-sca-test/ # SCA screening tooling
|
|
231
|
+
├── lib-q-hash/, lib-q-sha3/, lib-q-keccak/, lib-q-k12/
|
|
232
|
+
├── lib-q-aead/, lib-q-saturnin/
|
|
233
|
+
├── lib-q-hpke/
|
|
234
|
+
├── lib-q-zkp/, lib-q-stark*/, lib-q-plonky*/
|
|
235
|
+
├── lib-q-utils/, lib-q-random/, lib-q-platform/, …
|
|
236
|
+
└── examples/
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The table above is the authoritative crate list; the `[workspace].members` table in [Cargo.toml](Cargo.toml) is the same set plus the non-published `examples` member.
|
|
240
|
+
|
|
241
|
+
## Security model
|
|
242
|
+
|
|
243
|
+
- **Post-quantum asymmetric**: No classical public-key schemes (RSA, ECC, etc.) for those roles; asymmetric modules track NIST PQC (see [SECURITY.md](SECURITY.md)).
|
|
244
|
+
- **Hashes / XOFs**: Cryptographic design targets the SHA-3 family; symmetric constructions center on Saturnin and SHAKE-based options as documented per crate.
|
|
245
|
+
- **Constant-time intent**: Critical paths are written for constant-time behavior; full guarantees require platform-specific review and tooling (see [ROADMAP.md](ROADMAP.md)).
|
|
246
|
+
- **Secure memory**: Sensitive buffers use explicit zeroization where the type system allows.
|
|
247
|
+
- **Side-channel awareness**: Design and review target timing and cache behavior; formal side-channel certification is not yet claimed.
|
|
248
|
+
|
|
249
|
+
## Development status
|
|
250
|
+
|
|
251
|
+
**Active development.** Major algorithms are implemented and covered by automated tests; the library remains **pre-production** until independent audit and release hardening (see [SECURITY.md](SECURITY.md)).
|
|
252
|
+
|
|
253
|
+
### Implemented capabilities
|
|
254
|
+
- **ML-DSA** (FIPS 204; parameter sets ML-DSA-44, ML-DSA-65, ML-DSA-87) with provider-style integration
|
|
255
|
+
- **FN-DSA** (FIPS 206) with CI coverage
|
|
256
|
+
- **SLH-DSA** (FIPS 205) including all twelve SLH-DSA parameter sets
|
|
257
|
+
- **ML-KEM** (FIPS 203; levels 1, 3, and 5)
|
|
258
|
+
- **CB-KEM** (Classic McEliece–family; five parameter sets, feature-selected)
|
|
259
|
+
- **HQC** (HQC-128, HQC-192, HQC-256)
|
|
260
|
+
- **Saturnin** (AEAD, block, hash, stream modes)
|
|
261
|
+
- **HPKE** (RFC 9180) with post-quantum KEM and AEAD options
|
|
262
|
+
- **Hash and XOF suite** (SHA-3 family, including SHAKE and cSHAKE, as exposed by workspace crates)
|
|
263
|
+
- **ZKP / STARK stack** (`lib-q-zkp` and supporting `lib-q-stark*` / `lib-q-plonky*` crates)
|
|
264
|
+
- **Lattice infrastructure** (`lib-q-ring` for ML-DSA field arithmetic; `lib-q-lattice-zkp` for research-grade module-lattice proofs, separate from STARKs)
|
|
265
|
+
- **PRF and ring-style opening pilots** (`lib-q-prf`, `lib-q-ring-sig`; research crates layered on lattice commitments—see per-crate READMEs)
|
|
266
|
+
- **Side-channel tooling** (`lib-q-sca-test` for statistical leakage screening, not a certification claim)
|
|
267
|
+
- **WASM** build paths for core scenarios (see CI and scripts referenced in the [no_std and WASM](#no_std-embedded-and-webassembly) section)
|
|
268
|
+
- **Engineering**: consistent error types, security validation utilities, and GitHub Actions for build, test, coverage, and security checks
|
|
269
|
+
|
|
270
|
+
### Near-term focus
|
|
271
|
+
- **Performance and ergonomics** for CB-KEM and other large-key KEMs
|
|
272
|
+
- **Assurance**: expanded fuzzing, constant-time verification where feasible, and third-party security review
|
|
273
|
+
- **ZKP**: documentation, API stability, and production-oriented hardening of the STARK pipeline
|
|
274
|
+
|
|
275
|
+
## Testing
|
|
276
|
+
|
|
277
|
+
### `lib-q-sig` and SLH-DSA features
|
|
278
|
+
|
|
279
|
+
`lib-q-sig` separates **algorithm enablement** from **who supplies randomness**:
|
|
280
|
+
|
|
281
|
+
- **`slh-dsa`**: SLH-DSA with caller-supplied randomness (suitable for `no_std` and tests that pass explicit buffers).
|
|
282
|
+
- **`slh-dsa-std`**: The above plus OS-backed entropy when APIs use `None` for randomness on std targets.
|
|
283
|
+
|
|
284
|
+
Run crate integration tests accordingly:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
cargo test -p lib-q-sig --features slh-dsa
|
|
288
|
+
cargo test -p lib-q-sig --features slh-dsa-std
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
The second command includes end-to-end tests that rely on implicit RNG wiring (`lib-q-random`); the first is appropriate when you only need explicit-randomness coverage.
|
|
292
|
+
|
|
293
|
+
## Documentation
|
|
294
|
+
|
|
295
|
+
- [ROADMAP](ROADMAP.md)
|
|
296
|
+
- [Security policy](SECURITY.md)
|
|
297
|
+
- [Security model (technical)](docs/security.md)
|
|
298
|
+
- [ZKP Implementation and Library Layout](docs/zkp-implementation.md) (includes STARK stack and `lib-q-lattice-zkp`)
|
|
299
|
+
- [API Design](docs/api-design.md)
|
|
300
|
+
- [HPKE Architecture](docs/hpke-architecture.md)
|
|
301
|
+
- [Memory Architecture](docs/memory-architecture.md)
|
|
302
|
+
- [Interoperability](docs/interoperability.md)
|
|
303
|
+
- [Entropy Validation](docs/entropy-validation.md)
|
|
304
|
+
- [Test Coverage](docs/test-coverage.md)
|
|
305
|
+
- [AI-Generated Wiki](https://deepwiki.com/Enkom-Tech/libQ)
|
|
306
|
+
|
|
307
|
+
## License
|
|
308
|
+
|
|
309
|
+
Apache 2.0 License - see [LICENSE](LICENSE) for details.
|
|
310
|
+
|
|
311
|
+
## Contributing
|
|
312
|
+
|
|
313
|
+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
314
|
+
|
|
315
|
+
## Security notice
|
|
316
|
+
|
|
317
|
+
This project ships real cryptographic code but is **not positioned as production-ready**. Treat it as suitable for research, education, interoperability experiments, and internal prototypes until:
|
|
318
|
+
|
|
319
|
+
- An independent security audit of the code you enable has been completed, and
|
|
320
|
+
- Your own integration testing, threat modeling, and operational controls are in place.
|
|
321
|
+
|
|
322
|
+
Absence of a published vulnerability report does not constitute a warranty. Track [SECURITY.md](SECURITY.md) for supported branches, reporting, and update policy.
|