@sebastienrousseau/crypto-lib 0.0.2 → 0.0.7

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 (243) hide show
  1. package/README.md +334 -185
  2. package/dist/accel/index.d.ts +11 -0
  3. package/dist/accel/index.d.ts.map +1 -0
  4. package/dist/accel/index.js +31 -0
  5. package/dist/accel/native-pqc-bridge.d.ts +18 -0
  6. package/dist/accel/native-pqc-bridge.d.ts.map +1 -0
  7. package/dist/accel/native-pqc-bridge.js +100 -0
  8. package/dist/accel/wasm-bridge.d.ts +35 -0
  9. package/dist/accel/wasm-bridge.d.ts.map +1 -0
  10. package/dist/accel/wasm-bridge.js +161 -0
  11. package/dist/accel/webcrypto-bridge.d.ts +32 -0
  12. package/dist/accel/webcrypto-bridge.d.ts.map +1 -0
  13. package/dist/accel/webcrypto-bridge.js +179 -0
  14. package/dist/accel/webcrypto-modern.d.ts +40 -0
  15. package/dist/accel/webcrypto-modern.d.ts.map +1 -0
  16. package/dist/accel/webcrypto-modern.js +213 -0
  17. package/dist/accel/worker-pool.d.ts +23 -0
  18. package/dist/accel/worker-pool.d.ts.map +1 -0
  19. package/dist/accel/worker-pool.js +119 -0
  20. package/dist/bin/cryptolib.d.ts +25 -0
  21. package/dist/bin/cryptolib.d.ts.map +1 -0
  22. package/dist/bin/cryptolib.js +87 -0
  23. package/dist/config/config.d.ts +8 -0
  24. package/dist/config/config.d.ts.map +1 -0
  25. package/dist/config/config.js +13 -0
  26. package/dist/crypto.d.ts +43 -0
  27. package/dist/crypto.d.ts.map +1 -0
  28. package/dist/crypto.js +107 -0
  29. package/dist/enums.d.ts +81 -0
  30. package/dist/enums.d.ts.map +1 -0
  31. package/dist/enums.js +82 -0
  32. package/dist/errors.d.ts +14 -0
  33. package/dist/errors.d.ts.map +1 -0
  34. package/dist/errors.js +22 -0
  35. package/dist/high-level/index.d.ts +11 -0
  36. package/dist/high-level/index.d.ts.map +1 -0
  37. package/dist/high-level/index.js +53 -0
  38. package/dist/high-level/key-wrap.d.ts +16 -0
  39. package/dist/high-level/key-wrap.d.ts.map +1 -0
  40. package/dist/high-level/key-wrap.js +93 -0
  41. package/dist/high-level/multi-recipient.d.ts +25 -0
  42. package/dist/high-level/multi-recipient.d.ts.map +1 -0
  43. package/dist/high-level/multi-recipient.js +122 -0
  44. package/dist/high-level/password-encrypt.d.ts +14 -0
  45. package/dist/high-level/password-encrypt.d.ts.map +1 -0
  46. package/dist/high-level/password-encrypt.js +93 -0
  47. package/dist/high-level/sealedbox.d.ts +13 -0
  48. package/dist/high-level/sealedbox.d.ts.map +1 -0
  49. package/dist/high-level/sealedbox.js +119 -0
  50. package/dist/high-level/secretbox.d.ts +7 -0
  51. package/dist/high-level/secretbox.d.ts.map +1 -0
  52. package/dist/high-level/secretbox.js +54 -0
  53. package/dist/index.d.ts +16 -2
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +61 -2
  56. package/dist/key/key.d.ts +10 -0
  57. package/dist/key/key.d.ts.map +1 -0
  58. package/dist/key/key.js +25 -0
  59. package/dist/key/keystore.d.ts +11 -0
  60. package/dist/key/keystore.d.ts.map +1 -0
  61. package/dist/key/keystore.js +87 -0
  62. package/dist/keys/index.d.ts +7 -0
  63. package/dist/keys/index.d.ts.map +1 -0
  64. package/dist/keys/index.js +22 -0
  65. package/dist/keys/keygen.d.ts +16 -0
  66. package/dist/keys/keygen.d.ts.map +1 -0
  67. package/dist/keys/keygen.js +128 -0
  68. package/dist/keys/keyring.d.ts +35 -0
  69. package/dist/keys/keyring.d.ts.map +1 -0
  70. package/dist/keys/keyring.js +136 -0
  71. package/dist/keys/serialize.d.ts +30 -0
  72. package/dist/keys/serialize.d.ts.map +1 -0
  73. package/dist/keys/serialize.js +120 -0
  74. package/dist/lib/decrypt.d.ts +5 -5
  75. package/dist/lib/decrypt.d.ts.map +1 -1
  76. package/dist/lib/decrypt.js +49 -39
  77. package/dist/lib/encrypt.d.ts +2 -5
  78. package/dist/lib/encrypt.d.ts.map +1 -1
  79. package/dist/lib/encrypt.js +34 -39
  80. package/dist/lib/generate.d.ts +2 -11
  81. package/dist/lib/generate.d.ts.map +1 -1
  82. package/dist/lib/generate.js +57 -29
  83. package/dist/lib/index.d.ts +10 -0
  84. package/dist/lib/index.d.ts.map +1 -0
  85. package/dist/lib/index.js +53 -0
  86. package/dist/lib/key-output.d.ts +7 -0
  87. package/dist/lib/key-output.d.ts.map +1 -0
  88. package/dist/lib/key-output.js +50 -0
  89. package/dist/lib/reformat.d.ts +9 -0
  90. package/dist/lib/reformat.d.ts.map +1 -0
  91. package/dist/lib/reformat.js +67 -0
  92. package/dist/lib/revoke.d.ts +3 -3
  93. package/dist/lib/revoke.d.ts.map +1 -1
  94. package/dist/lib/revoke.js +36 -28
  95. package/dist/lib/session.d.ts +5 -0
  96. package/dist/lib/session.d.ts.map +1 -0
  97. package/dist/lib/session.js +55 -0
  98. package/dist/lib/sign.d.ts +4 -0
  99. package/dist/lib/sign.d.ts.map +1 -0
  100. package/dist/lib/sign.js +63 -0
  101. package/dist/lib/verify.d.ts +5 -0
  102. package/dist/lib/verify.d.ts.map +1 -0
  103. package/dist/lib/verify.js +52 -0
  104. package/dist/modern/aead.d.ts +17 -0
  105. package/dist/modern/aead.d.ts.map +1 -0
  106. package/dist/modern/aead.js +51 -0
  107. package/dist/modern/aes.d.ts +35 -0
  108. package/dist/modern/aes.d.ts.map +1 -0
  109. package/dist/modern/aes.js +82 -0
  110. package/dist/modern/cost-limits.d.ts +11 -0
  111. package/dist/modern/cost-limits.d.ts.map +1 -0
  112. package/dist/modern/cost-limits.js +35 -0
  113. package/dist/modern/curves.d.ts +86 -0
  114. package/dist/modern/curves.d.ts.map +1 -0
  115. package/dist/modern/curves.js +171 -0
  116. package/dist/modern/ecdh.d.ts +11 -0
  117. package/dist/modern/ecdh.d.ts.map +1 -0
  118. package/dist/modern/ecdh.js +28 -0
  119. package/dist/modern/fn-dsa.d.ts +19 -0
  120. package/dist/modern/fn-dsa.d.ts.map +1 -0
  121. package/dist/modern/fn-dsa.js +57 -0
  122. package/dist/modern/hash.d.ts +13 -0
  123. package/dist/modern/hash.d.ts.map +1 -0
  124. package/dist/modern/hash.js +45 -0
  125. package/dist/modern/hpke.d.ts +47 -0
  126. package/dist/modern/hpke.d.ts.map +1 -0
  127. package/dist/modern/hpke.js +207 -0
  128. package/dist/modern/index.d.ts +40 -0
  129. package/dist/modern/index.d.ts.map +1 -0
  130. package/dist/modern/index.js +194 -0
  131. package/dist/modern/kdf.d.ts +23 -0
  132. package/dist/modern/kdf.d.ts.map +1 -0
  133. package/dist/modern/kdf.js +67 -0
  134. package/dist/modern/mac.d.ts +51 -0
  135. package/dist/modern/mac.d.ts.map +1 -0
  136. package/dist/modern/mac.js +119 -0
  137. package/dist/modern/password.d.ts +40 -0
  138. package/dist/modern/password.d.ts.map +1 -0
  139. package/dist/modern/password.js +123 -0
  140. package/dist/modern/pq-hash-sign.d.ts +18 -0
  141. package/dist/modern/pq-hash-sign.d.ts.map +1 -0
  142. package/dist/modern/pq-hash-sign.js +73 -0
  143. package/dist/modern/pq-kem.d.ts +88 -0
  144. package/dist/modern/pq-kem.d.ts.map +1 -0
  145. package/dist/modern/pq-kem.js +270 -0
  146. package/dist/modern/pq-sign.d.ts +30 -0
  147. package/dist/modern/pq-sign.d.ts.map +1 -0
  148. package/dist/modern/pq-sign.js +94 -0
  149. package/dist/modern/pq.d.ts +38 -0
  150. package/dist/modern/pq.d.ts.map +1 -0
  151. package/dist/modern/pq.js +80 -0
  152. package/dist/modern/signing.d.ts +16 -0
  153. package/dist/modern/signing.d.ts.map +1 -0
  154. package/dist/modern/signing.js +34 -0
  155. package/dist/protocols/index.d.ts +7 -0
  156. package/dist/protocols/index.d.ts.map +1 -0
  157. package/dist/protocols/index.js +46 -0
  158. package/dist/protocols/iso20022.d.ts +51 -0
  159. package/dist/protocols/iso20022.d.ts.map +1 -0
  160. package/dist/protocols/iso20022.js +145 -0
  161. package/dist/protocols/opaque/ake.d.ts +51 -0
  162. package/dist/protocols/opaque/ake.d.ts.map +1 -0
  163. package/dist/protocols/opaque/ake.js +102 -0
  164. package/dist/protocols/opaque/client.d.ts +45 -0
  165. package/dist/protocols/opaque/client.d.ts.map +1 -0
  166. package/dist/protocols/opaque/client.js +63 -0
  167. package/dist/protocols/opaque/config.d.ts +14 -0
  168. package/dist/protocols/opaque/config.d.ts.map +1 -0
  169. package/dist/protocols/opaque/config.js +18 -0
  170. package/dist/protocols/opaque/credentials.d.ts +29 -0
  171. package/dist/protocols/opaque/credentials.d.ts.map +1 -0
  172. package/dist/protocols/opaque/credentials.js +61 -0
  173. package/dist/protocols/opaque/envelope.d.ts +36 -0
  174. package/dist/protocols/opaque/envelope.d.ts.map +1 -0
  175. package/dist/protocols/opaque/envelope.js +77 -0
  176. package/dist/protocols/opaque/ksf.d.ts +15 -0
  177. package/dist/protocols/opaque/ksf.d.ts.map +1 -0
  178. package/dist/protocols/opaque/ksf.js +27 -0
  179. package/dist/protocols/opaque/messages.d.ts +61 -0
  180. package/dist/protocols/opaque/messages.d.ts.map +1 -0
  181. package/dist/protocols/opaque/messages.js +94 -0
  182. package/dist/protocols/opaque/server.d.ts +33 -0
  183. package/dist/protocols/opaque/server.d.ts.map +1 -0
  184. package/dist/protocols/opaque/server.js +74 -0
  185. package/dist/protocols/opaque/suite.d.ts +58 -0
  186. package/dist/protocols/opaque/suite.d.ts.map +1 -0
  187. package/dist/protocols/opaque/suite.js +115 -0
  188. package/dist/protocols/pake.d.ts +14 -0
  189. package/dist/protocols/pake.d.ts.map +1 -0
  190. package/dist/protocols/pake.js +33 -0
  191. package/dist/protocols/pqxdh.d.ts +53 -0
  192. package/dist/protocols/pqxdh.d.ts.map +1 -0
  193. package/dist/protocols/pqxdh.js +143 -0
  194. package/dist/protocols/ratchet.d.ts +52 -0
  195. package/dist/protocols/ratchet.d.ts.map +1 -0
  196. package/dist/protocols/ratchet.js +187 -0
  197. package/dist/protocols/threshold.d.ts +23 -0
  198. package/dist/protocols/threshold.d.ts.map +1 -0
  199. package/dist/protocols/threshold.js +191 -0
  200. package/dist/registry.d.ts +20 -0
  201. package/dist/registry.d.ts.map +1 -0
  202. package/dist/registry.js +399 -0
  203. package/dist/streaming/index.d.ts +7 -0
  204. package/dist/streaming/index.d.ts.map +1 -0
  205. package/dist/streaming/index.js +15 -0
  206. package/dist/streaming/stream-aead.d.ts +17 -0
  207. package/dist/streaming/stream-aead.d.ts.map +1 -0
  208. package/dist/streaming/stream-aead.js +125 -0
  209. package/dist/streaming/stream-hash.d.ts +9 -0
  210. package/dist/streaming/stream-hash.d.ts.map +1 -0
  211. package/dist/streaming/stream-hash.js +52 -0
  212. package/dist/streaming/web-streams.d.ts +17 -0
  213. package/dist/streaming/web-streams.d.ts.map +1 -0
  214. package/dist/streaming/web-streams.js +114 -0
  215. package/dist/tokens/index.d.ts +5 -0
  216. package/dist/tokens/index.d.ts.map +1 -0
  217. package/dist/tokens/index.js +15 -0
  218. package/dist/tokens/key-rotation.d.ts +20 -0
  219. package/dist/tokens/key-rotation.d.ts.map +1 -0
  220. package/dist/tokens/key-rotation.js +76 -0
  221. package/dist/tokens/paseto.d.ts +46 -0
  222. package/dist/tokens/paseto.d.ts.map +1 -0
  223. package/dist/tokens/paseto.js +200 -0
  224. package/dist/types/types.d.ts +57 -0
  225. package/dist/types/types.d.ts.map +1 -1
  226. package/dist/types/types.js +1 -0
  227. package/dist/utils.d.ts +13 -0
  228. package/dist/utils.d.ts.map +1 -0
  229. package/dist/utils.js +56 -0
  230. package/package.json +77 -130
  231. package/dist/COPYRIGHT +0 -15
  232. package/dist/Report.txt +0 -72
  233. package/dist/bin/crypto-lib.d.ts +0 -13
  234. package/dist/bin/crypto-lib.d.ts.map +0 -1
  235. package/dist/bin/crypto-lib.js +0 -52
  236. package/dist/bin/crypto-lib.js.map +0 -1
  237. package/dist/index.js.map +0 -1
  238. package/dist/lib/decrypt.js.map +0 -1
  239. package/dist/lib/encrypt.js.map +0 -1
  240. package/dist/lib/generate.js.map +0 -1
  241. package/dist/lib/revoke.js.map +0 -1
  242. package/dist/package.json +0 -131
  243. package/dist/types/types.js.map +0 -1
package/README.md CHANGED
@@ -1,214 +1,363 @@
1
- # Crypto Lib
2
-
3
- ![Banner representing Crypto Lib](https://raw.githubusercontent.com/sebastienrousseau/crypto-service/master/assets/crypto-lib-logo.svg)
4
-
5
- [![Maintained with Lerna](https://img.shields.io/badge/maintained%20with-lerna-blue?style=for-the-badge)](https://lerna.js.org/)
6
- [![License](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge&logo=)](https://opensource.org/licenses/MIT)
7
- ![Made with Love](https://raw.githubusercontent.com/sebastienrousseau/crypto-service/master/assets/made-with-love.svg)
8
-
9
- ***
10
-
11
- ## Welcome to Crypto Lib
12
-
13
- Crypto Lib is a powerful intuitive cryptographic JavaScript library that
14
- encapsulates common algorithms, functions and provides an interface for
15
- low-level cryptographic operations.
16
-
17
- The cryptographic operations include:
18
-
19
- - Digital Signing,
20
- - Encryption and Decryption,
21
- - Key Generation,
22
- - Key Management,
23
- - Pseudorandom Number Generation,
24
- - Signature Verification.
25
-
26
- This library is based on [OpenPGP.js][1] - a JavaScript implementation of the
27
- OpenPGP protocol. It implements [RFC4880][2] and parts of [RFC4880bis][3].
28
-
29
- Development of this library is hosted by [GitHub][4] at the [following page][5].
30
- Source code is available to everyone under the standard [MIT license][6].
31
-
32
- ## Getting Started
33
-
34
- Crypto Lib is a [Node.js][7] module available through the
35
- [npm registry][8]. Before installing, [download and install Node.js][7].
36
- Node.js 12.20.0 or higher is required.
37
-
38
- Installation is done using either [`npm`][8], [`yarn`][9] or [`pnpm`][10]
39
- package managers to use Crypto Lib with Node.js or the Command Line Interface:
40
-
41
- - `npm i @sebastienrousseau/crypto-lib`
42
- - `yarn add @sebastienrousseau/crypto-lib`
43
- - `pnpm add @sebastienrousseau/crypto-lib`
44
-
45
- ## What's included
46
-
47
- Within the download you'll find all the crypto lib source files grouped into
48
- the *dist* folder.
49
-
50
- You'll see something like this:
51
-
52
- ```shell
53
- .
54
- ├── bin
55
- │   ├── crypto-lib.d.ts
56
- │   ├── crypto-lib.d.ts.map
57
- │   ├── crypto-lib.js
58
- │   └── crypto-lib.js.map
59
- ├── index.d.ts
60
- ├── index.d.ts.map
61
- ├── index.js
62
- ├── index.js.map
63
- └── lib
64
- ├── decrypt.d.ts
65
- ├── decrypt.d.ts.map
66
- ├── decrypt.js
67
- ├── decrypt.js.map
68
- ├── encrypt.d.ts
69
- ├── encrypt.d.ts.map
70
- ├── encrypt.js
71
- ├── encrypt.js.map
72
- ├── generate.d.ts
73
- ├── generate.d.ts.map
74
- ├── generate.js
75
- ├── generate.js.map
76
- ├── revoke-key.d.ts
77
- ├── revoke-key.d.ts.map
78
- ├── revoke-key.js
79
- └── revoke-key.js.map
80
-
81
- 2 directories, 24 files
1
+ <!-- SPDX-License-Identifier: Apache-2.0 OR MIT -->
82
2
 
3
+ <p align="center">
4
+ <img src="https://raw.githubusercontent.com/sebastienrousseau/crypto-service/main/assets/crypto-lib-logo.svg" alt="crypto-lib logo" width="360" />
5
+ </p>
6
+
7
+ <h1 align="center">@sebastienrousseau/crypto-lib</h1>
8
+
9
+ <p align="center">
10
+ A modern cryptographic library for TypeScript, with post-quantum support, zero unsafe dependencies, and 100% test coverage.
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://github.com/sebastienrousseau/crypto-service/actions"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/crypto-service/ci.yml?branch=main&style=for-the-badge&logo=github" alt="Build" /></a>
15
+ <a href="https://coveralls.io/github/sebastienrousseau/crypto-service?branch=main"><img src="https://img.shields.io/coveralls/github/sebastienrousseau/crypto-service?branch=main&style=for-the-badge" alt="Coverage" /></a>
16
+ <a href="https://www.npmjs.com/package/@sebastienrousseau/crypto-lib"><img src="https://img.shields.io/npm/v/@sebastienrousseau/crypto-lib.svg?style=for-the-badge&color=f14041&logo=npm" alt="Registry" /></a>
17
+ <a href="https://sebastienrousseau.github.io/crypto-service/"><img src="https://img.shields.io/badge/docs-TypeDoc-blue.svg?style=for-the-badge&labelColor=555555&logo=typescript" alt="Docs" /></a>
18
+ <a href="https://scorecard.dev/viewer/?uri=github.com/sebastienrousseau/crypto-service" title="ossf-scorecard"><img src="https://img.shields.io/badge/OpenSSF-Scorecard-blue?style=for-the-badge&logo=openssf" alt="OpenSSF Scorecard" /></a>
19
+ <a href="https://github.com/sebastienrousseau/crypto-service/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0%20OR%20MIT-blue.svg?style=for-the-badge" alt="License: Apache-2.0 OR MIT" /></a>
20
+ <a href="https://github.com/sebastienrousseau/crypto-service/blob/main/docs/POLICIES.md"><img src="https://img.shields.io/badge/Node.js-%3E%3D22-93450a.svg?style=for-the-badge&logo=node.js" alt="Node.js 22 or newer" /></a>
21
+ </p>
22
+
23
+ ---
24
+
25
+ ## Contents
26
+
27
+ **Getting started**
28
+
29
+ - [Install](#install) — installation via pnpm, npm, or yarn
30
+ - [Requirements](#requirements) — runtime floor and environment prerequisites
31
+ - [Quick Start](#quick-start) — minimal working usage sample
32
+
33
+ **The Crypto Service ecosystem**
34
+
35
+ - [The Crypto Service ecosystem](#the-crypto-service-ecosystem) — full 14-package suite overview
36
+
37
+ **Package reference**
38
+
39
+ - [Reference & Usage](#overview) — features, configuration, and capabilities
40
+ - [Examples](#examples) — runnable sample code
41
+
42
+ **Operational**
43
+
44
+ - [Development](#development) — build, lint, format, and test targets
45
+ - [Security](#security) — vulnerability disclosure and cryptographic invariants
46
+ - [Documentation](#documentation) — TypeDoc API docs and ecosystem guides
47
+ - [Stability guarantees](#stability-guarantees) — SemVer axis and release policy
48
+ - [License](#license)
49
+
50
+ ---
51
+
52
+ ## Install
53
+
54
+ ```bash
55
+ pnpm add @sebastienrousseau/crypto-lib
56
+ # or
57
+ npm install @sebastienrousseau/crypto-lib
58
+ # or
59
+ yarn add @sebastienrousseau/crypto-lib
83
60
  ```
84
61
 
62
+ <p align="right"><a href="#contents">Back to Top</a></p>
63
+
64
+ ---
65
+
66
+ ## Requirements
67
+
68
+ - **Node.js**: `^22.0.0` or `>=24.0.0` (active and maintenance LTS releases)
69
+ - **Package Manager**: `pnpm >=9` (recommended) or `npm >=10`
70
+ - **TypeScript**: `>=5.0` (when compiling with TypeScript)
71
+
72
+ <p align="right"><a href="#contents">Back to Top</a></p>
73
+
74
+ ---
75
+
85
76
  ## Quick Start
86
77
 
87
- ### Generating a new RSA key pair
78
+ ```ts
79
+ import { crypto } from "@sebastienrousseau/crypto-lib";
80
+
81
+ // Generate a random 256-bit key
82
+ const key = crypto.randomKey();
83
+
84
+ // Encrypt (XChaCha20-Poly1305 via secretbox)
85
+ const ciphertext = crypto.encrypt(key, "classified payload");
86
+
87
+ // Decrypt
88
+ const plaintext = crypto.decrypt(key, ciphertext);
89
+ console.log(Buffer.from(plaintext).toString("utf8"));
90
+ // => "classified payload"
91
+
92
+ // Hash
93
+ const digest = crypto.hash("sha3-256", "hello world");
94
+
95
+ // Sign and verify (Ed25519)
96
+ const kp = crypto.generateKeyPair("ed25519");
97
+ const sig = crypto.sign("ed25519", kp.privateKey, "message");
98
+ const ok = crypto.verify("ed25519", kp.publicKey, "message", sig);
99
+ ```
100
+
101
+ <p align="right"><a href="#contents">Back to Top</a></p>
102
+
103
+ ---
104
+
105
+ ## The Crypto Service ecosystem
106
+
107
+ Crypto Service provides a complete cryptography stack across 14 specialized packages:
108
+
109
+ | Package | Role | Description |
110
+ | :-------------------------------------------------------------------- | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------- |
111
+ | [`@sebastienrousseau/crypto-api`](../crypto-api) | API Schemas | Shared TypeScript types and utilities for the Crypto Service Suite, defining the canonical API surface. |
112
+ | [`@sebastienrousseau/crypto-cli`](../crypto-cli) | Terminal CLI | An interactive command-line interface for cryptographic operations, supporting both legacy OpenPGP and modern post-quantum algorithms. |
113
+ | [`@sebastienrousseau/crypto-edge`](../crypto-edge) | Edge Runtime | Edge-runtime cryptographic operations using the Web Crypto API, optimized for Cloudflare Workers, Vercel Edge, and Deno. |
114
+ | [`@sebastienrousseau/crypto-kms`](../crypto-kms) | Cloud KMS | Unified Key Management Service interface for AWS KMS, GCP Cloud KMS, Azure Key Vault, and HashiCorp Vault. |
115
+ | **[`@sebastienrousseau/crypto-lib`](../crypto-lib)** _(this package)_ | **Core Library** | **A modern cryptographic library for TypeScript, with post-quantum support, zero unsafe dependencies, and 100% test coverage.** |
116
+ | [`@sebastienrousseau/crypto-middleware`](../crypto-middleware) | Middleware | Framework-agnostic cryptographic middleware for Express, Fastify, and Koa applications. |
117
+ | [`@sebastienrousseau/crypto-prisma`](../crypto-prisma) | ORM Adapter | Transparent field-level encryption extension for Prisma Client, using XChaCha20-Poly1305. |
118
+ | [`@sebastienrousseau/crypto-react`](../crypto-react) | React Hooks | React hooks and context provider for client-side cryptographic operations with zero boilerplate. |
119
+ | [`@sebastienrousseau/crypto-sdk`](../crypto-sdk) | Client SDK | A zero-dependency, typed HTTP client for the Crypto Service REST API, with full post-quantum support. |
120
+ | [`@sebastienrousseau/crypto-server`](../crypto-server) | HTTP API | A hardened Fastify REST API for cryptographic operations, with rate limiting, OpenAPI schemas, and post-quantum endpoints. |
121
+ | [`@sebastienrousseau/crypto-testing`](../crypto-testing) | Test Support | Deterministic keys, fast mocks, and test fixtures for crypto-lib |
122
+ | [`@sebastienrousseau/crypto-typeorm`](../crypto-typeorm) | ORM Adapter | TypeORM column-level encryption with a single decorator, powered by crypto-lib. |
123
+ | [`@sebastienrousseau/crypto-vue`](../crypto-vue) | Vue Composables | Vue 3 composables for client-side cryptography |
124
+ | [`@sebastienrousseau/crypto-wasm`](../crypto-wasm) | Acceleration | WebAssembly performance accelerator for crypto-lib |
125
+
126
+ <p align="right"><a href="#contents">Back to Top</a></p>
127
+
128
+ ---
129
+
130
+ ## Overview
131
+
132
+ crypto-lib is the core cryptographic engine of the Crypto Service
133
+ Suite. It provides a unified TypeScript API over the
134
+ `@noble/hashes`, `@noble/curves`, `@noble/ciphers`, and
135
+ `@noble/post-quantum` libraries -- pure TypeScript, zero native
136
+ add-ons, no C bindings. The first three have had independent audits;
137
+ `@noble/post-quantum` has not. Post-quantum primitives (ML-KEM, ML-DSA,
138
+ SLH-DSA) are first-class citizens, not add-ons, and hybrid
139
+ constructions combine classical and PQ algorithms so security holds
140
+ even if one family breaks.
141
+
142
+ Two API layers serve different needs: a unified `crypto.*` namespace
143
+ for common tasks, and granular per-module imports for full control
144
+ and tree-shaking. Both layers use the same underlying noble
145
+ primitives; the unified API is a thin dispatcher that adds no
146
+ overhead.
147
+
148
+ <p align="right"><a href="#contents">Back to Top</a></p>
149
+
150
+ ## Features
151
+
152
+ | Module | Adds |
153
+ | :---------------------------- | :----------------------------------------------- |
154
+ | `modern/hash` | SHA-2, SHA-3, BLAKE2b, BLAKE3 |
155
+ | `modern/aead` | XChaCha20-Poly1305 encrypt/decrypt |
156
+ | `modern/aes` | AES-GCM, AES-GCM-SIV (128/256) |
157
+ | `modern/signing` | Ed25519 key generation, sign, verify |
158
+ | `modern/curves` | P-256, P-384, Ed448, X448, Schnorr (BIP-340) |
159
+ | `modern/mac` | HMAC (SHA-2, SHA-3), KMAC-128/256 |
160
+ | `modern/kdf` | scrypt, HKDF-SHA256, PBKDF2-SHA256 |
161
+ | `modern/password` | Argon2id/i/d hash, verify, PHC format |
162
+ | `modern/pq-kem` | ML-KEM-512/768/1024, hybrid KEMs |
163
+ | `modern/pq-sign` | ML-DSA-44/65/87, hybrid signatures |
164
+ | `modern/pq-hash-sign` | SLH-DSA (FIPS 205) |
165
+ | `high-level/secretbox` | Symmetric seal/open |
166
+ | `high-level/sealedbox` | Anonymous public-key encryption |
167
+ | `high-level/password-encrypt` | Password-based encryption |
168
+ | `high-level/key-wrap` | AES-KW, AES-KWP, X25519-AES-KW |
169
+ | `high-level/multi-recipient` | Multi-recipient encryption |
170
+ | `keys/keygen` | Unified key generation (12 algorithms) |
171
+ | `keys/serialize` | Hex, Base64, PEM, JWK, thumbprints |
172
+ | `keys/keyring` | In-memory keyring with rotation and JWKS |
173
+ | `streaming/stream-hash` | Incremental hashing for large inputs |
174
+ | `streaming/stream-aead` | Streaming AEAD encryption |
175
+ | `protocols/pqxdh` | Post-Quantum Extended Triple DH |
176
+ | `protocols/ratchet` | Double Ratchet (Signal-style) |
177
+ | `protocols/pake` | OPAQUE-3DH PAKE (RFC 9807) |
178
+ | `protocols/threshold` | Shamir SSS + Feldman VSS |
179
+ | `registry` | Algorithm metadata, deprecation, recommendations |
180
+ | `crypto` | Unified API namespace |
181
+ | `utils` | `timingSafeEqual`, `SecureBuffer` |
182
+
183
+ <p align="right"><a href="#contents">Back to Top</a></p>
184
+
185
+ ## Library Usage
186
+
187
+ <details>
188
+ <summary><b>Hashing</b></summary>
189
+
190
+ ```ts
191
+ import { hash } from "@sebastienrousseau/crypto-lib";
192
+
193
+ const r = hash({ algorithm: "sha3-256", data: "hello" });
194
+ console.log(r.digest); // hex string
195
+ ```
196
+
197
+ </details>
198
+
199
+ <details>
200
+ <summary><b>Signing</b></summary>
201
+
202
+ ```ts
203
+ import { crypto } from "@sebastienrousseau/crypto-lib";
204
+
205
+ const kp = crypto.generateKeyPair("ed25519");
206
+ const sig = crypto.sign("ed25519", kp.privateKey, "payload");
207
+ const ok = crypto.verify("ed25519", kp.publicKey, "payload", sig);
208
+ ```
88
209
 
89
- [RSA][11] is a public-key algorithm for encrypting and signing messages. To
90
- generate a Rivest-Shamir-Adelman (RSA) public key pair:
210
+ </details>
91
211
 
92
- - Open Terminal for Mac or Command Prompt for Windows,
212
+ <details>
213
+ <summary><b>Symmetric Encryption</b></summary>
93
214
 
94
- - Enter the following example command that will start the generation process in
95
- the `dist/` directory.
215
+ ```ts
216
+ import { aeadEncrypt, aeadDecrypt } from "@sebastienrousseau/crypto-lib";
96
217
 
97
- ```js
98
- yarn start \
99
- --name "Jane Doe" \
100
- --email "jane@doe.com" \
101
- --passphrase "123456789abcdef" \
102
- --type "rsa" \
103
- --curve "" \
104
- --bits 2048 \
105
- --expiration 0 \
106
- --format armored \
107
- --sign true
218
+ const key = "a".repeat(64); // 32-byte hex key
219
+ const { ciphertext } = aeadEncrypt({ key, plaintext: "secret" });
220
+ const plain = aeadDecrypt({ key, ciphertext });
108
221
  ```
109
222
 
110
- This starts generating a 2048-bit RSA key pair, encrypts them with the password
111
- provided and writes them to a file in the [key](src/key/) directory with a pgp
112
- extension.
113
-
114
- ***
115
-
116
- ### Generating a new Elliptic-curve cryptography (ECC) key pair
117
-
118
- [Elliptic-curve cryptography (ECC)][12] is an alternative technique to RSA. It
119
- generates security between key pairs for public key encryption by using the
120
- mathematics of elliptic curves. Elliptic curve cryptography provides stronger
121
- security per bits of key, which allows for much faster operations.
122
-
123
- Currently the following curves are supported:
124
-
125
- | Curve | Encryption | Signature | NodeCrypto | WebCrypto |
126
- |:---------------:|:----------:|:---------:|:----------:|:---------:|
127
- | curve25519 | ECDH | N/A | No | No |
128
- | ed25519 | N/A | EdDSA | No | No |
129
- | p256 | ECDH | ECDSA | Yes | Yes |
130
- | p384 | ECDH | ECDSA | Yes | Yes |
131
- | p521 | ECDH | ECDSA | Yes | Yes |
132
- | brainpoolP256r1 | ECDH | ECDSA | Yes | No |
133
- | brainpoolP384r1 | ECDH | ECDSA | Yes | No |
134
- | brainpoolP512r1 | ECDH | ECDSA | Yes | No |
135
- | secp256k1 | ECDH | ECDSA | Yes | No |
136
-
137
- To generate an Elliptic Curve Cryptography (ECC) key pair:
138
-
139
- - Open Terminal for Mac or Command Prompt for Windows,
140
- - Enter the following example command that will start the generation process in
141
- the `dist/` directory.
142
-
143
- ```js
144
- yarn start \
145
- --name "Jane Doe" \
146
- --email "jane@doe.com" \
147
- --passphrase "123456789abcdef" \
148
- --type "ecc" \
149
- --curve curve25519 \
150
- --bits null \
151
- --expiration 0 \
152
- --format armored \
153
- --sign true
223
+ </details>
224
+
225
+ <details>
226
+ <summary><b>Post-Quantum KEM</b></summary>
227
+
228
+ ```ts
229
+ import {
230
+ mlKemKeygen,
231
+ mlKemEncapsulate,
232
+ mlKemDecapsulate,
233
+ } from "@sebastienrousseau/crypto-lib";
234
+
235
+ const kp = mlKemKeygen(768);
236
+ const { ciphertext, sharedSecret: ss1 } = mlKemEncapsulate(768, kp.publicKey);
237
+ const { sharedSecret: ss2 } = mlKemDecapsulate(768, kp.secretKey, ciphertext);
238
+ // ss1 === ss2
154
239
  ```
155
240
 
156
- This starts generating an Elliptic Curve Cryptography (ECC) key pair, encrypts
157
- them with the password provided and writes them to a file in the [key](src/key/)
158
- directory with a pgp extension.
241
+ </details>
159
242
 
160
- ***
243
+ <details>
244
+ <summary><b>Password Hashing</b></summary>
161
245
 
162
- ### Encrypting and Signing Data
246
+ ```ts
247
+ import { hashPassword, verifyPasswordPhc } from "@sebastienrousseau/crypto-lib";
163
248
 
164
- Encryption is the transformation of data into a form in which it cannot be made
165
- sense of without the use of some key. Such transformed data is referred to as
166
- `ciphertext`.
249
+ const result = hashPassword({ password: "hunter2" });
250
+ console.log(result.phc); // $argon2id$v=19$m=65536,t=3,p=4$...
251
+ const { valid } = verifyPasswordPhc({ password: "hunter2", phc: result.phc });
252
+ ```
167
253
 
168
- Crypto Lib makes it easy and painless to encrypt and sign data.
254
+ </details>
169
255
 
170
- To encrypt a message:
256
+ <details>
257
+ <summary><b>Keyring</b></summary>
171
258
 
172
- - Open Terminal for Mac or Command Prompt for Windows,
173
- - Run the yarn start
174
- - Enter the following example command that will start the encryption process in
175
- the `dist/` directory.
259
+ ```ts
260
+ import { Keyring } from "@sebastienrousseau/crypto-lib";
176
261
 
177
- ```js
178
- node dist/lib/encrypt.js \
179
- --passphrase '123456789abcdef' \
180
- --message 'Hello Crypto Service APIs!'
262
+ const ring = new Keyring();
263
+ const key = ring.add("ed25519", { use: "sig" });
264
+ const rotated = ring.rotate(key.kid);
265
+ const jwks = ring.toJwks();
181
266
  ```
182
267
 
183
- ***
268
+ </details>
184
269
 
185
- ### Decrypting and Verifying Signatures
270
+ <p align="right"><a href="#contents">Back to Top</a></p>
186
271
 
187
- Decryption restores encrypted data to to its original (cleartext or plaintext)
188
- form. Decrypting data and verifying signatures is being done similarly in Crypto
189
- Lib.
272
+ ## Examples
190
273
 
191
- To decrypt a message:
274
+ All examples are self-contained TypeScript files in the `examples/`
275
+ directory. Run any example with:
192
276
 
193
- - Open Terminal for Mac or Command Prompt for Windows,
194
- - Enter the following example command that will start the decryption process in
195
- the `dist/` directory.
277
+ ```bash
278
+ npx ts-node examples/<name>.ts
279
+ ```
196
280
 
197
- ```js
198
- node dist/lib/decrypt.js \
199
- --passphrase '123456789abcdef' \
200
- --message 'LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgp3Y0ZNQXpMNWFTdVU0RWM4QVEvL1RlZzN6bzFiMSszNW9lN3l6NDFpRS9LVlNZYUJYSEFESTNpbVJodlQKeXlRczdFc29iYTdoUUx4dFZESjEyc3ZNU25YUWk2Y1FVNXd4cGo1L3VENUFOT2ZuN0hVSkYrSExINlRNCjNBWktZNUFLRk40VUZBK0hQRy9GSHlaNVhxVzRLd0hpL3ZjVWxSejRreWJDc2VxYmZoY01hU0NJdHRKbwpmWkNOcTFZNEhiR1hBV1BQWXExV0tRZnl0RnRyWWlQODU3VE5hc21XNTJKUjVMQUZ5OFdzdnZNTmM3Z3AKQ0RFcUIyVWQwRmJSNEZOU2tvTXFhN3FScXFqS1V2ei9odU9ieVVsOW94RVpGVGNac1hwSVQ1QkE5WUtECmpvY1pVSE1hTjZkbnFJTk8rcWVBZWM4R1FjbEUxVVk0RWhNcEhjUktkZEJaY2pjaE0xbW9oaEMxb0Q4aQpUTVBlRU5XcDg0SGh3cVp1UjRNNmxUQjBqSUhZbytuMXpMbm0vRUFtcDdoc3VvSEFYY3pqSFhVYVE3M2IKOEZ5UWlENW1IMU1wWHRoWjVheXNRTklmRkY5TUdOQ1paWXExNitHSFQvbmJCTDNyUmU2dENCUUFRTnVaCksydnNQeThGZlJyYmVBR0llZHllOFZIUGJFYXNsNWF4TVBwc08yaUtjV3dNN1QvZjVaeG5FRUxWem5UeApHQnA5MHFKMUFUNGtVWVNOejYvZC9aT2JUVVV3WWdkKzdUNDdxQ3VTMjYxVlJpL0Jiblh1Z2pLRk90VlEKMEhpU1VKbTlCbGhFR2s3OWg3RGJuZmx0ZFc4dFRCNE9CdXJxUHRVaHRLS2hHL3JhYUY3YlFrVVowUktNCmQ0SllOM0sySmhBL2ovaHIySEE4ZUpWZ0NNVm9McXJyZW8xazNHbGxIWkxTd2RBQmJtaXpZL1JZd2JDUQpUeG91TW5KNjhvZmVtSHNrSW1MdGx2OUtBOElQVEY4UXp3enZRcmpNRGRtclg2V09QTGtKQ3JiV1JKbHcKV25NWlBkVGpzSzdicnVNOTByZXhLeFowSGZVL050V3BvZ251L3dOYVBHZ1NRbEZhdHZhclJFQlNEaExaCndNYVE2ZWkycUJLbXdDTGVERURlaU1BSWlSQVBad1d2R1Y2RlFWNW14V2xGdm9SaGRDeTc2TW5kWXNNTQoza1Nwb1doMVBYUWpWYWZLV2lhZHJJS2FOSllDZkY2bzE5Ty9NdlZITGFFV0tnM0lzRGtvMGdtQWZ5VE8KTngzb2dYdTV0VFpvelRyUzRUMUpsMUR3bnRZbGlrMWhINkNYK0ZGLzIzVzlHaHdTdlcreVgzZFlTeHZjCjFuMlBjVDY5QzdDTmZtcWpOT293d20wcjl6M0lWYlZ2dGk4ZFduVzNEZDVGS256d2VaUDhaZ2hudUl4SQptUzdrY0ZWTVd4d3p6SmptQjg3UGZPbmZtZ2k2b0NxbFRzMXJDRldTQVZqM3hzenFFRGRnT1B1QXcvdzQKWmZOSS9sSVhHdU1DakpKQlYzNTZCN2ExNkZacXVqK2ZtOUQwS1BYbGpjSEcydHFRTjVDbHVTUnhUZlBiCm42U3ZOZ2tkVTNGM3pYS3NxRW9iRzdzakg5WjZWZlJIZjlRcmN2ZXZHdWFIb2ZZQkROVzZmT3ZNODBURQpHNjkzS3BRdytEaDVnMzBzamhXbDRuMS9aZUROR0RYZ0dERGRUMU9WQXRrVTBTcm1vY0ZSM1hCUHprYnQKRmw3YlVkVG1oVFlHVys2VmRIUG9mOFZ0b1FrWVJma2YxK1hFaC9kNUFvTzdSSVZRQ29qb3pqTmhoVy9qCjg4VW56d0VqZ3VoK0VMbVFRS1ViUi9ydjg2djcyM0VtVkVSd3hvQTIvalZCbGVaaHpFOHdrY01HODM3VApLVlo3N0VHblRPcTBjbUkrang2Ri9SenRjbDRBUHN6eEJkUkVSM25HR3dqbGVIdjdpMndhQTYzbWNJLzcKM0I0dWZyVGczbHNMWDVlWVFDUnJrdXdwOVZKNzNlWmJiOTlLOU51ZDhNVGczNnE0cFhtNWRBd3ZLZzEwCm96c0t2MHVxa0tDclF1TFBWU1JtZkE9PQo9Yll1VQotLS0tLUVORCBQR1AgTUVTU0FHRS0tLS0tCg=='
281
+ | Category | Example | Purpose |
282
+ | :------------- | :------------------------------------ | :---------------------------------------- |
283
+ | Hashing | [hash.ts](examples/hash.ts) | SHA-256, SHA-3, BLAKE3 |
284
+ | Encryption | [encrypt.ts](examples/encrypt.ts) | XChaCha20-Poly1305 encrypt/decrypt |
285
+ | Signing | [sign.ts](examples/sign.ts) | Ed25519 sign and verify |
286
+ | Key Generation | [keygen.ts](examples/keygen.ts) | Generate key pairs for various algorithms |
287
+ | Passwords | [password.ts](examples/password.ts) | Argon2id hash and verify |
288
+ | Secretbox | [secretbox.ts](examples/secretbox.ts) | Symmetric authenticated encryption |
289
+ | Sealed Box | [sealedbox.ts](examples/sealedbox.ts) | Anonymous public-key encryption |
290
+ | Keyring | [keyring.ts](examples/keyring.ts) | Create, rotate, and export keys |
291
+ | Threshold | [threshold.ts](examples/threshold.ts) | Shamir secret sharing split/combine |
292
+ | PQ KEM | [pqkem.ts](examples/pqkem.ts) | ML-KEM-768 key encapsulation |
293
+ | PQ Sign | [pqsign.ts](examples/pqsign.ts) | ML-DSA-65 sign and verify |
294
+ | HMAC | [hmac.ts](examples/hmac.ts) | HMAC-SHA256 compute and verify |
295
+ | KDF | [kdf.ts](examples/kdf.ts) | Key derivation with scrypt and HKDF |
296
+ | Streaming | [stream.ts](examples/stream.ts) | Incremental hashing with createHasher |
297
+ | Curves | [curves.ts](examples/curves.ts) | P-256, P-384, Ed448, Schnorr |
298
+ | Serialization | [serialize.ts](examples/serialize.ts) | PEM encode/decode, JWK conversion |
299
+ | Hybrid KEM | [hybrid.ts](examples/hybrid.ts) | Hybrid post-quantum key exchange |
300
+ | Registry | [registry.ts](examples/registry.ts) | Query algorithm registry |
301
+ | Unified API | [unified.ts](examples/unified.ts) | Unified crypto API overview |
302
+ | Ratchet | [ratchet.ts](examples/ratchet.ts) | Double Ratchet protocol demo |
303
+
304
+ <p align="right"><a href="#contents">Back to Top</a></p>
305
+
306
+ <p align="right"><a href="#contents">Back to Top</a></p>
307
+
308
+ ---
309
+
310
+ ## Development
311
+
312
+ ```bash
313
+ pnpm --filter @sebastienrousseau/crypto-lib run build
314
+ pnpm --filter @sebastienrousseau/crypto-lib run test
315
+ pnpm --filter @sebastienrousseau/crypto-lib run lint
316
+ pnpm --filter @sebastienrousseau/crypto-lib run format
201
317
  ```
202
318
 
203
- [1]: https://openpgpjs.org/
204
- [2]: https://tools.ietf.org/html/rfc4880
205
- [3]: https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-10
206
- [4]: https://github.com
207
- [5]: https://github.com/sebastienrousseau/crypto-service
208
- [6]: https://github.com/sebastienrousseau/crypto-service/blob/main/LICENSE
209
- [7]: https://nodejs.org/en/
210
- [8]: https://www.npmjs.com/
211
- [9]: https://yarnpkg.com/getting-started
212
- [10]: https://pnpm.io/motivation
213
- [11]: https://en.wikipedia.org/wiki/RSA_(cryptosystem)
214
- [12]: https://en.wikipedia.org/wiki/Elliptic-curve_cryptography
319
+ All 18 packages in the Crypto Service workspace maintain a **100% coverage floor** across statements, branches, functions, and lines.
320
+
321
+ <p align="right"><a href="#contents">Back to Top</a></p>
322
+
323
+ ---
324
+
325
+ ## Security
326
+
327
+ Report vulnerabilities privately via [GitHub Security Advisories](https://github.com/sebastienrousseau/crypto-service/security/advisories) or according to [`SECURITY.md`](../../SECURITY.md). Never report security issues publicly.
328
+
329
+ Cryptographic operations use the `@noble/*` libraries, Node.js `crypto` and OpenPGP.js. `@noble/post-quantum` has not been independently audited and does not guarantee constant-time execution, and no module in this suite is FIPS 140-3 validated. Key zeroization is limited: JavaScript strings and garbage-collected buffers cannot be reliably wiped. See [`SECURITY.md`](../../SECURITY.md).
330
+
331
+ <p align="right"><a href="#contents">Back to Top</a></p>
332
+
333
+ ---
334
+
335
+ ## Documentation
336
+
337
+ - [Full Suite Documentation](https://sebastienrousseau.github.io/crypto-service/)
338
+ - [API Reference (TypeDoc)](https://sebastienrousseau.github.io/crypto-service/)
339
+ - [Developer Guide](../../DEVELOPMENT.md)
340
+ - [Security Policy](../../SECURITY.md)
341
+ - [Architecture & Design](../../ARCHITECTURE.md)
342
+
343
+ <p align="right"><a href="#contents">Back to Top</a></p>
344
+
345
+ ---
346
+
347
+ ## Stability guarantees
348
+
349
+ Versions advance strictly one step at a time on the `0.0.x` line (`v0.0.1` → `v0.0.2` → `v0.0.3` ... → `v0.0.999` → `v0.1.0`). Work for every release iteration begins on a dedicated `feat/v<version>` branch.
350
+
351
+ All 18 packages in the workspace move in lockstep. Public API signatures, cipher output formats, and serialization schemas are strictly versioned. Breaking changes to serialized formats or algorithm defaults are considered major breaking changes. Minimum toolchain upgrades (e.g. Node.js LTS floor) are governed by [POLICIES.md](../../docs/POLICIES.md).
352
+
353
+ <p align="right"><a href="#contents">Back to Top</a></p>
354
+
355
+ ---
356
+
357
+ ## License
358
+
359
+ Dual-licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) or [MIT](https://opensource.org/licenses/MIT), at your option.
360
+
361
+ Copyright (c) 2022-2026 Sebastien Rousseau and The Crypto Service Suite contributors.
362
+
363
+ <p align="right"><a href="#contents">Back to Top</a></p>
@@ -0,0 +1,11 @@
1
+ export { isWebCryptoAvailable, webCryptoAesGcmEncrypt, webCryptoAesGcmDecrypt, webCryptoHash, } from "./webcrypto-bridge";
2
+ export type { WebCryptoHashAlgorithm, WebCryptoAesGcmEncryptOptions, WebCryptoAesGcmEncryptResult, WebCryptoAesGcmDecryptOptions, WebCryptoAesGcmDecryptResult, WebCryptoHashOptions, WebCryptoHashResult, } from "./webcrypto-bridge";
3
+ export { WorkerPool } from "./worker-pool";
4
+ export type { WorkerPoolOptions, WorkerTask } from "./worker-pool";
5
+ export { detectWasmBackend, wasmHash, wasmAeadEncrypt, wasmAeadDecrypt, _resetWasmDetection, } from "./wasm-bridge";
6
+ export type { WasmBackend, WasmHashAlgorithm, WasmHashOptions, WasmHashResult, WasmAeadEncryptOptions, WasmAeadEncryptResult, WasmAeadDecryptResult, } from "./wasm-bridge";
7
+ export { hasNativePqc, resetNativePqcCache, _forceNativePqcDetected, pqcBackend, bridgedMlKemKeygen, bridgedMlKemEncapsulate, bridgedMlKemDecapsulate, } from "./native-pqc-bridge";
8
+ export type { PqcBackend, NativeMlKemLevel, BridgedMlKemKeygenResult, BridgedMlKemEncapsulateResult, } from "./native-pqc-bridge";
9
+ export { detectModernWebCrypto, _resetModernWebCryptoDetection, modernChaCha20Encrypt, modernChaCha20Decrypt, modernSha3Hash, } from "./webcrypto-modern";
10
+ export type { WebCryptoModernSupport, ModernSha3Algorithm, ModernChaCha20EncryptOptions, ModernAeadResult, ModernChaCha20DecryptOptions, ModernChaCha20DecryptResult, ModernSha3HashOptions, ModernSha3HashResult, } from "./webcrypto-modern";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/accel/index.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,sBAAsB,EACtB,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,4BAA4B,EAC5B,gBAAgB,EAChB,4BAA4B,EAC5B,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modernSha3Hash = exports.modernChaCha20Decrypt = exports.modernChaCha20Encrypt = exports._resetModernWebCryptoDetection = exports.detectModernWebCrypto = exports.bridgedMlKemDecapsulate = exports.bridgedMlKemEncapsulate = exports.bridgedMlKemKeygen = exports.pqcBackend = exports._forceNativePqcDetected = exports.resetNativePqcCache = exports.hasNativePqc = exports._resetWasmDetection = exports.wasmAeadDecrypt = exports.wasmAeadEncrypt = exports.wasmHash = exports.detectWasmBackend = exports.WorkerPool = exports.webCryptoHash = exports.webCryptoAesGcmDecrypt = exports.webCryptoAesGcmEncrypt = exports.isWebCryptoAvailable = void 0;
4
+ var webcrypto_bridge_1 = require("./webcrypto-bridge");
5
+ Object.defineProperty(exports, "isWebCryptoAvailable", { enumerable: true, get: function () { return webcrypto_bridge_1.isWebCryptoAvailable; } });
6
+ Object.defineProperty(exports, "webCryptoAesGcmEncrypt", { enumerable: true, get: function () { return webcrypto_bridge_1.webCryptoAesGcmEncrypt; } });
7
+ Object.defineProperty(exports, "webCryptoAesGcmDecrypt", { enumerable: true, get: function () { return webcrypto_bridge_1.webCryptoAesGcmDecrypt; } });
8
+ Object.defineProperty(exports, "webCryptoHash", { enumerable: true, get: function () { return webcrypto_bridge_1.webCryptoHash; } });
9
+ var worker_pool_1 = require("./worker-pool");
10
+ Object.defineProperty(exports, "WorkerPool", { enumerable: true, get: function () { return worker_pool_1.WorkerPool; } });
11
+ var wasm_bridge_1 = require("./wasm-bridge");
12
+ Object.defineProperty(exports, "detectWasmBackend", { enumerable: true, get: function () { return wasm_bridge_1.detectWasmBackend; } });
13
+ Object.defineProperty(exports, "wasmHash", { enumerable: true, get: function () { return wasm_bridge_1.wasmHash; } });
14
+ Object.defineProperty(exports, "wasmAeadEncrypt", { enumerable: true, get: function () { return wasm_bridge_1.wasmAeadEncrypt; } });
15
+ Object.defineProperty(exports, "wasmAeadDecrypt", { enumerable: true, get: function () { return wasm_bridge_1.wasmAeadDecrypt; } });
16
+ Object.defineProperty(exports, "_resetWasmDetection", { enumerable: true, get: function () { return wasm_bridge_1._resetWasmDetection; } });
17
+ var native_pqc_bridge_1 = require("./native-pqc-bridge");
18
+ Object.defineProperty(exports, "hasNativePqc", { enumerable: true, get: function () { return native_pqc_bridge_1.hasNativePqc; } });
19
+ Object.defineProperty(exports, "resetNativePqcCache", { enumerable: true, get: function () { return native_pqc_bridge_1.resetNativePqcCache; } });
20
+ Object.defineProperty(exports, "_forceNativePqcDetected", { enumerable: true, get: function () { return native_pqc_bridge_1._forceNativePqcDetected; } });
21
+ Object.defineProperty(exports, "pqcBackend", { enumerable: true, get: function () { return native_pqc_bridge_1.pqcBackend; } });
22
+ Object.defineProperty(exports, "bridgedMlKemKeygen", { enumerable: true, get: function () { return native_pqc_bridge_1.bridgedMlKemKeygen; } });
23
+ Object.defineProperty(exports, "bridgedMlKemEncapsulate", { enumerable: true, get: function () { return native_pqc_bridge_1.bridgedMlKemEncapsulate; } });
24
+ Object.defineProperty(exports, "bridgedMlKemDecapsulate", { enumerable: true, get: function () { return native_pqc_bridge_1.bridgedMlKemDecapsulate; } });
25
+ var webcrypto_modern_1 = require("./webcrypto-modern");
26
+ Object.defineProperty(exports, "detectModernWebCrypto", { enumerable: true, get: function () { return webcrypto_modern_1.detectModernWebCrypto; } });
27
+ Object.defineProperty(exports, "_resetModernWebCryptoDetection", { enumerable: true, get: function () { return webcrypto_modern_1._resetModernWebCryptoDetection; } });
28
+ Object.defineProperty(exports, "modernChaCha20Encrypt", { enumerable: true, get: function () { return webcrypto_modern_1.modernChaCha20Encrypt; } });
29
+ Object.defineProperty(exports, "modernChaCha20Decrypt", { enumerable: true, get: function () { return webcrypto_modern_1.modernChaCha20Decrypt; } });
30
+ Object.defineProperty(exports, "modernSha3Hash", { enumerable: true, get: function () { return webcrypto_modern_1.modernSha3Hash; } });
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,18 @@
1
+ export declare function hasNativePqc(): boolean;
2
+ export declare function resetNativePqcCache(): void;
3
+ export declare function _forceNativePqcDetected(value: boolean): void;
4
+ export type PqcBackend = "native" | "noble";
5
+ export declare function pqcBackend(): PqcBackend;
6
+ export type NativeMlKemLevel = 512 | 768 | 1024;
7
+ export interface BridgedMlKemKeygenResult {
8
+ publicKey: Uint8Array;
9
+ secretKey: Uint8Array;
10
+ }
11
+ export interface BridgedMlKemEncapsulateResult {
12
+ cipherText: Uint8Array;
13
+ sharedSecret: Uint8Array;
14
+ }
15
+ export declare function bridgedMlKemKeygen(level: NativeMlKemLevel): BridgedMlKemKeygenResult;
16
+ export declare function bridgedMlKemEncapsulate(level: NativeMlKemLevel, publicKey: Uint8Array): BridgedMlKemEncapsulateResult;
17
+ export declare function bridgedMlKemDecapsulate(level: NativeMlKemLevel, cipherText: Uint8Array, secretKey: Uint8Array): Uint8Array;
18
+ //# sourceMappingURL=native-pqc-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-pqc-bridge.d.ts","sourceRoot":"","sources":["../../src/accel/native-pqc-bridge.ts"],"names":[],"mappings":"AA+CA,wBAAgB,YAAY,IAAI,OAAO,CActC;AAUD,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAUD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE5D;AAGD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAU5C,wBAAgB,UAAU,IAAI,UAAU,CAEvC;AAKD,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;AAGhD,MAAM,WAAW,wBAAwB;IAEvC,SAAS,EAAE,UAAU,CAAC;IAEtB,SAAS,EAAE,UAAU,CAAC;CACvB;AAGD,MAAM,WAAW,6BAA6B;IAE5C,UAAU,EAAE,UAAU,CAAC;IAEvB,YAAY,EAAE,UAAU,CAAC;CAC1B;AA0CD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,gBAAgB,GACtB,wBAAwB,CAI1B;AAmBD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,UAAU,GACpB,6BAA6B,CAI/B;AAoBD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,gBAAgB,EACvB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,UAAU,GACpB,UAAU,CAIZ"}