kxco-post-quantum 1.1.12 → 1.2.1
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 +47 -0
- package/LICENSE +202 -21
- package/README.md +140 -119
- package/SECURITY.md +2 -1
- package/package.json +12 -5
- package/src/index.d.ts +1 -0
- package/src/index.js +17 -16
- package/src/ml-dsa.d.ts +1 -1
- package/src/ml-dsa.js +3 -3
- package/src/ml-kem.d.ts +1 -1
- package/src/ml-kem.js +1 -1
- package/src/slh-dsa.d.ts +46 -0
- package/src/slh-dsa.js +88 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.1 — 2026-07-22
|
|
4
|
+
|
|
5
|
+
Metadata alignment. No code changes; cryptographic surface is byte-for-byte
|
|
6
|
+
identical to `1.2.0` (all 39 pinned vectors match).
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- **License now `Apache-2.0`** in package metadata, matching the repository
|
|
10
|
+
LICENSE. `1.2.0` was published declaring `MIT` from a pre-relicense branch;
|
|
11
|
+
this release corrects the published license to the canonical `Apache-2.0`.
|
|
12
|
+
- `author` set to **Shayne Heffernan and John Heffernan**.
|
|
13
|
+
- README security note corrected: `@noble/post-quantum` was **not** in scope
|
|
14
|
+
of Cure53's 2023 `@noble` audit (which covered `ciphers`/`curves`/`hashes`)
|
|
15
|
+
and is maintainer self-audited — the prior "audited by Cure53 (2024)"
|
|
16
|
+
wording was inaccurate. See `AUDIT.md`.
|
|
17
|
+
|
|
18
|
+
## 1.2.0 — 2026-07-22
|
|
19
|
+
|
|
20
|
+
Adds SLH-DSA (FIPS 205) and modernises the underlying primitive engine to
|
|
21
|
+
`@noble/post-quantum@0.6.1`. **No breaking changes for consumers** — the
|
|
22
|
+
public API and all previously pinned outputs are byte-for-byte identical.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- **`slhDsa` — SLH-DSA-SHA2-192s (NIST FIPS 205)**, exported both from the
|
|
26
|
+
package root and the `kxco-post-quantum/slh-dsa` subpath. Hash-based,
|
|
27
|
+
stateless signatures at Security Category 3 (matching ML-DSA-65), whose
|
|
28
|
+
security rests only on SHA-2 — the conservative hedge alongside the
|
|
29
|
+
lattice-based ML-DSA-65. Deterministic `keypairFromMaster(master, info?)`
|
|
30
|
+
via the same HKDF-SHA-512 derivation, plus `sign` / `verify`. Public key
|
|
31
|
+
48 bytes, secret key 96 bytes, signature 16224 bytes.
|
|
32
|
+
- Test vectors extended to pin SLH-DSA keypairs and round-trip (39 checks,
|
|
33
|
+
up from 29).
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- **`@noble/post-quantum` bumped `^0.2.1` → `^0.6.1`** — the FIPS 203/204/205
|
|
37
|
+
final reference implementation. The engine's public API changed argument
|
|
38
|
+
order for signature `sign`/`verify` and requires `.js` in subpath imports;
|
|
39
|
+
both are absorbed inside this package's wrappers, so no downstream package
|
|
40
|
+
or caller is affected.
|
|
41
|
+
- Description and keywords updated to reflect SLH-DSA / FIPS 205 coverage.
|
|
42
|
+
|
|
43
|
+
### Verification
|
|
44
|
+
- 11 node tests pass, 7 browser-smoke tests pass, 39 pinned vectors pass.
|
|
45
|
+
- **Compatibility gate:** every ML-DSA-65, ML-KEM-768, HKDF, fingerprint and
|
|
46
|
+
webhook vector pinned under `@noble/post-quantum@0.2.1` still matches
|
|
47
|
+
bit-for-bit under `0.6.1`. Deterministic keys derived from existing KXCO
|
|
48
|
+
master secrets — including Armature L1 identities — are unchanged.
|
|
49
|
+
|
|
3
50
|
## 1.1.6 — 2026-05-24
|
|
4
51
|
|
|
5
52
|
Maintenance release. No breaking changes.
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,119 +1,140 @@
|
|
|
1
|
-
# kxco-post-quantum
|
|
2
|
-
|
|
3
|
-
Post-quantum cryptography primitives for the KXCO stack.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/kxco-post-quantum)
|
|
6
|
-
[ signatures
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install kxco-post-quantum
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Requires Node.js 20.19+. ESM-only.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Quick start
|
|
24
|
-
|
|
25
|
-
```js
|
|
26
|
-
import { mlDsa, mlKem, fingerprint, kidEquals } from 'kxco-post-quantum'
|
|
27
|
-
|
|
28
|
-
// ML-DSA-65 — sign and verify
|
|
29
|
-
const { publicKey, secretKey } = mlDsa.keypairFromMaster(masterSecret, 'signing-v1')
|
|
30
|
-
const sig = mlDsa.sign(secretKey, 'hello')
|
|
31
|
-
const ok = mlDsa.verify(publicKey, 'hello', sig) // true
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
|
58
|
-
|
|
59
|
-
`
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
`
|
|
99
|
-
|
|
100
|
-
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
##
|
|
118
|
-
|
|
119
|
-
|
|
1
|
+
# kxco-post-quantum
|
|
2
|
+
|
|
3
|
+
Post-quantum cryptography primitives for the KXCO stack.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/kxco-post-quantum)
|
|
6
|
+
[](https://github.com/KnightsbridgeAIQ/kxco-post-quantum/actions/workflows/ci.yml)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
|
|
9
|
+
ML-DSA-65 (FIPS 204) and SLH-DSA-SHA2-192s (FIPS 205) signatures, ML-KEM-768 (FIPS 203) key encapsulation, and key fingerprinting utilities. Wraps [`@noble/post-quantum`](https://github.com/paulmillr/noble-post-quantum) — the NIST reference implementation. All other `kxco-pq-*` packages depend on this one.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install kxco-post-quantum
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Requires Node.js 20.19+. ESM-only.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import { mlDsa, mlKem, slhDsa, fingerprint, kidEquals } from 'kxco-post-quantum'
|
|
27
|
+
|
|
28
|
+
// ML-DSA-65 — sign and verify
|
|
29
|
+
const { publicKey, secretKey } = mlDsa.keypairFromMaster(masterSecret, 'signing-v1')
|
|
30
|
+
const sig = mlDsa.sign(secretKey, 'hello')
|
|
31
|
+
const ok = mlDsa.verify(publicKey, 'hello', sig) // true
|
|
32
|
+
|
|
33
|
+
// SLH-DSA-SHA2-192s — hash-based signatures (same API shape as mlDsa)
|
|
34
|
+
const slh = slhDsa.keypairFromMaster(masterSecret, 'signing-v1')
|
|
35
|
+
const slhSig = slhDsa.sign(slh.secretKey, 'hello')
|
|
36
|
+
const slhOk = slhDsa.verify(slh.publicKey, 'hello', slhSig) // true
|
|
37
|
+
|
|
38
|
+
// Key fingerprint
|
|
39
|
+
const kid = fingerprint(publicKey) // e.g. '4a7c9e2f1b3d5680'
|
|
40
|
+
kidEquals(kid, kid) // true (constant-time)
|
|
41
|
+
|
|
42
|
+
// ML-KEM-768 — key encapsulation
|
|
43
|
+
const kemKeys = mlKem.keypairFromMaster(masterSecret, 'encryption-v1')
|
|
44
|
+
const { ciphertext, sharedSecret } = mlKem.encapsulate(kemKeys.publicKey)
|
|
45
|
+
const recovered = mlKem.decapsulate(ciphertext, kemKeys.secretKey)
|
|
46
|
+
// sharedSecret and recovered are the same 32 bytes
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`masterSecret` is a `Buffer` or `Uint8Array` with at least 16 bytes of entropy (typically 32–64 bytes from an env var or KMS).
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## API
|
|
54
|
+
|
|
55
|
+
### `mlDsa` — ML-DSA-65 (NIST FIPS 204)
|
|
56
|
+
|
|
57
|
+
| Export | Signature | Description |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `keypairFromMaster` | `(master, info?) → { publicKey, secretKey }` | Deterministic keypair via HKDF-SHA-512. `info` defaults to `'ml-dsa-65-v1'`. |
|
|
60
|
+
| `sign` | `(secretKey, message) → string` | Signs a message. Returns a hex-encoded signature (6618 chars). |
|
|
61
|
+
| `verify` | `(publicKey, message, sigHex) → boolean` | Verifies a hex-encoded signature. Returns `false` on any failure. |
|
|
62
|
+
| `ml_dsa65` | raw primitive | The underlying `@noble/post-quantum` primitive, re-exported. |
|
|
63
|
+
|
|
64
|
+
`publicKey` is 1952 bytes. `secretKey` is 4032 bytes. `message` accepts `Buffer`, `Uint8Array`, or `string`.
|
|
65
|
+
|
|
66
|
+
### `slhDsa` — SLH-DSA-SHA2-192s (NIST FIPS 205)
|
|
67
|
+
|
|
68
|
+
Hash-based, stateless signatures. Security Category 3 (matching ML-DSA-65), but security rests only on the SHA-2 hash function — no lattice or number-theoretic assumptions. Use this as a conservative hedge alongside `mlDsa`. Tradeoff: signatures are ~5× larger (16224 vs 3309 bytes) and signing is slower.
|
|
69
|
+
|
|
70
|
+
| Export | Signature | Description |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| `keypairFromMaster` | `(master, info?) → { publicKey, secretKey }` | Deterministic keypair via HKDF-SHA-512. `info` defaults to `'slh-dsa-sha2-192s-v1'`. |
|
|
73
|
+
| `sign` | `(secretKey, message) → string` | Signs a message. Returns a hex-encoded signature (32448 chars). |
|
|
74
|
+
| `verify` | `(publicKey, message, sigHex) → boolean` | Verifies a hex-encoded signature. Returns `false` on any failure. |
|
|
75
|
+
| `slh_dsa_sha2_192s` | raw primitive | The underlying `@noble/post-quantum` primitive, re-exported. |
|
|
76
|
+
|
|
77
|
+
`publicKey` is 48 bytes. `secretKey` is 96 bytes. `message` accepts `Buffer`, `Uint8Array`, or `string`.
|
|
78
|
+
|
|
79
|
+
### `mlKem` — ML-KEM-768 (NIST FIPS 203)
|
|
80
|
+
|
|
81
|
+
| Export | Signature | Description |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| `keypairFromMaster` | `(master, info?) → { publicKey, secretKey }` | Deterministic keypair via HKDF-SHA-512. `info` defaults to `'ml-kem-768-v1'`. |
|
|
84
|
+
| `encapsulate` | `(publicKey) → { ciphertext, sharedSecret }` | Generates a shared secret and ciphertext to send to the key holder. |
|
|
85
|
+
| `decapsulate` | `(ciphertext, secretKey) → Buffer` | Recovers the shared secret from a ciphertext. Returns 32 bytes. |
|
|
86
|
+
| `ml_kem768` | raw primitive | The underlying `@noble/post-quantum` primitive, re-exported. |
|
|
87
|
+
|
|
88
|
+
`publicKey` is 1184 bytes. `ciphertext` is 1088 bytes. `sharedSecret` is 32 bytes.
|
|
89
|
+
|
|
90
|
+
### `fingerprint(publicKey)` → `string`
|
|
91
|
+
|
|
92
|
+
First 16 hex characters of SHA-256 of the public key. Stable for the lifetime of the key. Accepts raw bytes or a hex string.
|
|
93
|
+
|
|
94
|
+
### `kidEquals(a, b)` → `boolean`
|
|
95
|
+
|
|
96
|
+
Constant-time comparison of two kid strings. Use this when comparing user-supplied input — not `===`.
|
|
97
|
+
|
|
98
|
+
### `deriveSeed(master, info, length)` → `Buffer`
|
|
99
|
+
|
|
100
|
+
HKDF-SHA-512 derivation. `master` must be at least 16 bytes. `info` is a required domain-separation string. Returns `length` bytes.
|
|
101
|
+
|
|
102
|
+
### `webhook` — hybrid HMAC + ML-DSA-65 delivery signing
|
|
103
|
+
|
|
104
|
+
Low-level helpers for the KXCO hybrid webhook pattern: `envelope`, `hmacHex`, `verifyHmac`, `pqSign`, `verifyPq`, `signDelivery`, `verifyDelivery`. HMAC-SHA-256 gives symmetric verification with no library dependency; ML-DSA-65 adds non-repudiation over the same `${timestamp}.${body}` envelope. The full identity/credential surface lives in `kxco-pq-sdk`.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## What this does NOT do
|
|
109
|
+
|
|
110
|
+
- No identity credentials or verifiable claims (those are in `kxco-pq-sdk`)
|
|
111
|
+
- No relay, transport, or network layer
|
|
112
|
+
- No key storage or KMS integration
|
|
113
|
+
- No FIPS 140-3 module validation (the algorithms are FIPS-standardised; the module is not validated)
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Part of the KXCO stack
|
|
118
|
+
|
|
119
|
+
`kxco-post-quantum` is the primitive layer. Everything else builds on it:
|
|
120
|
+
|
|
121
|
+
- **`kxco-pq-sdk`** — identity credentials, webhook signing, verifiable claims
|
|
122
|
+
- Other `kxco-pq-*` packages — domain-specific integrations
|
|
123
|
+
|
|
124
|
+
Install this package directly when you need ML-DSA or ML-KEM without the rest of the identity stack.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Security
|
|
129
|
+
|
|
130
|
+
Cryptographic operations delegate entirely to [`@noble/post-quantum`](https://github.com/paulmillr/noble-post-quantum) and [`@noble/hashes`](https://github.com/paulmillr/noble-hashes) — this package does not reimplement any NIST primitive. `@noble/hashes` falls under Cure53's 2023 audit of the `@noble` ecosystem (`ciphers`, `curves`, `hashes`); `@noble/post-quantum` was **not** in that audit's scope and has been self-audited by its maintainer. See [AUDIT.md](./AUDIT.md) for the full posture.
|
|
131
|
+
|
|
132
|
+
To report a vulnerability: [open a private security advisory](https://github.com/KnightsbridgeAIQ/kxco-post-quantum/security/advisories/new) or email **security@kxco.ai**.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
Apache-2.0. See [LICENSE](./LICENSE).
|
|
137
|
+
|
|
138
|
+
## Maintainers
|
|
139
|
+
|
|
140
|
+
Shayne Heffernan and John Heffernan — [KXCO by Knightsbridge](https://kxco.ai)
|
package/SECURITY.md
CHANGED
|
@@ -14,11 +14,12 @@ In scope:
|
|
|
14
14
|
- Kid fingerprint collision behaviour
|
|
15
15
|
|
|
16
16
|
Out of scope (report upstream to https://github.com/paulmillr/noble-post-quantum):
|
|
17
|
-
- Bugs in the underlying ML-DSA-65, ML-KEM-768, or HKDF primitives
|
|
17
|
+
- Bugs in the underlying ML-DSA-65, ML-KEM-768, SLH-DSA-SHA2-192s, or HKDF primitives
|
|
18
18
|
|
|
19
19
|
## Algorithms used
|
|
20
20
|
- ML-DSA-65 — NIST FIPS 204 (lattice signatures)
|
|
21
21
|
- ML-KEM-768 — NIST FIPS 203 (key encapsulation)
|
|
22
|
+
- SLH-DSA-SHA2-192s — NIST FIPS 205 (hash-based signatures)
|
|
22
23
|
- HMAC-SHA-256
|
|
23
24
|
- HKDF-SHA-512 (RFC 5869)
|
|
24
25
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kxco-post-quantum",
|
|
3
|
-
"version": "1.1
|
|
4
|
-
"description": "ML-DSA-65
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "ML-DSA-65, ML-KEM-768 and SLH-DSA-SHA2-192s primitives with key fingerprinting. The base layer for all kxco-pq-* packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"post-quantum",
|
|
7
7
|
"pqc",
|
|
8
8
|
"ml-dsa",
|
|
9
9
|
"ml-kem",
|
|
10
|
+
"slh-dsa",
|
|
11
|
+
"sphincs",
|
|
10
12
|
"dilithium",
|
|
11
13
|
"kyber",
|
|
12
14
|
"nist",
|
|
13
15
|
"fips-203",
|
|
14
16
|
"fips-204",
|
|
17
|
+
"fips-205",
|
|
15
18
|
"webhook-signing",
|
|
16
19
|
"quantum-resistant",
|
|
17
20
|
"armature",
|
|
@@ -24,8 +27,8 @@
|
|
|
24
27
|
"hybrid-signing",
|
|
25
28
|
"non-repudiation"
|
|
26
29
|
],
|
|
27
|
-
"license": "
|
|
28
|
-
"author": "
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"author": "Shayne Heffernan and John Heffernan",
|
|
29
32
|
"contributors": [
|
|
30
33
|
{
|
|
31
34
|
"name": "Shayne Heffernan"
|
|
@@ -60,6 +63,10 @@
|
|
|
60
63
|
"types": "./src/ml-kem.d.ts",
|
|
61
64
|
"import": "./src/ml-kem.js"
|
|
62
65
|
},
|
|
66
|
+
"./slh-dsa": {
|
|
67
|
+
"types": "./src/slh-dsa.d.ts",
|
|
68
|
+
"import": "./src/slh-dsa.js"
|
|
69
|
+
},
|
|
63
70
|
"./derive": {
|
|
64
71
|
"types": "./src/derive.d.ts",
|
|
65
72
|
"import": "./src/derive.js"
|
|
@@ -85,7 +92,7 @@
|
|
|
85
92
|
},
|
|
86
93
|
"dependencies": {
|
|
87
94
|
"@noble/hashes": "^2.2.0",
|
|
88
|
-
"@noble/post-quantum": "^0.
|
|
95
|
+
"@noble/post-quantum": "^0.6.1"
|
|
89
96
|
},
|
|
90
97
|
"scripts": {
|
|
91
98
|
"test": "node --test test/basic.test.js && node --test test/browser-smoke.test.js && node test/run-vectors.js",
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
// @kxco/post-quantum
|
|
2
|
-
//
|
|
3
|
-
// Production-tested post-quantum cryptography patterns: deterministic key
|
|
4
|
-
// derivation, hybrid HMAC + ML-DSA webhook signing, kid fingerprinting.
|
|
5
|
-
// Built on @noble/post-quantum. Used in production at KXCO across
|
|
6
|
-
// KnightsVault, KXCO Bank, KnightsBot, The Exchequer, and Armature L1.
|
|
7
|
-
//
|
|
8
|
-
// This package does NOT reimplement the NIST primitives. It wraps the
|
|
9
|
-
// audited @noble/post-quantum reference implementation with the integration
|
|
10
|
-
// patterns we have proven in production.
|
|
11
|
-
|
|
12
|
-
export * as mlDsa from './ml-dsa.js'
|
|
13
|
-
export * as mlKem from './ml-kem.js'
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export *
|
|
1
|
+
// @kxco/post-quantum
|
|
2
|
+
//
|
|
3
|
+
// Production-tested post-quantum cryptography patterns: deterministic key
|
|
4
|
+
// derivation, hybrid HMAC + ML-DSA webhook signing, kid fingerprinting.
|
|
5
|
+
// Built on @noble/post-quantum. Used in production at KXCO across
|
|
6
|
+
// KnightsVault, KXCO Bank, KnightsBot, The Exchequer, and Armature L1.
|
|
7
|
+
//
|
|
8
|
+
// This package does NOT reimplement the NIST primitives. It wraps the
|
|
9
|
+
// audited @noble/post-quantum reference implementation with the integration
|
|
10
|
+
// patterns we have proven in production.
|
|
11
|
+
|
|
12
|
+
export * as mlDsa from './ml-dsa.js'
|
|
13
|
+
export * as mlKem from './ml-kem.js'
|
|
14
|
+
export * as slhDsa from './slh-dsa.js'
|
|
15
|
+
export * from './derive.js'
|
|
16
|
+
export * from './kid.js'
|
|
17
|
+
export * as webhook from './webhook.js'
|
package/src/ml-dsa.d.ts
CHANGED
|
@@ -42,4 +42,4 @@ export function verify(
|
|
|
42
42
|
* who want the lower-level API. The wrapper functions above are
|
|
43
43
|
* recommended for production use.
|
|
44
44
|
*/
|
|
45
|
-
export const ml_dsa65: typeof import('@noble/post-quantum/ml-dsa').ml_dsa65
|
|
45
|
+
export const ml_dsa65: typeof import('@noble/post-quantum/ml-dsa.js').ml_dsa65
|
package/src/ml-dsa.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// Isomorphic: works in Node and modern browsers. Returns Buffer on Node
|
|
7
7
|
// (backwards compatible), Uint8Array in browsers.
|
|
8
8
|
|
|
9
|
-
import { ml_dsa65 } from '@noble/post-quantum/ml-dsa'
|
|
9
|
+
import { ml_dsa65 } from '@noble/post-quantum/ml-dsa.js'
|
|
10
10
|
import { deriveSeed } from './derive.js'
|
|
11
11
|
|
|
12
12
|
const HAS_BUFFER = typeof Buffer !== 'undefined'
|
|
@@ -55,7 +55,7 @@ export function keypairFromMaster(master, info = 'ml-dsa-65-v1') {
|
|
|
55
55
|
* @returns {string} hex-encoded signature (6618 chars)
|
|
56
56
|
*/
|
|
57
57
|
export function sign(secretKey, message) {
|
|
58
|
-
const sig = ml_dsa65.sign(
|
|
58
|
+
const sig = ml_dsa65.sign(toBytes(message), secretKey)
|
|
59
59
|
return bytesToHex(sig)
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -69,7 +69,7 @@ export function sign(secretKey, message) {
|
|
|
69
69
|
*/
|
|
70
70
|
export function verify(publicKey, message, sigHex) {
|
|
71
71
|
try {
|
|
72
|
-
return ml_dsa65.verify(
|
|
72
|
+
return ml_dsa65.verify(hexToBytes(sigHex), toBytes(message), publicKey)
|
|
73
73
|
} catch {
|
|
74
74
|
return false
|
|
75
75
|
}
|
package/src/ml-kem.d.ts
CHANGED
|
@@ -46,4 +46,4 @@ export function decapsulate(
|
|
|
46
46
|
/**
|
|
47
47
|
* Raw `@noble/post-quantum` ML-KEM-768 primitive, re-exported.
|
|
48
48
|
*/
|
|
49
|
-
export const ml_kem768: typeof import('@noble/post-quantum/ml-kem').ml_kem768
|
|
49
|
+
export const ml_kem768: typeof import('@noble/post-quantum/ml-kem.js').ml_kem768
|
package/src/ml-kem.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// Isomorphic: works in Node and modern browsers. Returns Buffer on Node
|
|
8
8
|
// (backwards compatible), Uint8Array in browsers.
|
|
9
9
|
|
|
10
|
-
import { ml_kem768 } from '@noble/post-quantum/ml-kem'
|
|
10
|
+
import { ml_kem768 } from '@noble/post-quantum/ml-kem.js'
|
|
11
11
|
import { deriveSeed } from './derive.js'
|
|
12
12
|
|
|
13
13
|
const HAS_BUFFER = typeof Buffer !== 'undefined'
|
package/src/slh-dsa.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
export interface SlhDsaKeypair {
|
|
4
|
+
/** 48-byte public key */
|
|
5
|
+
publicKey: Buffer
|
|
6
|
+
/** 96-byte secret key */
|
|
7
|
+
secretKey: Buffer
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generate an SLH-DSA-SHA2-192s (NIST FIPS 205) keypair deterministically
|
|
12
|
+
* from a master + domain-separation info string.
|
|
13
|
+
*
|
|
14
|
+
* Same inputs always produce the same keypair — no state, no DB row.
|
|
15
|
+
* Security Category 3, matching ML-DSA-65.
|
|
16
|
+
*/
|
|
17
|
+
export function keypairFromMaster(
|
|
18
|
+
master: Buffer | Uint8Array,
|
|
19
|
+
info?: string,
|
|
20
|
+
): SlhDsaKeypair
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Sign a message under an SLH-DSA-SHA2-192s secret key. Returns the signature
|
|
24
|
+
* as a hex string (16224 bytes = 32448 hex characters).
|
|
25
|
+
*/
|
|
26
|
+
export function sign(
|
|
27
|
+
secretKey: Buffer | Uint8Array,
|
|
28
|
+
message: Buffer | string,
|
|
29
|
+
): string
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Verify a hex-encoded SLH-DSA-SHA2-192s signature against a public key +
|
|
33
|
+
* message. Returns `false` on any error (invalid hex, wrong length, mismatch).
|
|
34
|
+
*/
|
|
35
|
+
export function verify(
|
|
36
|
+
publicKey: Buffer | Uint8Array,
|
|
37
|
+
message: Buffer | string,
|
|
38
|
+
sigHex: string,
|
|
39
|
+
): boolean
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Raw `@noble/post-quantum` SLH-DSA-SHA2-192s primitive, re-exported for
|
|
43
|
+
* callers who want the lower-level API. The wrapper functions above are
|
|
44
|
+
* recommended for production use.
|
|
45
|
+
*/
|
|
46
|
+
export const slh_dsa_sha2_192s: typeof import('@noble/post-quantum/slh-dsa.js').slh_dsa_sha2_192s
|
package/src/slh-dsa.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// SLH-DSA-SHA2-192s helpers (NIST FIPS 205, SPHINCS+).
|
|
2
|
+
//
|
|
3
|
+
// Stateless hash-based signatures. Security Category 3 (≈ AES-192), matching
|
|
4
|
+
// ML-DSA-65's security level. Public key 48 bytes, secret key 96 bytes,
|
|
5
|
+
// signature 16224 bytes. Security rests only on the SHA-2 hash function — no
|
|
6
|
+
// lattice or number-theoretic assumptions — which makes it the conservative
|
|
7
|
+
// hedge alongside ML-DSA-65.
|
|
8
|
+
//
|
|
9
|
+
// Tradeoff: signatures are ~5x larger than ML-DSA-65 (16224 vs 3309 bytes) and
|
|
10
|
+
// signing is slower. Use ML-DSA-65 as the default; reach for SLH-DSA when you
|
|
11
|
+
// want a signature whose security does not depend on lattice hardness.
|
|
12
|
+
//
|
|
13
|
+
// Isomorphic: works in Node and modern browsers. Returns Buffer on Node
|
|
14
|
+
// (consistent with ml-dsa.js), Uint8Array in browsers.
|
|
15
|
+
|
|
16
|
+
import { slh_dsa_sha2_192s } from '@noble/post-quantum/slh-dsa.js'
|
|
17
|
+
import { deriveSeed } from './derive.js'
|
|
18
|
+
|
|
19
|
+
const HAS_BUFFER = typeof Buffer !== 'undefined'
|
|
20
|
+
const enc = new TextEncoder()
|
|
21
|
+
|
|
22
|
+
function toBytes(input) {
|
|
23
|
+
if (input instanceof Uint8Array) return input
|
|
24
|
+
if (typeof input === 'string') return enc.encode(input)
|
|
25
|
+
throw new Error('expected Uint8Array or string')
|
|
26
|
+
}
|
|
27
|
+
function hexToBytes(hex) {
|
|
28
|
+
if (typeof hex !== 'string' || hex.length % 2) throw new Error('invalid hex')
|
|
29
|
+
const b = new Uint8Array(hex.length / 2)
|
|
30
|
+
for (let i = 0; i < b.length; i++) b[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16)
|
|
31
|
+
return b
|
|
32
|
+
}
|
|
33
|
+
function bytesToHex(bytes) {
|
|
34
|
+
let s = ''
|
|
35
|
+
for (let i = 0; i < bytes.length; i++) s += bytes[i].toString(16).padStart(2, '0')
|
|
36
|
+
return s
|
|
37
|
+
}
|
|
38
|
+
function wrap(bytes) {
|
|
39
|
+
return HAS_BUFFER ? Buffer.from(bytes) : bytes
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Seed length for SLH-DSA-SHA2-192s keygen (FIPS 205: SK.seed || SK.prf || PK.seed).
|
|
43
|
+
const SEED_BYTES = slh_dsa_sha2_192s.lengths.seed
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Generate an SLH-DSA-SHA2-192s keypair from a master + domain-separation info.
|
|
47
|
+
*
|
|
48
|
+
* @returns {{ publicKey: Buffer|Uint8Array, secretKey: Buffer|Uint8Array }}
|
|
49
|
+
*/
|
|
50
|
+
export function keypairFromMaster(master, info = 'slh-dsa-sha2-192s-v1') {
|
|
51
|
+
const seed = deriveSeed(master, info, SEED_BYTES)
|
|
52
|
+
const seedU8 = seed instanceof Uint8Array ? seed : new Uint8Array(seed)
|
|
53
|
+
const k = slh_dsa_sha2_192s.keygen(seedU8)
|
|
54
|
+
return {
|
|
55
|
+
publicKey: wrap(k.publicKey),
|
|
56
|
+
secretKey: wrap(k.secretKey),
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Sign a message. Returns the signature as a hex string.
|
|
62
|
+
*
|
|
63
|
+
* @param {Buffer|Uint8Array} secretKey
|
|
64
|
+
* @param {Buffer|Uint8Array|string} message
|
|
65
|
+
* @returns {string} hex-encoded signature (32448 chars)
|
|
66
|
+
*/
|
|
67
|
+
export function sign(secretKey, message) {
|
|
68
|
+
const sig = slh_dsa_sha2_192s.sign(toBytes(message), secretKey)
|
|
69
|
+
return bytesToHex(sig)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Verify a hex-encoded signature.
|
|
74
|
+
*
|
|
75
|
+
* @param {Buffer|Uint8Array} publicKey
|
|
76
|
+
* @param {Buffer|Uint8Array|string} message
|
|
77
|
+
* @param {string} sigHex
|
|
78
|
+
* @returns {boolean}
|
|
79
|
+
*/
|
|
80
|
+
export function verify(publicKey, message, sigHex) {
|
|
81
|
+
try {
|
|
82
|
+
return slh_dsa_sha2_192s.verify(hexToBytes(sigHex), toBytes(message), publicKey)
|
|
83
|
+
} catch {
|
|
84
|
+
return false
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { slh_dsa_sha2_192s }
|