@sebastienrousseau/crypto-lib 0.0.35 → 0.0.36

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 (174) hide show
  1. package/README.md +17 -2
  2. package/dist/accel/index.d.ts +5 -4
  3. package/dist/accel/index.d.ts.map +1 -1
  4. package/dist/accel/index.js +5 -5
  5. package/dist/accel/kdf-backend.d.ts +13 -0
  6. package/dist/accel/kdf-backend.d.ts.map +1 -0
  7. package/dist/accel/kdf-backend.js +81 -0
  8. package/dist/accel/native-pqc-bridge.d.ts.map +1 -1
  9. package/dist/accel/native-pqc-bridge.js +12 -52
  10. package/dist/accel/pq-backend.d.ts +3652 -0
  11. package/dist/accel/pq-backend.d.ts.map +1 -0
  12. package/dist/accel/pq-backend.js +215 -0
  13. package/dist/accel/runtime.d.ts +3 -0
  14. package/dist/accel/runtime.d.ts.map +1 -0
  15. package/dist/accel/runtime.js +9 -0
  16. package/dist/accel/wasm-bridge.d.ts.map +1 -1
  17. package/dist/accel/wasm-bridge.js +14 -13
  18. package/dist/accel/webcrypto-bridge.d.ts.map +1 -1
  19. package/dist/accel/webcrypto-bridge.js +14 -13
  20. package/dist/accel/webcrypto-modern.d.ts.map +1 -1
  21. package/dist/accel/webcrypto-modern.js +15 -14
  22. package/dist/accel/worker-pool.d.ts +18 -0
  23. package/dist/accel/worker-pool.d.ts.map +1 -1
  24. package/dist/accel/worker-pool.js +113 -37
  25. package/dist/bin/cryptolib.d.ts +7 -4
  26. package/dist/bin/cryptolib.d.ts.map +1 -1
  27. package/dist/bin/cryptolib.js +6 -6
  28. package/dist/crypto.d.ts.map +1 -1
  29. package/dist/crypto.js +2 -1
  30. package/dist/encoding.d.ts +10 -0
  31. package/dist/encoding.d.ts.map +1 -0
  32. package/dist/encoding.js +84 -0
  33. package/dist/errors.d.ts +11 -0
  34. package/dist/errors.d.ts.map +1 -1
  35. package/dist/errors.js +20 -1
  36. package/dist/high-level/key-wrap.d.ts.map +1 -1
  37. package/dist/high-level/key-wrap.js +12 -17
  38. package/dist/high-level/multi-recipient.d.ts.map +1 -1
  39. package/dist/high-level/multi-recipient.js +15 -28
  40. package/dist/high-level/password-encrypt.d.ts.map +1 -1
  41. package/dist/high-level/password-encrypt.js +11 -11
  42. package/dist/high-level/sealedbox.d.ts.map +1 -1
  43. package/dist/high-level/sealedbox.js +16 -28
  44. package/dist/high-level/secretbox.d.ts.map +1 -1
  45. package/dist/high-level/secretbox.js +11 -10
  46. package/dist/index.d.ts +1 -1
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +3 -1
  49. package/dist/key/keystore.d.ts.map +1 -1
  50. package/dist/key/keystore.js +2 -1
  51. package/dist/keys/keygen.d.ts.map +1 -1
  52. package/dist/keys/keygen.js +13 -14
  53. package/dist/keys/keyring.d.ts.map +1 -1
  54. package/dist/keys/keyring.js +4 -2
  55. package/dist/keys/serialize.d.ts.map +1 -1
  56. package/dist/keys/serialize.js +18 -16
  57. package/dist/lib/decrypt.d.ts.map +1 -1
  58. package/dist/lib/decrypt.js +2 -1
  59. package/dist/lib/generate.d.ts +2 -1
  60. package/dist/lib/generate.d.ts.map +1 -1
  61. package/dist/lib/generate.js +7 -6
  62. package/dist/lib/key-output.d.ts +4 -1
  63. package/dist/lib/key-output.d.ts.map +1 -1
  64. package/dist/lib/key-output.js +2 -2
  65. package/dist/lib/reformat.d.ts +2 -1
  66. package/dist/lib/reformat.d.ts.map +1 -1
  67. package/dist/lib/reformat.js +2 -2
  68. package/dist/lib/revoke.d.ts +2 -1
  69. package/dist/lib/revoke.d.ts.map +1 -1
  70. package/dist/lib/revoke.js +2 -2
  71. package/dist/lib/verify.d.ts +6 -2
  72. package/dist/lib/verify.d.ts.map +1 -1
  73. package/dist/lib/verify.js +28 -9
  74. package/dist/modern/aead.d.ts.map +1 -1
  75. package/dist/modern/aead.js +11 -10
  76. package/dist/modern/aes.d.ts.map +1 -1
  77. package/dist/modern/aes.js +10 -9
  78. package/dist/modern/cost-limits.d.ts.map +1 -1
  79. package/dist/modern/cost-limits.js +3 -2
  80. package/dist/modern/curves.d.ts +10 -5
  81. package/dist/modern/curves.d.ts.map +1 -1
  82. package/dist/modern/curves.js +43 -36
  83. package/dist/modern/ecdh.d.ts +2 -1
  84. package/dist/modern/ecdh.d.ts.map +1 -1
  85. package/dist/modern/ecdh.js +10 -9
  86. package/dist/modern/fn-dsa.d.ts.map +1 -1
  87. package/dist/modern/fn-dsa.js +9 -8
  88. package/dist/modern/hash.d.ts.map +1 -1
  89. package/dist/modern/hash.js +5 -3
  90. package/dist/modern/hpke-xwing.d.ts +10 -0
  91. package/dist/modern/hpke-xwing.d.ts.map +1 -0
  92. package/dist/modern/hpke-xwing.js +26 -0
  93. package/dist/modern/hpke.d.ts +1 -1
  94. package/dist/modern/hpke.d.ts.map +1 -1
  95. package/dist/modern/hpke.js +60 -28
  96. package/dist/modern/hybrid-combiner.d.ts +20 -0
  97. package/dist/modern/hybrid-combiner.d.ts.map +1 -0
  98. package/dist/modern/hybrid-combiner.js +79 -0
  99. package/dist/modern/index.d.ts +10 -10
  100. package/dist/modern/index.d.ts.map +1 -1
  101. package/dist/modern/index.js +17 -7
  102. package/dist/modern/kdf.d.ts.map +1 -1
  103. package/dist/modern/kdf.js +12 -12
  104. package/dist/modern/mac.d.ts +1 -0
  105. package/dist/modern/mac.d.ts.map +1 -1
  106. package/dist/modern/mac.js +24 -15
  107. package/dist/modern/password.d.ts.map +1 -1
  108. package/dist/modern/password.js +19 -18
  109. package/dist/modern/pq-hash-sign.d.ts.map +1 -1
  110. package/dist/modern/pq-hash-sign.js +23 -22
  111. package/dist/modern/pq-kem.d.ts +8 -0
  112. package/dist/modern/pq-kem.d.ts.map +1 -1
  113. package/dist/modern/pq-kem.js +71 -79
  114. package/dist/modern/pq-sign.d.ts +9 -2
  115. package/dist/modern/pq-sign.d.ts.map +1 -1
  116. package/dist/modern/pq-sign.js +60 -23
  117. package/dist/modern/pq.d.ts +0 -17
  118. package/dist/modern/pq.d.ts.map +1 -1
  119. package/dist/modern/pq.js +15 -43
  120. package/dist/modern/signing.d.ts +2 -1
  121. package/dist/modern/signing.d.ts.map +1 -1
  122. package/dist/modern/signing.js +14 -13
  123. package/dist/protocols/iso20022.d.ts.map +1 -1
  124. package/dist/protocols/iso20022.js +12 -6
  125. package/dist/protocols/opaque/ksf.js +2 -2
  126. package/dist/protocols/opaque/suite.d.ts +1 -8
  127. package/dist/protocols/opaque/suite.d.ts.map +1 -1
  128. package/dist/protocols/opaque/suite.js +5 -10
  129. package/dist/protocols/pqxdh.d.ts +9 -2
  130. package/dist/protocols/pqxdh.d.ts.map +1 -1
  131. package/dist/protocols/pqxdh.js +99 -94
  132. package/dist/protocols/ratchet.d.ts.map +1 -1
  133. package/dist/protocols/ratchet.js +14 -15
  134. package/dist/protocols/threshold.d.ts.map +1 -1
  135. package/dist/protocols/threshold.js +16 -15
  136. package/dist/registry.d.ts.map +1 -1
  137. package/dist/registry.js +26 -0
  138. package/dist/streaming/chunks.d.ts +31 -0
  139. package/dist/streaming/chunks.d.ts.map +1 -1
  140. package/dist/streaming/chunks.js +149 -13
  141. package/dist/streaming/stream-aead.d.ts +9 -0
  142. package/dist/streaming/stream-aead.d.ts.map +1 -1
  143. package/dist/streaming/stream-aead.js +27 -53
  144. package/dist/streaming/stream-hash.d.ts.map +1 -1
  145. package/dist/streaming/stream-hash.js +6 -4
  146. package/dist/streaming/stream-multi-pq-aead.d.ts +12 -0
  147. package/dist/streaming/stream-multi-pq-aead.d.ts.map +1 -1
  148. package/dist/streaming/stream-multi-pq-aead.js +82 -106
  149. package/dist/streaming/stream-pq-aead.d.ts +7 -2
  150. package/dist/streaming/stream-pq-aead.d.ts.map +1 -1
  151. package/dist/streaming/stream-pq-aead.js +29 -79
  152. package/dist/streaming/web-streams.d.ts +5 -2
  153. package/dist/streaming/web-streams.d.ts.map +1 -1
  154. package/dist/streaming/web-streams.js +90 -151
  155. package/dist/testing/index.d.ts +5 -0
  156. package/dist/testing/index.d.ts.map +1 -0
  157. package/dist/testing/index.js +13 -0
  158. package/dist/tokens/index.d.ts.map +1 -1
  159. package/dist/tokens/key-rotation.d.ts.map +1 -1
  160. package/dist/tokens/key-rotation.js +4 -2
  161. package/dist/tokens/paseto.d.ts +2 -0
  162. package/dist/tokens/paseto.d.ts.map +1 -1
  163. package/dist/tokens/paseto.js +56 -29
  164. package/dist/types/types.d.ts +1 -0
  165. package/dist/types/types.d.ts.map +1 -1
  166. package/dist/utils.d.ts.map +1 -1
  167. package/dist/utils.js +3 -2
  168. package/package.json +12 -2
  169. package/dist/config/config.d.ts +0 -8
  170. package/dist/config/config.d.ts.map +0 -1
  171. package/dist/config/config.js +0 -13
  172. package/dist/key/key.d.ts +0 -10
  173. package/dist/key/key.d.ts.map +0 -1
  174. package/dist/key/key.js +0 -25
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pq-backend.d.ts","sourceRoot":"","sources":["../../src/accel/pq-backend.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,KAAK,UAAU,MAAM,aAAa,CAAC;AA4D/C,MAAM,WAAW,OAAO;IAEtB,SAAS,EAAE,UAAU,CAAC;IAEtB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAwCD,MAAM,WAAW,KAAK;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,MAAO,SAAQ,KAAK;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IAEd,MAAM,EAAE,OAAO,CAAC;CACjB;AAGD,MAAM,MAAM,MAAM,GAAG,MAAM;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAE,CAAC;AAe5E,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,OAAO,EACzB,MAAM,GAAE,OAAO,UAAU,GAAG,IAAiB,EA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ApCpD,CAAA;qBAEE,CAAC;;+IAQO,CAAR;4MA0BiD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoFrD,CAAC;AAOF,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAG3C"}
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.slh_dsa_shake_256s = exports.slh_dsa_shake_256f = exports.slh_dsa_shake_192s = exports.slh_dsa_shake_192f = exports.slh_dsa_shake_128s = exports.slh_dsa_shake_128f = exports.slh_dsa_sha2_256s = exports.slh_dsa_sha2_256f = exports.slh_dsa_sha2_192s = exports.slh_dsa_sha2_192f = exports.slh_dsa_sha2_128s = exports.slh_dsa_sha2_128f = exports.ml_dsa87 = exports.ml_dsa65 = exports.ml_dsa44 = exports.ml_kem1024 = exports.ml_kem768 = exports.ml_kem512 = void 0;
4
+ exports.probe = probe;
5
+ exports.nativeFallbacks = nativeFallbacks;
6
+ exports.nativeAlgorithms = nativeAlgorithms;
7
+ const runtime_1 = require("./runtime");
8
+ const ml_kem_js_1 = require("@noble/post-quantum/ml-kem.js");
9
+ const ml_dsa_js_1 = require("@noble/post-quantum/ml-dsa.js");
10
+ const slh_dsa_js_1 = require("@noble/post-quantum/slh-dsa.js");
11
+ const encoding_1 = require("../encoding");
12
+ const nodeCrypto = (0, runtime_1.runtimeCrypto)();
13
+ function derLength(n) {
14
+ if (n < 0x80)
15
+ return Uint8Array.of(n);
16
+ if (n < 0x100)
17
+ return Uint8Array.of(0x81, n);
18
+ return Uint8Array.of(0x82, n >> 8, n & 0xff);
19
+ }
20
+ function tlv(tag, body) {
21
+ return (0, encoding_1.concat)([Uint8Array.of(tag), derLength(body.length), body]);
22
+ }
23
+ function endsWithOctetString(der, length) {
24
+ const lengthBytes = derLength(length);
25
+ const at = der.length - length - lengthBytes.length - 1;
26
+ return (at >= 0 &&
27
+ der[at] === 0x04 &&
28
+ Buffer.from(der.subarray(at + 1, at + 1 + lengthBytes.length)).equals(lengthBytes));
29
+ }
30
+ function spki(form, publicKey) {
31
+ const bits = (0, encoding_1.concat)([Uint8Array.of(0), publicKey]);
32
+ return tlv(0x30, (0, encoding_1.concat)([form.algorithm, tlv(0x03, bits)]));
33
+ }
34
+ function pkcs8(form, secretKey) {
35
+ const key = form.innerOctetString ? tlv(0x04, secretKey) : secretKey;
36
+ return tlv(0x30, (0, encoding_1.concat)([tlv(0x02, Uint8Array.of(0)), form.algorithm, tlv(0x04, key)]));
37
+ }
38
+ function tlvAt(der, offset) {
39
+ const first = der[offset + 1];
40
+ if (first < 0x80)
41
+ return { header: 2, length: first };
42
+ const octets = first & 0x7f;
43
+ let length = 0;
44
+ for (let i = 0; i < octets; i++)
45
+ length = length * 256 + der[offset + 2 + i];
46
+ return { header: 2 + octets, length };
47
+ }
48
+ function algorithmOf(spkiDer) {
49
+ const start = tlvAt(spkiDer, 0).header;
50
+ const algorithm = tlvAt(spkiDer, start);
51
+ return spkiDer.subarray(start, start + algorithm.header + algorithm.length);
52
+ }
53
+ function probe(name, sizes, innerOctetString, crypto = nodeCrypto, expand) {
54
+ if (crypto === null)
55
+ return undefined;
56
+ try {
57
+ const { publicKey, privateKey } = crypto.generateKeyPairSync(name);
58
+ const spkiDer = publicKey.export({ format: "der", type: "spki" });
59
+ const pkcs8Der = privateKey.export({ format: "der", type: "pkcs8" });
60
+ const form = { algorithm: algorithmOf(spkiDer), innerOctetString };
61
+ const native = { name, form, keygen: true, ...sizes };
62
+ if (endsWithOctetString(pkcs8Der, sizes.secretKey))
63
+ return native;
64
+ return expand && readsLikeNoble(crypto, native, expand())
65
+ ? { ...native, keygen: false }
66
+ : undefined;
67
+ }
68
+ catch {
69
+ return undefined;
70
+ }
71
+ }
72
+ function readsLikeNoble(crypto, native, pair) {
73
+ const privateKey = crypto.createPrivateKey({
74
+ key: Buffer.from(pkcs8(native.form, pair.secretKey)),
75
+ format: "der",
76
+ type: "pkcs8",
77
+ });
78
+ const spkiDer = crypto
79
+ .createPublicKey(privateKey)
80
+ .export({ format: "der", type: "spki" });
81
+ return Buffer.from(spkiDer.subarray(-native.publicKey)).equals(Buffer.from(pair.publicKey));
82
+ }
83
+ const nativeByName = new Map();
84
+ const PROBES = [];
85
+ function lazyNative(name, sizes, innerOctetString, expand) {
86
+ let probed = false;
87
+ let native;
88
+ const get = () => {
89
+ if (!probed) {
90
+ native = probe(name, sizes, innerOctetString, nodeCrypto, expand);
91
+ probed = true;
92
+ nativeByName.set(name, native !== undefined);
93
+ }
94
+ return native;
95
+ };
96
+ PROBES.push(get);
97
+ return get;
98
+ }
99
+ let fallbacks = 0;
100
+ function nativeFallbacks() {
101
+ return fallbacks;
102
+ }
103
+ function nativeOr(fast, slow) {
104
+ if (fast) {
105
+ try {
106
+ return fast();
107
+ }
108
+ catch {
109
+ fallbacks += 1;
110
+ }
111
+ }
112
+ return slow();
113
+ }
114
+ function rawKeyPair(native) {
115
+ const { publicKey, privateKey } = nodeCrypto.generateKeyPairSync(native.name);
116
+ const spkiDer = publicKey.export({ format: "der", type: "spki" });
117
+ const pkcs8Der = privateKey.export({ format: "der", type: "pkcs8" });
118
+ return {
119
+ publicKey: new Uint8Array(spkiDer.subarray(-native.publicKey)),
120
+ secretKey: new Uint8Array(pkcs8Der.subarray(-native.secretKey)),
121
+ };
122
+ }
123
+ function nativeKeygen(native, seed) {
124
+ const n = seed === undefined ? native() : undefined;
125
+ return n?.keygen ? () => rawKeyPair(n) : undefined;
126
+ }
127
+ const expandWith = (noble) => () => noble.keygen(new Uint8Array(noble.lengths.seed));
128
+ function publicKeyObject(native, key) {
129
+ return nodeCrypto.createPublicKey({
130
+ key: Buffer.from(spki(native.form, key)),
131
+ format: "der",
132
+ type: "spki",
133
+ });
134
+ }
135
+ function privateKeyObject(native, key) {
136
+ return nodeCrypto.createPrivateKey({
137
+ key: Buffer.from(pkcs8(native.form, key)),
138
+ format: "der",
139
+ type: "pkcs8",
140
+ });
141
+ }
142
+ function kem(noble, name) {
143
+ const native = lazyNative(name, {
144
+ publicKey: noble.lengths.publicKey,
145
+ secretKey: noble.lengths.secretKey,
146
+ }, true, expandWith(noble));
147
+ return {
148
+ ...noble,
149
+ keygen(seed) {
150
+ return nativeOr(nativeKeygen(native, seed), () => noble.keygen(seed));
151
+ },
152
+ encapsulate(publicKey, msg) {
153
+ const n = msg === undefined ? native() : undefined;
154
+ return nativeOr(n &&
155
+ (() => {
156
+ const out = nodeCrypto.encapsulate(publicKeyObject(n, publicKey));
157
+ return {
158
+ cipherText: new Uint8Array(out.ciphertext),
159
+ sharedSecret: new Uint8Array(out.sharedKey),
160
+ };
161
+ }), () => noble.encapsulate(publicKey, msg));
162
+ },
163
+ decapsulate(cipherText, secretKey) {
164
+ const n = native();
165
+ return nativeOr(n &&
166
+ (() => new Uint8Array(nodeCrypto.decapsulate(privateKeyObject(n, secretKey), Buffer.from(cipherText)))), () => noble.decapsulate(cipherText, secretKey));
167
+ },
168
+ };
169
+ }
170
+ function signer(noble, name, innerOctetString) {
171
+ const native = lazyNative(name, {
172
+ publicKey: noble.lengths.publicKey,
173
+ secretKey: noble.lengths.secretKey,
174
+ }, innerOctetString, expandWith(noble));
175
+ return {
176
+ ...noble,
177
+ keygen(seed) {
178
+ return nativeOr(nativeKeygen(native, seed), () => noble.keygen(seed));
179
+ },
180
+ sign(msg, secretKey, opts) {
181
+ const n = opts === undefined ? native() : undefined;
182
+ return nativeOr(n &&
183
+ (() => new Uint8Array(nodeCrypto.sign(null, msg, privateKeyObject(n, secretKey)))), () => noble.sign(msg, secretKey, opts));
184
+ },
185
+ verify(sig, msg, publicKey, opts) {
186
+ const n = opts === undefined ? native() : undefined;
187
+ return nativeOr(n &&
188
+ (() => nodeCrypto.verify(null, msg, publicKeyObject(n, publicKey), sig)), () => noble.verify(sig, msg, publicKey, opts));
189
+ },
190
+ };
191
+ }
192
+ exports.ml_kem512 = kem(ml_kem_js_1.ml_kem512, "ml-kem-512");
193
+ exports.ml_kem768 = kem(ml_kem_js_1.ml_kem768, "ml-kem-768");
194
+ exports.ml_kem1024 = kem(ml_kem_js_1.ml_kem1024, "ml-kem-1024");
195
+ exports.ml_dsa44 = signer(ml_dsa_js_1.ml_dsa44, "ml-dsa-44", true);
196
+ exports.ml_dsa65 = signer(ml_dsa_js_1.ml_dsa65, "ml-dsa-65", true);
197
+ exports.ml_dsa87 = signer(ml_dsa_js_1.ml_dsa87, "ml-dsa-87", true);
198
+ exports.slh_dsa_sha2_128f = signer(slh_dsa_js_1.slh_dsa_sha2_128f, "slh-dsa-sha2-128f", false);
199
+ exports.slh_dsa_sha2_128s = signer(slh_dsa_js_1.slh_dsa_sha2_128s, "slh-dsa-sha2-128s", false);
200
+ exports.slh_dsa_sha2_192f = signer(slh_dsa_js_1.slh_dsa_sha2_192f, "slh-dsa-sha2-192f", false);
201
+ exports.slh_dsa_sha2_192s = signer(slh_dsa_js_1.slh_dsa_sha2_192s, "slh-dsa-sha2-192s", false);
202
+ exports.slh_dsa_sha2_256f = signer(slh_dsa_js_1.slh_dsa_sha2_256f, "slh-dsa-sha2-256f", false);
203
+ exports.slh_dsa_sha2_256s = signer(slh_dsa_js_1.slh_dsa_sha2_256s, "slh-dsa-sha2-256s", false);
204
+ exports.slh_dsa_shake_128f = signer(slh_dsa_js_1.slh_dsa_shake_128f, "slh-dsa-shake-128f", false);
205
+ exports.slh_dsa_shake_128s = signer(slh_dsa_js_1.slh_dsa_shake_128s, "slh-dsa-shake-128s", false);
206
+ exports.slh_dsa_shake_192f = signer(slh_dsa_js_1.slh_dsa_shake_192f, "slh-dsa-shake-192f", false);
207
+ exports.slh_dsa_shake_192s = signer(slh_dsa_js_1.slh_dsa_shake_192s, "slh-dsa-shake-192s", false);
208
+ exports.slh_dsa_shake_256f = signer(slh_dsa_js_1.slh_dsa_shake_256f, "slh-dsa-shake-256f", false);
209
+ exports.slh_dsa_shake_256s = signer(slh_dsa_js_1.slh_dsa_shake_256s, "slh-dsa-shake-256s", false);
210
+ function nativeAlgorithms() {
211
+ for (const native of PROBES)
212
+ native();
213
+ return [...nativeByName].filter(([, on]) => on).map(([name]) => name);
214
+ }
215
+ //# sourceMappingURL=pq-backend.js.map
@@ -0,0 +1,3 @@
1
+ import type * as NodeCrypto from "node:crypto";
2
+ export declare function runtimeCrypto(): typeof NodeCrypto | null;
3
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/accel/runtime.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,UAAU,MAAM,aAAa,CAAC;AAO/C,wBAAgB,aAAa,IAAI,OAAO,UAAU,GAAG,IAAI,CAQxD"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runtimeCrypto = runtimeCrypto;
4
+ function runtimeCrypto() {
5
+ const runtime = globalThis.process;
6
+ const crypto = runtime?.getBuiltinModule?.("node:crypto");
7
+ return (crypto ?? null);
8
+ }
9
+ //# sourceMappingURL=runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-bridge.d.ts","sourceRoot":"","sources":["../../src/accel/wasm-bridge.ts"],"names":[],"mappings":"AA8BA,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC;AAGtD,MAAM,MAAM,iBAAiB,GAC3B,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;AAG3D,MAAM,WAAW,eAAe;IAE9B,SAAS,EAAE,iBAAiB,CAAC;IAE7B,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAE1B,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC3B;AAGD,MAAM,WAAW,cAAc;IAE7B,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,EAAE,iBAAiB,CAAC;IAE7B,OAAO,E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,CAAC;IAEf,SAAS,EAAE,iBAAiB,CAAC;IAE7B,OAAO,EAAE,WAAW,CAAC;CACtB;AAGD,MAAM,WAAW,sBAAsB;IAErC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;IAEzB,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC;IAE/B,GAAG,CAAC,EAAE,UAAU,CAAC;CAClB;AAGD,MAAM,WAAW,qBAAqB;IAEpC,UAAU,EAAE,MAAM,CAAC;IAEnB,OAAO,EAAE,WAAW,CAAC;CACtB;AAGD,MAAM,WAAW,qBAAqB;IAEpC,SAAS,EAAE,UAAU,CAAC;IAEtB,OAAO,EAAE,WAAW,CAAC;CACtB;AAmED,wBAAgB,iBAAiB,IAAI,WAAW,CA4B/C;AASD,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAoDD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAYjE;AAgBD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAC9B,qBAAqB,CAyBvB;AAWD,wBAAgB,eAAe,CAAC,OAAO,EAAE;IAEvC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;IAEzB,UAAU,EAAE,MAAM,CAAC;IAEnB,GAAG,CAAC,EAAE,UAAU,CAAC;CAClB,GAAG,qBAAqB,CAyBxB"}
@@ -10,6 +10,8 @@ const sha3_js_1 = require("@noble/hashes/sha3.js");
10
10
  const blake3_js_1 = require("@noble/hashes/blake3.js");
11
11
  const chacha_js_1 = require("@noble/ciphers/chacha.js");
12
12
  const utils_js_1 = require("@noble/ciphers/utils.js");
13
+ const errors_1 = require("../errors");
14
+ const encoding_1 = require("../encoding");
13
15
  let cachedBackend;
14
16
  const SIMD_TEST_BYTES = new Uint8Array([
15
17
  0x00,
@@ -84,16 +86,15 @@ function detectWasmBackend() {
84
86
  function _resetWasmDetection() {
85
87
  cachedBackend = undefined;
86
88
  }
87
- const HEX_RE = /^[0-9a-fA-F]*$/;
88
89
  function toBytes(input, encoding = "utf8") {
89
90
  if (input instanceof Uint8Array)
90
91
  return input;
91
92
  if (encoding === "hex") {
92
- if (!HEX_RE.test(input))
93
- throw new Error("Invalid hex string");
94
- return Buffer.from(input, "hex");
93
+ if (!(0, encoding_1.isHex)(input))
94
+ throw new errors_1.CryptoError("Invalid hex string", errors_1.CryptoErrorCode.INVALID_HEX);
95
+ return (0, encoding_1.decodeHex)(input);
95
96
  }
96
- return Buffer.from(input, "utf8");
97
+ return (0, encoding_1.utf8)(input);
97
98
  }
98
99
  function getHashFn(algorithm) {
99
100
  switch (algorithm) {
@@ -108,7 +109,7 @@ function getHashFn(algorithm) {
108
109
  case "blake3":
109
110
  return blake3_js_1.blake3;
110
111
  default:
111
- throw new Error(`Unsupported hash algorithm: ${algorithm}`);
112
+ throw new errors_1.CryptoError(`Unsupported hash algorithm: ${algorithm}`, errors_1.CryptoErrorCode.UNSUPPORTED_ALGORITHM);
112
113
  }
113
114
  }
114
115
  function wasmHash(options) {
@@ -116,7 +117,7 @@ function wasmHash(options) {
116
117
  const hashFn = getHashFn(options.algorithm);
117
118
  const digest = hashFn(data);
118
119
  return {
119
- digest: Buffer.from(digest).toString("hex"),
120
+ digest: (0, encoding_1.toHex)(digest),
120
121
  algorithm: options.algorithm,
121
122
  backend: "js",
122
123
  };
@@ -125,11 +126,11 @@ const NONCE_LENGTH = 24;
125
126
  function wasmAeadEncrypt(options) {
126
127
  const key = toBytes(options.key, "hex");
127
128
  if (key.length !== 32) {
128
- throw new Error(`Key must be 32 bytes (256 bits), got ${key.length}`);
129
+ throw new errors_1.CryptoError(`Key must be 32 bytes (256 bits), got ${key.length}`, errors_1.CryptoErrorCode.INVALID_KEY);
129
130
  }
130
131
  const plaintext = options.plaintext instanceof Uint8Array
131
132
  ? options.plaintext
132
- : Buffer.from(options.plaintext, "utf8");
133
+ : (0, encoding_1.utf8)(options.plaintext);
133
134
  const nonce = (0, utils_js_1.randomBytes)(NONCE_LENGTH);
134
135
  const cipher = (0, chacha_js_1.xchacha20poly1305)(key, nonce, options.aad);
135
136
  const sealed = cipher.encrypt(plaintext);
@@ -137,18 +138,18 @@ function wasmAeadEncrypt(options) {
137
138
  combined.set(nonce);
138
139
  combined.set(sealed, NONCE_LENGTH);
139
140
  return {
140
- ciphertext: Buffer.from(combined).toString("base64"),
141
+ ciphertext: (0, encoding_1.toBase64)(combined),
141
142
  backend: "js",
142
143
  };
143
144
  }
144
145
  function wasmAeadDecrypt(options) {
145
146
  const key = toBytes(options.key, "hex");
146
147
  if (key.length !== 32) {
147
- throw new Error(`Key must be 32 bytes (256 bits), got ${key.length}`);
148
+ throw new errors_1.CryptoError(`Key must be 32 bytes (256 bits), got ${key.length}`, errors_1.CryptoErrorCode.INVALID_KEY);
148
149
  }
149
- const combined = Buffer.from(options.ciphertext, "base64");
150
+ const combined = (0, encoding_1.fromBase64)(options.ciphertext);
150
151
  if (combined.length < NONCE_LENGTH + 16) {
151
- throw new Error("Ciphertext too short — missing nonce or auth tag");
152
+ throw new errors_1.CryptoError("Ciphertext too short — missing nonce or auth tag", errors_1.CryptoErrorCode.INVALID_CIPHERTEXT);
152
153
  }
153
154
  const nonce = combined.subarray(0, NONCE_LENGTH);
154
155
  const sealed = combined.subarray(NONCE_LENGTH);
@@ -1 +1 @@
1
- {"version":3,"file":"webcrypto-bridge.d.ts","sourceRoot":"","sources":["../../src/accel/webcrypto-bridge.ts"],"names":[],"mappings":"AAyCA,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAGvE,MAAM,WAAW,6BAA6B;IAE5C,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;IAEzB,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC;IAE/B,GAAG,CAAC,EAAE,UAAU,CAAC;CAClB;AAGD,MAAM,WAAW,4BAA4B;IAE3C,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAGD,MAAM,WAAW,6BAA6B;IAE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,CAAC;IAEnB,GAAG,CAAC,EAAE,UAAU,CAAC;CAClB;AAGD,MAAM,WAAW,4BAA4B;IAE3C,SAAS,EAAE,UAAU,CAAC;IAEtB,WAAW,EAAE,OAAO,CAAC;CACtB;AAGD,MAAM,WAAW,oBAAoB;IAEnC,SAAS,EAAE,sBAAsB,CAAC;IAElC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;CAC3B;AAGD,MAAM,WAAW,mBAAmB;IAElC,MAAM,EAAE,MAAM,CAAC;IAEf,WAAW,EAAE,OAAO,CAAC;CACtB;AA2DD,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAUD,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,4BAA4B,CAAC,CAuDvC;AASD,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,4BAA4B,CAAC,CAsDvC;AASD,wBAAsB,aAAa,CACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CAoC9B"}
@@ -41,26 +41,27 @@ const aes_js_1 = require("@noble/ciphers/aes.js");
41
41
  const utils_js_1 = require("@noble/ciphers/utils.js");
42
42
  const sha2_js_1 = require("@noble/hashes/sha2.js");
43
43
  const nodeCrypto = __importStar(require("node:crypto"));
44
+ const errors_1 = require("../errors");
45
+ const encoding_1 = require("../encoding");
44
46
  function asBufferSource(view) {
45
47
  return view;
46
48
  }
47
- const HEX_RE = /^[0-9a-fA-F]*$/;
48
49
  const NONCE_LENGTH = 12;
49
50
  const TAG_LENGTH = 16;
50
51
  function toBytes(input, encoding = "utf8") {
51
52
  if (input instanceof Uint8Array)
52
53
  return input;
53
54
  if (encoding === "hex") {
54
- if (!HEX_RE.test(input)) {
55
- throw new Error("Invalid hex string");
55
+ if (!(0, encoding_1.isHex)(input)) {
56
+ throw new errors_1.CryptoError("Invalid hex string", errors_1.CryptoErrorCode.INVALID_HEX);
56
57
  }
57
- return Buffer.from(input, "hex");
58
+ return (0, encoding_1.decodeHex)(input);
58
59
  }
59
- return Buffer.from(input, "utf8");
60
+ return (0, encoding_1.utf8)(input);
60
61
  }
61
62
  function validateKey(key) {
62
63
  if (key.length !== 16 && key.length !== 32) {
63
- throw new Error(`Key must be 16 bytes (128 bits) or 32 bytes (256 bits), got ${key.length}`);
64
+ throw new errors_1.CryptoError(`Key must be 16 bytes (128 bits) or 32 bytes (256 bits), got ${key.length}`, errors_1.CryptoErrorCode.INVALID_KEY);
64
65
  }
65
66
  }
66
67
  function getSubtle() {
@@ -100,7 +101,7 @@ async function webCryptoAesGcmEncrypt(options) {
100
101
  combined.set(nonce);
101
102
  combined.set(sealed, NONCE_LENGTH);
102
103
  return {
103
- ciphertext: Buffer.from(combined).toString("base64"),
104
+ ciphertext: (0, encoding_1.toBase64)(combined),
104
105
  accelerated: true,
105
106
  };
106
107
  }
@@ -110,16 +111,16 @@ async function webCryptoAesGcmEncrypt(options) {
110
111
  combined.set(nonce);
111
112
  combined.set(sealed, NONCE_LENGTH);
112
113
  return {
113
- ciphertext: Buffer.from(combined).toString("base64"),
114
+ ciphertext: (0, encoding_1.toBase64)(combined),
114
115
  accelerated: false,
115
116
  };
116
117
  }
117
118
  async function webCryptoAesGcmDecrypt(options) {
118
119
  const key = toBytes(options.key, "hex");
119
120
  validateKey(key);
120
- const combined = Buffer.from(options.ciphertext, "base64");
121
+ const combined = (0, encoding_1.fromBase64)(options.ciphertext);
121
122
  if (combined.length < NONCE_LENGTH + TAG_LENGTH) {
122
- throw new Error("Ciphertext too short — missing nonce or auth tag");
123
+ throw new errors_1.CryptoError("Ciphertext too short — missing nonce or auth tag", errors_1.CryptoErrorCode.INVALID_CIPHERTEXT);
123
124
  }
124
125
  const nonce = combined.subarray(0, NONCE_LENGTH);
125
126
  const sealed = combined.subarray(NONCE_LENGTH);
@@ -153,7 +154,7 @@ async function webCryptoHash(options) {
153
154
  if (subtle) {
154
155
  const digest = await subtle.digest(options.algorithm, asBufferSource(data));
155
156
  return {
156
- digest: Buffer.from(digest).toString("hex"),
157
+ digest: (0, encoding_1.toHex)(new Uint8Array(digest)),
157
158
  accelerated: true,
158
159
  };
159
160
  }
@@ -169,10 +170,10 @@ async function webCryptoHash(options) {
169
170
  digest = (0, sha2_js_1.sha512)(data);
170
171
  break;
171
172
  default:
172
- throw new Error(`Unsupported hash algorithm: ${options.algorithm}`);
173
+ throw new errors_1.CryptoError(`Unsupported hash algorithm: ${options.algorithm}`, errors_1.CryptoErrorCode.UNSUPPORTED_ALGORITHM);
173
174
  }
174
175
  return {
175
- digest: Buffer.from(digest).toString("hex"),
176
+ digest: (0, encoding_1.toHex)(new Uint8Array(digest)),
176
177
  accelerated: false,
177
178
  };
178
179
  }
@@ -1 +1 @@
1
- {"version":3,"file":"webcrypto-modern.d.ts","sourceRoot":"","sources":["../../src/accel/webcrypto-modern.ts"],"names":[],"mappings":"AAkDA,MAAM,WAAW,sBAAsB;IAErC,gBAAgB,EAAE,OAAO,CAAC;IAE1B,IAAI,EAAE,OAAO,CAAC;IAEd,KAAK,EAAE,OAAO,CAAC;IAEf,MAAM,EAAE,OAAO,CAAC;IAEhB,IAAI,EAAE,OAAO,CAAC;CACf;AAGD,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,UAAU,CAAC;AAG1D,MAAM,WAAW,4BAA4B;IAE3C,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;IAEzB,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC;IAE/B,GAAG,CAAC,EAAE,UAAU,CAAC;CAClB;AAGD,MAAM,WAAW,gBAAgB;IAE/B,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAGD,MAAM,WAAW,4BAA4B;IAE3C,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;IAEzB,UAAU,EAAE,MAAM,CAAC;IAEnB,GAAG,CAAC,EAAE,UAAU,CAAC;CAClB;AAGD,MAAM,WAAW,2BAA2B;IAE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W,4BAA4B;IAE3C,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;IAEzB,UAAU,EAAE,MAAM,CAAC;IAEnB,GAAG,CAAC,EAAE,UAAU,CAAC;CAClB;AAGD,MAAM,WAAW,2BAA2B;IAE1C,SAAS,EAAE,UAAU,CAAC;IAEtB,WAAW,EAAE,OAAO,CAAC;CACtB;AAGD,MAAM,WAAW,qBAAqB;IAEpC,SAAS,EAAE,mBAAmB,CAAC;IAE/B,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;CAC3B;AAGD,MAAM,WAAW,oBAAoB;IAEnC,MAAM,EAAE,MAAM,CAAC;IAEf,WAAW,EAAE,OAAO,CAAC;CACtB;AAyED,wBAAgB,qBAAqB,IAAI,sBAAsB,CAiC9D;AAUD,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAmBD,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,gBAAgB,CAAC,CA4D3B;AAgBD,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,2BAA2B,CAAC,CA4DtC;AAmBD,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAkC/B"}
@@ -42,22 +42,23 @@ const chacha_js_1 = require("@noble/ciphers/chacha.js");
42
42
  const utils_js_1 = require("@noble/ciphers/utils.js");
43
43
  const sha3_js_1 = require("@noble/hashes/sha3.js");
44
44
  const nodeCrypto = __importStar(require("node:crypto"));
45
+ const errors_1 = require("../errors");
46
+ const encoding_1 = require("../encoding");
45
47
  function asBufferSource(view) {
46
48
  return view;
47
49
  }
48
- const HEX_RE = /^[0-9a-fA-F]*$/;
49
50
  const NONCE_LENGTH = 12;
50
51
  const TAG_LENGTH = 16;
51
52
  function toBytes(input, encoding = "utf8") {
52
53
  if (input instanceof Uint8Array)
53
54
  return input;
54
55
  if (encoding === "hex") {
55
- if (!HEX_RE.test(input)) {
56
- throw new Error("Invalid hex string");
56
+ if (!(0, encoding_1.isHex)(input)) {
57
+ throw new errors_1.CryptoError("Invalid hex string", errors_1.CryptoErrorCode.INVALID_HEX);
57
58
  }
58
- return Buffer.from(input, "hex");
59
+ return (0, encoding_1.decodeHex)(input);
59
60
  }
60
- return Buffer.from(input, "utf8");
61
+ return (0, encoding_1.utf8)(input);
61
62
  }
62
63
  function getSubtle() {
63
64
  try {
@@ -111,7 +112,7 @@ function _resetModernWebCryptoDetection() {
111
112
  async function modernChaCha20Encrypt(options) {
112
113
  const key = toBytes(options.key, "hex");
113
114
  if (key.length !== 32) {
114
- throw new Error(`Key must be 32 bytes (256 bits), got ${key.length}`);
115
+ throw new errors_1.CryptoError(`Key must be 32 bytes (256 bits), got ${key.length}`, errors_1.CryptoErrorCode.INVALID_KEY);
115
116
  }
116
117
  const plaintext = toBytes(options.plaintext, "utf8");
117
118
  const nonce = (0, utils_js_1.randomBytes)(NONCE_LENGTH);
@@ -133,7 +134,7 @@ async function modernChaCha20Encrypt(options) {
133
134
  combined.set(nonce);
134
135
  combined.set(sealed, NONCE_LENGTH);
135
136
  return {
136
- ciphertext: Buffer.from(combined).toString("base64"),
137
+ ciphertext: (0, encoding_1.toBase64)(combined),
137
138
  accelerated: true,
138
139
  };
139
140
  }
@@ -143,18 +144,18 @@ async function modernChaCha20Encrypt(options) {
143
144
  combined.set(nonce);
144
145
  combined.set(sealed, NONCE_LENGTH);
145
146
  return {
146
- ciphertext: Buffer.from(combined).toString("base64"),
147
+ ciphertext: (0, encoding_1.toBase64)(combined),
147
148
  accelerated: false,
148
149
  };
149
150
  }
150
151
  async function modernChaCha20Decrypt(options) {
151
152
  const key = toBytes(options.key, "hex");
152
153
  if (key.length !== 32) {
153
- throw new Error(`Key must be 32 bytes (256 bits), got ${key.length}`);
154
+ throw new errors_1.CryptoError(`Key must be 32 bytes (256 bits), got ${key.length}`, errors_1.CryptoErrorCode.INVALID_KEY);
154
155
  }
155
- const combined = Buffer.from(options.ciphertext, "base64");
156
+ const combined = (0, encoding_1.fromBase64)(options.ciphertext);
156
157
  if (combined.length < NONCE_LENGTH + TAG_LENGTH) {
157
- throw new Error("Ciphertext too short — missing nonce or auth tag");
158
+ throw new errors_1.CryptoError("Ciphertext too short — missing nonce or auth tag", errors_1.CryptoErrorCode.INVALID_CIPHERTEXT);
158
159
  }
159
160
  const nonce = combined.subarray(0, NONCE_LENGTH);
160
161
  const sealed = combined.subarray(NONCE_LENGTH);
@@ -190,7 +191,7 @@ async function modernSha3Hash(options) {
190
191
  const subtle = getSubtle();
191
192
  const digest = await subtle.digest(options.algorithm, asBufferSource(data));
192
193
  return {
193
- digest: Buffer.from(digest).toString("hex"),
194
+ digest: (0, encoding_1.toHex)(new Uint8Array(digest)),
194
195
  accelerated: true,
195
196
  };
196
197
  }
@@ -203,10 +204,10 @@ async function modernSha3Hash(options) {
203
204
  digest = (0, sha3_js_1.sha3_512)(data);
204
205
  break;
205
206
  default:
206
- throw new Error(`Unsupported SHA-3 algorithm: ${options.algorithm}`);
207
+ throw new errors_1.CryptoError(`Unsupported SHA-3 algorithm: ${options.algorithm}`, errors_1.CryptoErrorCode.UNSUPPORTED_ALGORITHM);
207
208
  }
208
209
  return {
209
- digest: Buffer.from(digest).toString("hex"),
210
+ digest: (0, encoding_1.toHex)(new Uint8Array(digest)),
210
211
  accelerated: false,
211
212
  };
212
213
  }
@@ -1,6 +1,15 @@
1
1
  export interface WorkerPoolOptions {
2
2
  size?: number;
3
3
  workerScript?: string;
4
+ maxQueue?: number;
5
+ taskTimeoutMs?: number;
6
+ resourceLimits?: import("node:worker_threads").ResourceLimits;
7
+ }
8
+ export declare class WorkerPoolBusyError extends Error {
9
+ readonly name = "WorkerPoolBusyError";
10
+ }
11
+ export declare class WorkerTaskTimeoutError extends Error {
12
+ readonly name = "WorkerTaskTimeoutError";
4
13
  }
5
14
  export interface WorkerTask {
6
15
  modulePath: string;
@@ -11,13 +20,22 @@ export declare class WorkerPool {
11
20
  private workers;
12
21
  private queue;
13
22
  private terminated;
23
+ private readonly script;
24
+ private readonly maxQueue;
25
+ private readonly taskTimeoutMs;
26
+ private readonly resourceLimits;
14
27
  readonly size: number;
15
28
  constructor(options?: WorkerPoolOptions);
16
29
  execute<T = unknown>(task: WorkerTask): Promise<T>;
17
30
  shutdown(): Promise<void>;
18
31
  get pending(): number;
19
32
  get active(): number;
33
+ private spawn;
20
34
  private dispatch;
35
+ private startTimer;
36
+ private settle;
37
+ private fail;
38
+ private clearTimer;
21
39
  private processQueue;
22
40
  }
23
41
  //# sourceMappingURL=worker-pool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-pool.d.ts","sourceRoot":"","sources":["../../src/accel/worker-pool.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,iBAAiB;IAEhC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,MAAM,WAAW,UAAU;IAEzB,UAAU,EAAE,MAAM,CAAC;IAEnB,YAAY,EAAE,MAAM,CAAC;IAErB,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAiED,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,UAAU,CAAS;IAE3B,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEjB,OAAO,GAAE,iBAAsB;IA6B3C,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC;IA2B5C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB/B,IAAI,OAAO,IAAI,MAAM,CAEpB;IAKD,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,OAAO,CAAC,QAAQ;IAsChB,OAAO,CAAC,YAAY;CAMrB"}
1
+ {"version":3,"file":"worker-pool.d.ts","sourceRoot":"","sources":["../../src/accel/worker-pool.ts"],"names":[],"mappings":"AA6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