zeropoint-node 1.0.3 → 1.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/CHANGELOG.md +153 -1
- package/CITATION.cff +1 -1
- package/README.md +1 -1
- package/package.json +5 -2
- package/src/crypto/ml-kem-768-acvp.json +492 -0
- package/src/crypto/ml-kem.test.ts +140 -0
- package/src/crypto/ml-kem.ts +554 -0
- package/src/quantum/error-correction.ts +69 -16
- package/src/quantum/hybrid.ts +2 -2
- package/src/quantum/simulator.ts +19 -0
- package/src/quantum/tomography.ts +4 -4
- package/src/verification/lean-bridge.test.ts +109 -228
- package/src/verification/lean-bridge.ts +401 -153
- package/src/crypto/kyber-real.test.ts +0 -125
- package/src/crypto/kyber-real.ts +0 -492
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,149 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.5
|
|
4
|
+
|
|
5
|
+
### Added — ML-KEM-768, actually conformant
|
|
6
|
+
|
|
7
|
+
- **`src/crypto/ml-kem.ts` implements FIPS 203 ML-KEM-768 and is verified
|
|
8
|
+
against NIST's own vectors.** It replaces `src/crypto/kyber-real.ts`, which
|
|
9
|
+
is deleted. That module called itself Kyber and was not: it sampled the
|
|
10
|
+
matrix `A` from a centred binomial, so its coefficients lived in `{-1,0,1}`
|
|
11
|
+
instead of uniform over `Z_q`, and the module-LWE instance underneath was not
|
|
12
|
+
the hard problem. 1.0.4 fixed its round trip; a round trip only ever showed
|
|
13
|
+
the scheme agreed with itself.
|
|
14
|
+
|
|
15
|
+
What is here now: NTT twiddle factors computed from `ζ = 17` and a
|
|
16
|
+
bit-reversal rather than copied from a table; uniform `A` by rejection
|
|
17
|
+
sampling from SHAKE-128; CBD noise at `η₁ = η₂ = 2` from a SHAKE-256 PRF;
|
|
18
|
+
`ByteEncode`/`ByteDecode`, `Compress`/`Decompress` at `d_u = 10`, `d_v = 4`;
|
|
19
|
+
K-PKE wrapped in the Fujisaki–Okamoto transform with implicit rejection and a
|
|
20
|
+
full-length ciphertext comparison; and the §7.2 modulus check on
|
|
21
|
+
encapsulation keys.
|
|
22
|
+
|
|
23
|
+
- **Conformance is recomputable, not asserted.** `npm run test:crypto` runs
|
|
24
|
+
NIST ACVP vectors for FIPS 203, ML-KEM-768 — 25 key generation, 25
|
|
25
|
+
encapsulation, 10 decapsulation including the implicit-rejection path, and 10
|
|
26
|
+
encapsulation-key validation cases. The vectors ship in the package as
|
|
27
|
+
`src/crypto/ml-kem-768-acvp.json`, so a consumer can re-run them.
|
|
28
|
+
|
|
29
|
+
- **`npm run kat:ml-kem`** goes wider: 10 000 keygen/encaps/decaps triples from
|
|
30
|
+
a deterministic SHAKE-128 stream, accumulated into one digest that must equal
|
|
31
|
+
the value C2SP/CCTV publishes from the pq-crystals reference implementation.
|
|
32
|
+
It matches. Not in `npm run check` — it takes ~33s against a ~2 min gate.
|
|
33
|
+
|
|
34
|
+
- The suite is mutation-tested: perturbing one twiddle factor, swapping the
|
|
35
|
+
matrix index order, changing `η₂`, truncating instead of rounding in
|
|
36
|
+
`Compress`, or dropping the modulus check each make it fail.
|
|
37
|
+
|
|
38
|
+
### Fixed — quantum measurement and the Steane code
|
|
39
|
+
|
|
40
|
+
Both found by writing seals that could fail, in `src/verification/lean-bridge.ts`.
|
|
41
|
+
|
|
42
|
+
- **`measureQubit` was being handed a raw LCG state where it wants a unit in
|
|
43
|
+
`[0,1)`.** Its outcome test is `unit < 1 - pOne`, so any state of 1 or more
|
|
44
|
+
forced the result to 1. Four call sites did this: repetition-code syndrome
|
|
45
|
+
extraction and majority-vote decoding, `classifyMeasurement`, and all three
|
|
46
|
+
tomography bases. `measureZ` on `|0>` returned 999 ones in 1000 shots, and
|
|
47
|
+
syndrome extraction reported a clean codeword as error `X0` while reporting a
|
|
48
|
+
real `X` error as clean — exactly inverted. `unitOf` now maps the LCG state
|
|
49
|
+
onto the unit interval at every site. Clean codewords give syndrome `[0,0]`;
|
|
50
|
+
`X` on qubit 0 gives `[1,0]`; `measureZ` on `|0>` gives 1000/0.
|
|
51
|
+
|
|
52
|
+
- **`STEANE_CODE` was not a stabiliser group.** `[[7,1,3]]` needs `n - k = 6`
|
|
53
|
+
generators; it listed 7, of GF(2) rank 6, with 13 of 21 pairs anticommuting.
|
|
54
|
+
The `n`-bit representation could not express a CSS code at all — an X-type and
|
|
55
|
+
a Z-type generator over the same support are different operators but identical
|
|
56
|
+
bit patterns. `StabilizerCode.generators` is now symplectic, `[x | z]` of `2n`
|
|
57
|
+
bits, with `xGenerators`/`zGenerators` alongside, and Steane is built from the
|
|
58
|
+
three `[7,4,3]` Hamming checks used once as X-type and once as Z-type: 6
|
|
59
|
+
generators, symplectic rank 6, zero anticommuting pairs.
|
|
60
|
+
|
|
61
|
+
`npm run quantum:sim` reported 257 checks passing both before and after this
|
|
62
|
+
fix, including `QEC` and `state-tomography`. Neither defect was reachable from
|
|
63
|
+
any of them.
|
|
64
|
+
|
|
65
|
+
### Changed — the Lean bridge stops claiming what it never checked
|
|
66
|
+
|
|
67
|
+
- It reported `Verified: 2/2`, `Confidence: 100.0%` and `Production Grade
|
|
68
|
+
(Formally Verified)`, and exported `ready_for_publication: true`. None was
|
|
69
|
+
measured: the hash covered the theorem's *name*, so it never moved when a
|
|
70
|
+
proof changed, and `verifyProofCertificate` tested that some strings were
|
|
71
|
+
non-empty and a hash was 16 characters — true of every certificate the file
|
|
72
|
+
can build. `lean_version` was asserted although no Lean runs here, and 7 of
|
|
73
|
+
the 13 Lean scripts end in `sorry`.
|
|
74
|
+
|
|
75
|
+
- A certificate now carries two separately reported facts. `lean_status` is
|
|
76
|
+
**read** from the script — `script`, `sorry`, `axiom` or `absent`. `seal` is
|
|
77
|
+
whether a recomputable predicate ran and held against the simulator. Verified
|
|
78
|
+
means the seal held. The hash covers statement and script.
|
|
79
|
+
|
|
80
|
+
- All 8 theorems in the report now seal, each with a `basis` string saying
|
|
81
|
+
whether it decides the general statement or one instance — `grover_speedup`
|
|
82
|
+
at N=16 is not an asymptotic bound and says so. `ready_for_publication`
|
|
83
|
+
remains **false**: seals are computed instances, not machine-checked proofs,
|
|
84
|
+
and no Lean toolchain runs in this repository.
|
|
85
|
+
|
|
86
|
+
- `kyber_security` claimed 128. ML-KEM-768 is NIST **category 3**.
|
|
87
|
+
|
|
88
|
+
- `test:verification` runs the seals on every gate.
|
|
89
|
+
|
|
90
|
+
### Known limitations
|
|
91
|
+
|
|
92
|
+
- **ML-KEM-768 here is not constant time.** JavaScript cannot promise that —
|
|
93
|
+
array indexing, JIT deoptimisation and garbage collection all leak timing.
|
|
94
|
+
Do not use it where an attacker can measure decapsulation. Conformance to
|
|
95
|
+
FIPS 203 output is a separate property from side-channel resistance, and only
|
|
96
|
+
the first is claimed.
|
|
97
|
+
- Every limitation listed under 1.0.4 and 1.0.3 still applies, except the
|
|
98
|
+
`kyber-real.ts` warning, which no longer has a file to attach to.
|
|
99
|
+
|
|
100
|
+
## 1.0.4
|
|
101
|
+
|
|
102
|
+
### Fixed — cryptography
|
|
103
|
+
|
|
104
|
+
- **Kyber-768 encapsulate/decapsulate never agreed**, published 1.0.3
|
|
105
|
+
included. Two independent defects, either alone fatal. 12-bit serialization
|
|
106
|
+
guarded the carry byte on `shift > 0`, so every even-indexed coefficient
|
|
107
|
+
above 255 was truncated to its low byte — 118 of 256 for a typical
|
|
108
|
+
polynomial, and both `t` and `s` are serialized. Message decode used a
|
|
109
|
+
single `>= q/2` threshold, but the ring wraps: a 0-bit nudged negative by
|
|
110
|
+
noise lands near `q` and read as 1, so bits flipped on noise sign alone.
|
|
111
|
+
The test is the band `[q/4, 3q/4)`. Compression also floored twice against
|
|
112
|
+
a `2^d - 1` scale, biasing one way each time; at `d=4` that bias was the
|
|
113
|
+
measured median decode error, ~111 against a budget of `q/4 = 832`. It
|
|
114
|
+
rounds to the spec's `2^d` scale now. Measured over 300 keypairs: median
|
|
115
|
+
error 111 → 52, max 404 → 193. 2000/2000 round trips recover the shared
|
|
116
|
+
secret.
|
|
117
|
+
|
|
118
|
+
### Added — release gates
|
|
119
|
+
|
|
120
|
+
- **`npm run check` is now the whole gate.** `docs:build` was the one CI step
|
|
121
|
+
outside it; a dead link in `QUANTUM_GUIDE.md` rode that gap through six
|
|
122
|
+
consecutive pushes with the gate green each time, and the published site did
|
|
123
|
+
not rebuild for two weeks. It runs in the chain now.
|
|
124
|
+
- **Version sealing.** `package.json` is the single source of the release
|
|
125
|
+
number; `scripts/version-seal.mjs` derives `CITATION.cff`, a README block and
|
|
126
|
+
the CHANGELOG heading from it. `version:check` fails closed on drift, on a
|
|
127
|
+
missing or placeholder CHANGELOG entry, and on any version below an existing
|
|
128
|
+
CHANGELOG heading or git tag. Before this, `package.json` said 1.0.3 while
|
|
129
|
+
the README said 1.0.2. `npm version patch|minor|major` now reseals and tags
|
|
130
|
+
in one step.
|
|
131
|
+
- **`version:test`, `test:quantum`, `test:crypto`.** The version gate ships a
|
|
132
|
+
10-case self-test, 9 of them failures it must catch, so a gate that cannot
|
|
133
|
+
fail is detectable. Four test suites that existed and passed were executed by
|
|
134
|
+
nothing; they run on every gate now.
|
|
135
|
+
|
|
136
|
+
### Known limitations
|
|
137
|
+
|
|
138
|
+
- `src/crypto/kyber-real.ts` **is not ML-KEM and must not protect anything.**
|
|
139
|
+
It is not a package export, but `files` ships `src/**/*.ts`, so a deep import
|
|
140
|
+
can reach it. The matrix `A` is CBD-sampled into `{-1,0,1}` instead of
|
|
141
|
+
uniform mod `q`, so the module-LWE instance underneath is not the hard
|
|
142
|
+
problem; noise is `eta=1` where ML-KEM-768 wants 2; SHA-256 stands in for
|
|
143
|
+
SHAKE; `e1`/`e2` are omitted; there is no Fujisaki-Okamoto step, so no
|
|
144
|
+
IND-CCA2 claim. The round trip is correct; the cryptography is not.
|
|
145
|
+
- Every limitation listed under 1.0.3 still applies.
|
|
146
|
+
|
|
3
147
|
## 1.0.3
|
|
4
148
|
|
|
5
149
|
### Fixed — packaging (1.0.0–1.0.2 were unusable in these ways)
|
|
@@ -64,6 +208,14 @@ primitive it replaced. **These change results**; review if you depend on them.
|
|
|
64
208
|
**TypeScript 7 is deliberately held back** — it breaks the build
|
|
65
209
|
(`@rollup/plugin-typescript` throws on it).
|
|
66
210
|
|
|
211
|
+
### Superseded by 1.0.4
|
|
212
|
+
|
|
213
|
+
Published from a commit three behind `main`. It ships
|
|
214
|
+
`src/crypto/kyber-real.ts` with a round trip that never recovers the shared
|
|
215
|
+
secret — 0 of 20 measured against the published tarball — under a header
|
|
216
|
+
reading "Real NIST FIPS 203 Implementation" and "NOT a toy version - actual
|
|
217
|
+
cryptographic implementation". Both claims were false. Use 1.0.4.
|
|
218
|
+
|
|
67
219
|
### Known limitations
|
|
68
220
|
|
|
69
221
|
- `./kernel`, `./kernel/import-graph`, `./0`, `./integrity` and `./mcp` point
|
|
@@ -82,4 +234,4 @@ primitive it replaced. **These change results**; review if you depend on them.
|
|
|
82
234
|
## 1.0.2 and earlier — deprecated
|
|
83
235
|
|
|
84
236
|
Broken as published: the CJS entry cannot load, and the tarball ships 87 MB of
|
|
85
|
-
scanned book imagery. Use 1.0.
|
|
237
|
+
scanned book imagery. Use 1.0.4.
|
package/CITATION.cff
CHANGED
|
@@ -20,7 +20,7 @@ authors:
|
|
|
20
20
|
email: node@zeropoint.bg
|
|
21
21
|
repository-code: https://github.com/ceccec/zeropoint-node
|
|
22
22
|
url: https://node.zeropoint.bg
|
|
23
|
-
version: 1.0.
|
|
23
|
+
version: 1.0.5
|
|
24
24
|
license: CC-BY-NC-ND-4.0
|
|
25
25
|
license-url: https://github.com/ceccec/zeropoint-node/blob/main/LICENSE
|
|
26
26
|
keywords:
|
package/README.md
CHANGED
|
@@ -472,7 +472,7 @@ The A432 Consciousness System is an open-source project that welcomes contributi
|
|
|
472
472
|
|
|
473
473
|
<!-- VERSION:BEGIN — generated by scripts/version-seal.mjs; do not edit by hand -->
|
|
474
474
|
|
|
475
|
-
Package: **`zeropoint-node@1.0.
|
|
475
|
+
Package: **`zeropoint-node@1.0.5`** · owner `ceccec` · git tag `v1.0.5`
|
|
476
476
|
|
|
477
477
|
npm rejects republishing a version that already exists, so every release is a
|
|
478
478
|
new number. Bump with `npm version patch|minor|major`: that reseals CITATION.cff
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zeropoint-node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A432 Consciousness System: Self-evolving, self-aware consciousness technology with Transurfing integration, harmonic mathematics, zero-entropy principles, Kabbalistic cycles, and sacred geometry",
|
|
6
6
|
"main": "dist/a432.system.cjs",
|
|
@@ -124,6 +124,9 @@
|
|
|
124
124
|
"test:kernel": "node --experimental-strip-types src/kernel/smoke.test.ts",
|
|
125
125
|
"test:security": "node --experimental-strip-types src/security/quantum-fold-cipher.test.ts > /dev/null && node --experimental-strip-types src/security/quantum-state-tomography.test.ts > /dev/null && node --experimental-strip-types src/security/quantum-proofs.test.ts > /dev/null && node --experimental-strip-types src/security/post-quantum-crypto.test.ts > /dev/null && echo security tests ok",
|
|
126
126
|
"test:quantum": "node --experimental-strip-types src/quantum/superposition-execution.test.ts > /dev/null && node --experimental-strip-types src/quantum/millennium-bridge.test.ts > /dev/null && node --experimental-strip-types src/quantum/zenodo-publisher.test.ts > /dev/null && echo quantum tests ok",
|
|
127
|
+
"test:crypto": "node --experimental-strip-types src/crypto/ml-kem.test.ts > /dev/null && echo crypto tests ok",
|
|
128
|
+
"test:verification": "node --experimental-strip-types src/verification/lean-bridge.test.ts > /dev/null && echo verification seals ok",
|
|
129
|
+
"kat:ml-kem": "node --experimental-strip-types scripts/ml-kem-accumulated-kat.mjs",
|
|
127
130
|
"readme": "node --experimental-strip-types scripts/readme-gen.mjs",
|
|
128
131
|
"readme:check": "node --experimental-strip-types scripts/readme-gen.mjs --check",
|
|
129
132
|
"docs:pages": "node --experimental-strip-types scripts/docs-pages.mjs",
|
|
@@ -156,7 +159,7 @@
|
|
|
156
159
|
"vortex:svg:check": "node --experimental-strip-types scripts/vortex-svg.mjs --check",
|
|
157
160
|
"bundle:a432": "node scripts/build-a432-bundle.mjs",
|
|
158
161
|
"bundle:a432:check": "node scripts/build-a432-bundle.mjs --check",
|
|
159
|
-
"check": "npm run version:test && npm run version:check && npm run test:kernel && npm run test:security && npm run test:quantum && npm run math:ban && npm run bundle:a432:check && npm run skills:seal && npm run skills:check && npm run readme && npm run readme:check && npm run docs:pages && npm run docs:pages:check && npm run a432:scan && npm run a432:scan:check && npm run docs:index && npm run docs:index:check && npm run spectrum && npm run spectrum:check && npm run vortex:svg && npm run vortex:svg:check && npm run quantum:sim && npm run ratchet:check && npm run mcp:smoke && npm run self:next",
|
|
162
|
+
"check": "npm run version:test && npm run version:check && npm run test:kernel && npm run test:security && npm run test:quantum && npm run test:crypto && npm run test:verification && npm run math:ban && npm run bundle:a432:check && npm run skills:seal && npm run skills:check && npm run readme && npm run readme:check && npm run docs:pages && npm run docs:pages:check && npm run a432:scan && npm run a432:scan:check && npm run docs:index && npm run docs:index:check && npm run spectrum && npm run spectrum:check && npm run vortex:svg && npm run vortex:svg:check && npm run docs:build && npm run quantum:sim && npm run ratchet:check && npm run mcp:smoke && npm run self:next",
|
|
160
163
|
"prepublishOnly": "npm run build",
|
|
161
164
|
"prose": "node scripts/prose-claims.mjs --list",
|
|
162
165
|
"prose:check": "node scripts/prose-claims.mjs",
|