@noble/curves 1.9.2 → 1.9.3

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 (179) hide show
  1. package/README.md +186 -206
  2. package/_shortw_utils.d.ts +1 -0
  3. package/_shortw_utils.d.ts.map +1 -1
  4. package/_shortw_utils.js +1 -0
  5. package/_shortw_utils.js.map +1 -1
  6. package/abstract/bls.d.ts +87 -62
  7. package/abstract/bls.d.ts.map +1 -1
  8. package/abstract/bls.js +170 -163
  9. package/abstract/bls.js.map +1 -1
  10. package/abstract/curve.d.ts +109 -23
  11. package/abstract/curve.d.ts.map +1 -1
  12. package/abstract/curve.js +158 -156
  13. package/abstract/curve.js.map +1 -1
  14. package/abstract/edwards.d.ts +124 -70
  15. package/abstract/edwards.d.ts.map +1 -1
  16. package/abstract/edwards.js +212 -62
  17. package/abstract/edwards.js.map +1 -1
  18. package/abstract/hash-to-curve.d.ts +8 -4
  19. package/abstract/hash-to-curve.d.ts.map +1 -1
  20. package/abstract/hash-to-curve.js +23 -11
  21. package/abstract/hash-to-curve.js.map +1 -1
  22. package/abstract/modular.d.ts +8 -3
  23. package/abstract/modular.d.ts.map +1 -1
  24. package/abstract/modular.js +79 -35
  25. package/abstract/modular.js.map +1 -1
  26. package/abstract/montgomery.d.ts +17 -4
  27. package/abstract/montgomery.d.ts.map +1 -1
  28. package/abstract/montgomery.js +19 -3
  29. package/abstract/montgomery.js.map +1 -1
  30. package/abstract/tower.d.ts +3 -3
  31. package/abstract/tower.d.ts.map +1 -1
  32. package/abstract/tower.js.map +1 -1
  33. package/abstract/weierstrass.d.ts +142 -116
  34. package/abstract/weierstrass.d.ts.map +1 -1
  35. package/abstract/weierstrass.js +414 -335
  36. package/abstract/weierstrass.js.map +1 -1
  37. package/bls12-381.d.ts.map +1 -1
  38. package/bls12-381.js +4 -4
  39. package/bls12-381.js.map +1 -1
  40. package/ed25519.d.ts +52 -66
  41. package/ed25519.d.ts.map +1 -1
  42. package/ed25519.js +128 -155
  43. package/ed25519.js.map +1 -1
  44. package/ed448.d.ts +57 -58
  45. package/ed448.d.ts.map +1 -1
  46. package/ed448.js +114 -131
  47. package/ed448.js.map +1 -1
  48. package/esm/_shortw_utils.d.ts +1 -0
  49. package/esm/_shortw_utils.d.ts.map +1 -1
  50. package/esm/_shortw_utils.js +1 -0
  51. package/esm/_shortw_utils.js.map +1 -1
  52. package/esm/abstract/bls.d.ts +87 -62
  53. package/esm/abstract/bls.d.ts.map +1 -1
  54. package/esm/abstract/bls.js +171 -164
  55. package/esm/abstract/bls.js.map +1 -1
  56. package/esm/abstract/curve.d.ts +109 -23
  57. package/esm/abstract/curve.d.ts.map +1 -1
  58. package/esm/abstract/curve.js +156 -155
  59. package/esm/abstract/curve.js.map +1 -1
  60. package/esm/abstract/edwards.d.ts +124 -70
  61. package/esm/abstract/edwards.d.ts.map +1 -1
  62. package/esm/abstract/edwards.js +210 -62
  63. package/esm/abstract/edwards.js.map +1 -1
  64. package/esm/abstract/hash-to-curve.d.ts +8 -4
  65. package/esm/abstract/hash-to-curve.d.ts.map +1 -1
  66. package/esm/abstract/hash-to-curve.js +22 -11
  67. package/esm/abstract/hash-to-curve.js.map +1 -1
  68. package/esm/abstract/modular.d.ts +8 -3
  69. package/esm/abstract/modular.d.ts.map +1 -1
  70. package/esm/abstract/modular.js +79 -35
  71. package/esm/abstract/modular.js.map +1 -1
  72. package/esm/abstract/montgomery.d.ts +17 -4
  73. package/esm/abstract/montgomery.d.ts.map +1 -1
  74. package/esm/abstract/montgomery.js +19 -3
  75. package/esm/abstract/montgomery.js.map +1 -1
  76. package/esm/abstract/tower.d.ts +3 -3
  77. package/esm/abstract/tower.d.ts.map +1 -1
  78. package/esm/abstract/tower.js.map +1 -1
  79. package/esm/abstract/weierstrass.d.ts +142 -116
  80. package/esm/abstract/weierstrass.d.ts.map +1 -1
  81. package/esm/abstract/weierstrass.js +411 -333
  82. package/esm/abstract/weierstrass.js.map +1 -1
  83. package/esm/bls12-381.d.ts.map +1 -1
  84. package/esm/bls12-381.js +4 -4
  85. package/esm/bls12-381.js.map +1 -1
  86. package/esm/ed25519.d.ts +52 -66
  87. package/esm/ed25519.d.ts.map +1 -1
  88. package/esm/ed25519.js +131 -157
  89. package/esm/ed25519.js.map +1 -1
  90. package/esm/ed448.d.ts +57 -58
  91. package/esm/ed448.d.ts.map +1 -1
  92. package/esm/ed448.js +116 -132
  93. package/esm/ed448.js.map +1 -1
  94. package/esm/index.js +7 -9
  95. package/esm/index.js.map +1 -1
  96. package/esm/jubjub.d.ts +3 -3
  97. package/esm/jubjub.d.ts.map +1 -1
  98. package/esm/jubjub.js +3 -3
  99. package/esm/jubjub.js.map +1 -1
  100. package/esm/misc.d.ts +3 -5
  101. package/esm/misc.d.ts.map +1 -1
  102. package/esm/misc.js +0 -3
  103. package/esm/misc.js.map +1 -1
  104. package/esm/nist.d.ts +0 -6
  105. package/esm/nist.d.ts.map +1 -1
  106. package/esm/nist.js +31 -15
  107. package/esm/nist.js.map +1 -1
  108. package/esm/p256.d.ts +4 -0
  109. package/esm/p256.d.ts.map +1 -1
  110. package/esm/p256.js +4 -0
  111. package/esm/p256.js.map +1 -1
  112. package/esm/p384.d.ts +4 -1
  113. package/esm/p384.d.ts.map +1 -1
  114. package/esm/p384.js +4 -1
  115. package/esm/p384.js.map +1 -1
  116. package/esm/p521.d.ts +4 -0
  117. package/esm/p521.d.ts.map +1 -1
  118. package/esm/p521.js +4 -0
  119. package/esm/p521.js.map +1 -1
  120. package/esm/secp256k1.d.ts +32 -15
  121. package/esm/secp256k1.d.ts.map +1 -1
  122. package/esm/secp256k1.js +72 -67
  123. package/esm/secp256k1.js.map +1 -1
  124. package/esm/utils.d.ts +1 -1
  125. package/esm/utils.js +1 -1
  126. package/index.js +7 -9
  127. package/index.js.map +1 -1
  128. package/jubjub.d.ts +3 -3
  129. package/jubjub.d.ts.map +1 -1
  130. package/jubjub.js +3 -3
  131. package/jubjub.js.map +1 -1
  132. package/misc.d.ts +3 -5
  133. package/misc.d.ts.map +1 -1
  134. package/misc.js +0 -3
  135. package/misc.js.map +1 -1
  136. package/nist.d.ts +0 -6
  137. package/nist.d.ts.map +1 -1
  138. package/nist.js +31 -15
  139. package/nist.js.map +1 -1
  140. package/p256.d.ts +4 -0
  141. package/p256.d.ts.map +1 -1
  142. package/p256.js +4 -0
  143. package/p256.js.map +1 -1
  144. package/p384.d.ts +4 -1
  145. package/p384.d.ts.map +1 -1
  146. package/p384.js +4 -1
  147. package/p384.js.map +1 -1
  148. package/p521.d.ts +4 -0
  149. package/p521.d.ts.map +1 -1
  150. package/p521.js +4 -0
  151. package/p521.js.map +1 -1
  152. package/package.json +4 -2
  153. package/secp256k1.d.ts +32 -15
  154. package/secp256k1.d.ts.map +1 -1
  155. package/secp256k1.js +70 -65
  156. package/secp256k1.js.map +1 -1
  157. package/src/_shortw_utils.ts +1 -0
  158. package/src/abstract/bls.ts +319 -257
  159. package/src/abstract/curve.ts +226 -170
  160. package/src/abstract/edwards.ts +350 -139
  161. package/src/abstract/hash-to-curve.ts +33 -16
  162. package/src/abstract/modular.ts +86 -35
  163. package/src/abstract/montgomery.ts +36 -9
  164. package/src/abstract/tower.ts +4 -4
  165. package/src/abstract/weierstrass.ts +567 -474
  166. package/src/bls12-381.ts +28 -20
  167. package/src/ed25519.ts +161 -179
  168. package/src/ed448.ts +150 -156
  169. package/src/index.ts +7 -9
  170. package/src/jubjub.ts +3 -3
  171. package/src/misc.ts +3 -7
  172. package/src/nist.ts +40 -16
  173. package/src/p256.ts +4 -0
  174. package/src/p384.ts +4 -2
  175. package/src/p521.ts +4 -0
  176. package/src/secp256k1.ts +91 -73
  177. package/src/utils.ts +1 -1
  178. package/utils.d.ts +1 -1
  179. package/utils.js +1 -1
package/README.md CHANGED
@@ -5,11 +5,12 @@ Audited & minimal JS implementation of elliptic curve cryptography.
5
5
  - 🔒 [**Audited**](#security) by independent security firms
6
6
  - 🔻 Tree-shakeable: unused code is excluded from your builds
7
7
  - 🏎 Fast: hand-optimized for caveats of JS engines
8
- - 🔍 Reliable: cross-library / wycheproof tests and fuzzing ensure correctness
9
- - ➰ Short Weierstrass, Edwards, Montgomery curves
10
- - ✍️ ECDSA, EdDSA, Schnorr, BLS, ECDH, hashing to curves, Poseidon ZK-friendly hash
11
- - 🔖 SUF-CMA, SBS (non-repudiation), ZIP215 (consensus friendliness) features for ed25519 & ed448
12
- - 🪶 93KB (36KB gzipped) for everything with hashes, 26KB (11KB gzipped) for single-curve build
8
+ - 🔍 Reliable: tested against cross-library, wycheproof and acvp vectors
9
+ - ➰ Weierstrass, Edwards, Montgomery curves; ECDSA, EdDSA, Schnorr, BLS signatures
10
+ - ✍️ ECDH, hash-to-curve, OPRF, Poseidon ZK-friendly hash
11
+ - 🔖 Non-repudiation (SUF-CMA, SBS) & consensus-friendliness (ZIP215) in ed25519, ed448
12
+ - 🥈 Optional, friendly wrapper over native WebCrypto
13
+ - 🪶 36KB (gzipped) including bundled hashes, 11KB for single-curve build
13
14
 
14
15
  Curves have 4KB sister projects
15
16
  [secp256k1](https://github.com/paulmillr/noble-secp256k1) & [ed25519](https://github.com/paulmillr/noble-ed25519).
@@ -48,14 +49,14 @@ A standalone file [noble-curves.js](https://github.com/paulmillr/noble-curves/re
48
49
 
49
50
  ```ts
50
51
  // import * from '@noble/curves'; // Error: use sub-imports, to ensure small app size
51
- import { secp256k1, schnorr } from '@noble/curves/secp256k1';
52
- import { ed25519, ed25519ph, ed25519ctx, x25519 } from '@noble/curves/ed25519';
53
- import { ed448, ed448ph, ed448ctx, x448 } from '@noble/curves/ed448';
54
- import { p256, p384, p521 } from '@noble/curves/nist';
55
- import { bls12_381 } from '@noble/curves/bls12-381';
56
- import { bn254 } from '@noble/curves/bn254';
57
- import { jubjub, babyjubjub } from '@noble/curves/misc';
58
- import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/abstract/utils';
52
+ import { secp256k1, schnorr } from '@noble/curves/secp256k1.js';
53
+ import { ed25519, ed25519ph, ed25519ctx, x25519 } from '@noble/curves/ed25519.js';
54
+ import { ed448, ed448ph, ed448ctx, x448 } from '@noble/curves/ed448.js';
55
+ import { p256, p384, p521 } from '@noble/curves/nist.js';
56
+ import { bls12_381 } from '@noble/curves/bls12-381.js';
57
+ import { bn254 } from '@noble/curves/bn254.js';
58
+ import { jubjub, babyjubjub } from '@noble/curves/misc.js';
59
+ import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/abstract/utils.js';
59
60
  ```
60
61
 
61
62
  - [ECDSA signatures over secp256k1 and others](#ecdsa-signatures-over-secp256k1-and-others)
@@ -69,8 +70,12 @@ import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/
69
70
  - [misc curves](#misc-curves)
70
71
  - [Low-level methods](#low-level-methods)
71
72
  - [Abstract API](#abstract-api)
72
- - [weierstrass](#weierstrass-short-weierstrass-curve), [edwards](#edwards-twisted-edwards-curve), [montgomery](#montgomery-montgomery-curve), [bls](#bls-barreto-lynn-scott-curves)
73
- - [hash-to-curve](#hash-to-curve-hashing-strings-to-curve-points), [poseidon](#poseidon-poseidon-hash)
73
+ - [weierstrass](#weierstrass-short-weierstrass-curve), [Projective Point](#projective-weierstrass-point), [ECDSA signatures](#ecdsa-signatures)
74
+ - [edwards](#edwards-twisted-edwards-curve), [Extended Point](#extended-edwards-point), [EdDSA signatures](#eddsa-signatures)
75
+ - [montgomery](#montgomery-montgomery-curve)
76
+ - [bls](#bls-barreto-lynn-scott-curves)
77
+ - [hash-to-curve](#hash-to-curve-hashing-strings-to-curve-points)
78
+ - [poseidon](#poseidon-poseidon-hash)
74
79
  - [modular](#modular-modular-arithmetics-utilities)
75
80
  - [fft](#fft-fast-fourier-transform)
76
81
  - [Creating private keys from hashes](#creating-private-keys-from-hashes)
@@ -86,8 +91,8 @@ import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/
86
91
  #### ECDSA signatures over secp256k1 and others
87
92
 
88
93
  ```ts
89
- import { secp256k1 } from '@noble/curves/secp256k1';
90
- // import { p256 } from '@noble/curves/nist'; // or p384 / p521
94
+ import { secp256k1 } from '@noble/curves/secp256k1.js';
95
+ // import { p256 } from '@noble/curves/nist.js'; // or p384 / p521
91
96
 
92
97
  const priv = secp256k1.utils.randomPrivateKey();
93
98
  const pub = secp256k1.getPublicKey(priv);
@@ -134,7 +139,7 @@ const shared = secp256k1.getSharedSecret(priv, someonesPub);
134
139
  #### secp256k1 Schnorr signatures from BIP340
135
140
 
136
141
  ```ts
137
- import { schnorr } from '@noble/curves/secp256k1';
142
+ import { schnorr } from '@noble/curves/secp256k1.js';
138
143
  const priv = schnorr.utils.randomPrivateKey();
139
144
  const pub = schnorr.getPublicKey(priv);
140
145
  const msg = new TextEncoder().encode('hello');
@@ -145,7 +150,7 @@ const isValid = schnorr.verify(sig, msg, pub);
145
150
  #### ed25519
146
151
 
147
152
  ```ts
148
- import { ed25519 } from '@noble/curves/ed25519';
153
+ import { ed25519 } from '@noble/curves/ed25519.js';
149
154
  const priv = ed25519.utils.randomPrivateKey();
150
155
  const pub = ed25519.getPublicKey(priv);
151
156
  const msg = new TextEncoder().encode('hello');
@@ -154,7 +159,7 @@ ed25519.verify(sig, msg, pub); // Default mode: follows ZIP215
154
159
  ed25519.verify(sig, msg, pub, { zip215: false }); // SBS / e-voting / RFC8032 / FIPS 186-5
155
160
 
156
161
  // Variants from RFC8032: with context, prehashed
157
- import { ed25519ctx, ed25519ph } from '@noble/curves/ed25519';
162
+ import { ed25519ctx, ed25519ph } from '@noble/curves/ed25519.js';
158
163
  ```
159
164
 
160
165
  Default `verify` behavior follows ZIP215 and
@@ -167,7 +172,7 @@ Both options have SUF-CMA (strong unforgeability under chosen message attacks).
167
172
 
168
173
  ```ts
169
174
  // X25519 aka ECDH on Curve25519 from [RFC7748](https://www.rfc-editor.org/rfc/rfc7748)
170
- import { x25519 } from '@noble/curves/ed25519';
175
+ import { x25519 } from '@noble/curves/ed25519.js';
171
176
  const priv = 'a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4';
172
177
  const pub = 'e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c';
173
178
  x25519.getSharedSecret(priv, pub) === x25519.scalarMult(priv, pub); // aliases
@@ -175,7 +180,7 @@ x25519.getPublicKey(priv) === x25519.scalarMultBase(priv);
175
180
  x25519.getPublicKey(x25519.utils.randomPrivateKey());
176
181
 
177
182
  // ed25519 => x25519 conversion
178
- import { edwardsToMontgomeryPub, edwardsToMontgomeryPriv } from '@noble/curves/ed25519';
183
+ import { edwardsToMontgomeryPub, edwardsToMontgomeryPriv } from '@noble/curves/ed25519.js';
179
184
  edwardsToMontgomeryPub(ed25519.getPublicKey(ed25519.utils.randomPrivateKey()));
180
185
  edwardsToMontgomeryPriv(ed25519.utils.randomPrivateKey());
181
186
  ```
@@ -183,17 +188,15 @@ edwardsToMontgomeryPriv(ed25519.utils.randomPrivateKey());
183
188
  #### ristretto255
184
189
 
185
190
  ```ts
186
- // ristretto255 from [RFC9496](https://www.rfc-editor.org/rfc/rfc9496)
187
- import { utf8ToBytes } from '@noble/hashes/utils';
188
- import { sha512 } from '@noble/hashes/sha512';
191
+ import { sha512 } from '@noble/hashes/sha2.js';
189
192
  import {
190
193
  hashToCurve,
191
194
  encodeToCurve,
192
195
  RistrettoPoint,
193
196
  hashToRistretto255,
194
- } from '@noble/curves/ed25519';
197
+ } from '@noble/curves/ed25519.js';
195
198
 
196
- const msg = utf8ToBytes('Ristretto is traditionally a short shot of espresso coffee');
199
+ const msg = new TextEncoder().encode('Ristretto is traditionally a short shot of espresso coffee');
197
200
  hashToCurve(msg);
198
201
 
199
202
  const rp = RistrettoPoint.fromHex(
@@ -207,10 +210,12 @@ RistrettoPoint.hashToCurve(sha512(msg));
207
210
  hashToRistretto255(msg, { DST: 'ristretto255_XMD:SHA-512_R255MAP_RO_' });
208
211
  ```
209
212
 
213
+ Check out [RFC9496](https://www.rfc-editor.org/rfc/rfc9496) more info on ristretto255.
214
+
210
215
  #### ed448
211
216
 
212
217
  ```ts
213
- import { ed448 } from '@noble/curves/ed448';
218
+ import { ed448 } from '@noble/curves/ed448.js';
214
219
  const priv = ed448.utils.randomPrivateKey();
215
220
  const pub = ed448.getPublicKey(priv);
216
221
  const msg = new TextEncoder().encode('whatsup');
@@ -218,19 +223,19 @@ const sig = ed448.sign(msg, priv);
218
223
  ed448.verify(sig, msg, pub);
219
224
 
220
225
  // Variants from RFC8032: prehashed
221
- import { ed448ph } from '@noble/curves/ed448';
226
+ import { ed448ph } from '@noble/curves/ed448.js';
222
227
  ```
223
228
 
224
229
  #### X448
225
230
 
226
231
  ```ts
227
232
  // X448 aka ECDH on Curve448 from [RFC7748](https://www.rfc-editor.org/rfc/rfc7748)
228
- import { x448 } from '@noble/curves/ed448';
233
+ import { x448 } from '@noble/curves/ed448.js';
229
234
  x448.getSharedSecret(priv, pub) === x448.scalarMult(priv, pub); // aliases
230
235
  x448.getPublicKey(priv) === x448.scalarMultBase(priv);
231
236
 
232
237
  // ed448 => x448 conversion
233
- import { edwardsToMontgomeryPub } from '@noble/curves/ed448';
238
+ import { edwardsToMontgomeryPub } from '@noble/curves/ed448.js';
234
239
  edwardsToMontgomeryPub(ed448.getPublicKey(ed448.utils.randomPrivateKey()));
235
240
  ```
236
241
 
@@ -238,11 +243,10 @@ edwardsToMontgomeryPub(ed448.getPublicKey(ed448.utils.randomPrivateKey()));
238
243
 
239
244
  ```ts
240
245
  // decaf448 from [RFC9496](https://www.rfc-editor.org/rfc/rfc9496)
241
- import { utf8ToBytes } from '@noble/hashes/utils';
242
- import { shake256 } from '@noble/hashes/sha3';
243
- import { hashToCurve, encodeToCurve, DecafPoint, hashToDecaf448 } from '@noble/curves/ed448';
246
+ import { shake256 } from '@noble/hashes/sha3.js';
247
+ import { hashToCurve, encodeToCurve, DecafPoint, hashToDecaf448 } from '@noble/curves/ed448.js';
244
248
 
245
- const msg = utf8ToBytes('Ristretto is traditionally a short shot of espresso coffee');
249
+ const msg = new TextEncoder().encode('Ristretto is traditionally a short shot of espresso coffee');
246
250
  hashToCurve(msg);
247
251
 
248
252
  const dp = DecafPoint.fromHex(
@@ -256,11 +260,13 @@ DecafPoint.hashToCurve(shake256(msg, { dkLen: 112 }));
256
260
  hashToDecaf448(msg, { DST: 'decaf448_XOF:SHAKE256_D448MAP_RO_' });
257
261
  ```
258
262
 
263
+ Check out [RFC9496](https://www.rfc-editor.org/rfc/rfc9496) more info on decaf448.
264
+
259
265
  #### bls12-381
260
266
 
261
267
  ```ts
262
- import { bls12_381 } from '@noble/curves/bls12-381';
263
- import { hexToBytes, utf8ToBytes } from '@noble/curves/abstract/utils';
268
+ import { bls12_381 } from '@noble/curves/bls12-381.js';
269
+ import { hexToBytes } from '@noble/curves/abstract/utils.js';
264
270
 
265
271
  // private keys are 32 bytes
266
272
  const privKey = hexToBytes('67d53f170b908cabb9eb326c3c337762d59289a8fec79f7bc9254b584b73265c');
@@ -270,7 +276,7 @@ const privKey = hexToBytes('67d53f170b908cabb9eb326c3c337762d59289a8fec79f7bc925
270
276
  const blsl = bls12_381.longSignatures;
271
277
  const publicKey = blsl.getPublicKey(privateKey);
272
278
  // Sign msg with custom (Ethereum) DST
273
- const msg = utf8ToBytes('hello');
279
+ const msg = new TextEncoder().encode('hello');
274
280
  const DST = 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_';
275
281
  const msgp = blsl.hash(msg, DST);
276
282
  const signature = blsl.sign(msgp, privateKey);
@@ -280,7 +286,7 @@ console.log({ publicKey, signature, isValid });
280
286
  // Short signatures (G1), long public keys (G2)
281
287
  const blss = bls12_381.shortSignatures;
282
288
  const publicKey2 = blss.getPublicKey(privateKey);
283
- const msgp2 = blss.hash(utf8ToBytes('hello'), 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_')
289
+ const msgp2 = blss.hash(new TextEncoder().encode('hello'), 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_')
284
290
  const signature2 = blss.sign(msgp2, privateKey);
285
291
  const isValid2 = blss.verify(signature2, msgp2, publicKey);
286
292
  console.log({ publicKey2, signature2, isValid2 });
@@ -308,7 +314,7 @@ For example usage, check out [the implementation of BLS EVM precompiles](https:/
308
314
  #### bn254 aka alt_bn128
309
315
 
310
316
  ```ts
311
- import { bn254 } from '@noble/curves/bn254';
317
+ import { bn254 } from '@noble/curves/bn254.js';
312
318
 
313
319
  console.log(bn254.G1, bn254.G2, bn254.pairing);
314
320
  ```
@@ -331,109 +337,89 @@ For example usage, check out [the implementation of bn254 EVM precompiles](https
331
337
  #### misc curves
332
338
 
333
339
  ```ts
334
- import { jubjub, babyjubjub } from '@noble/curves/misc';
340
+ import { jubjub, babyjubjub } from '@noble/curves/misc.js';
335
341
  ```
336
342
 
337
343
  Miscellaneous, rarely used curves are contained in the module.
338
344
  Jubjub curves have Fp over scalar fields of other curves. They are friendly to ZK proofs.
339
345
  jubjub Fp = bls n. babyjubjub Fp = bn254 n.
340
346
 
341
- #### Low-level methods
342
-
343
- ```ts
344
- import { secp256k1 } from '@noble/curves/secp256k1';
345
-
346
- // Curve's variables
347
- // Every curve has `CURVE` object that contains its parameters, field, and others
348
- console.log(secp256k1.CURVE.p); // field modulus
349
- console.log(secp256k1.CURVE.n); // curve order
350
- console.log(secp256k1.CURVE.a, secp256k1.CURVE.b); // equation params
351
- console.log(secp256k1.CURVE.Gx, secp256k1.CURVE.Gy); // base point coordinates
352
-
353
- // MSM
354
- const p = secp256k1.ProjectivePoint;
355
- const points = [p.BASE, p.BASE.multiply(2n), p.BASE.multiply(4n), p.BASE.multiply(8n)];
356
- p.msm(points, [3n, 5n, 7n, 11n]).equals(p.BASE.multiply(129n)); // 129*G
357
- ```
358
-
359
- Multi-scalar-multiplication (MSM) is basically `(Pa + Qb + Rc + ...)`.
360
- It's 10-30x faster vs naive addition for large amount of points.
361
- Pippenger algorithm is used underneath.
362
-
363
347
  ## Abstract API
364
348
 
365
- Implementations use [noble-hashes](https://github.com/paulmillr/noble-hashes).
366
- If you want to use a different hashing library, abstract API doesn't depend on them.
367
-
368
349
  Abstract API allows to define custom curves. All arithmetics is done with JS
369
- bigints over finite fields, which is defined from `modular` sub-module. For
370
- scalar multiplication, we use
350
+ bigints over finite fields, which is defined from `modular` sub-module.
351
+ For scalar multiplication, we use
371
352
  [precomputed tables with w-ary non-adjacent form (wNAF)](https://paulmillr.com/posts/noble-secp256k1-fast-ecc/).
372
- Precomputes are enabled for weierstrass and edwards BASE points of a curve. You
373
- could precompute any other point (e.g. for ECDH) using `utils.precompute()`
374
- method: check out examples.
353
+ Precomputes are enabled for weierstrass and edwards BASE points of a curve.
354
+ Implementations use [noble-hashes](https://github.com/paulmillr/noble-hashes).
355
+ It's always possible to use different hashing library.
375
356
 
376
- ### weierstrass: Short Weierstrass curve
377
357
 
378
- ```ts
379
- import { weierstrass } from '@noble/curves/abstract/weierstrass';
380
- import { Field } from '@noble/curves/abstract/modular';
381
- import { sha256 } from '@noble/hashes/sha256';
382
- import { hmac } from '@noble/hashes/hmac';
383
- import { concatBytes, randomBytes } from '@noble/hashes/utils';
384
-
385
- const hmacSha256 = (key: Uint8Array, ...msgs: Uint8Array[]) =>
386
- hmac(sha256, key, concatBytes(...msgs));
387
-
388
- // secQ (not secP) - secq256k1 is a cycle of secp256k1 with Fp/N flipped.
389
- // https://personaelabs.org/posts/spartan-ecdsa
390
- // https://zcash.github.io/halo2/background/curves.html#cycles-of-curves
391
- const secq256k1 = weierstrass({
392
- a: 0n,
393
- b: 7n,
394
- Fp: Field(2n ** 256n - 432420386565659656852420866394968145599n),
395
- n: 2n ** 256n - 2n ** 32n - 2n ** 9n - 2n ** 8n - 2n ** 7n - 2n ** 6n - 2n ** 4n - 1n,
396
- Gx: 55066263022277343669578718895168534326250603453777594175500187360389116729240n,
397
- Gy: 32670510020758816978083085130507043184471273380659243275938904335757337482424n,
398
- hash: sha256,
399
- hmac: hmacSha256,
400
- randomBytes,
401
- });
358
+ ### weierstrass: Short Weierstrass curve
402
359
 
403
- // NIST secp192r1 aka p192
404
- // https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/secg/secp192r1
405
- const secp192r1 = weierstrass({
360
+ ```js
361
+ import { weierstrass } from '@noble/curves/abstract/weierstrass.js';
362
+ // NIST secp192r1 aka p192. https://www.secg.org/sec2-v2.pdf
363
+ const p192_CURVE = {
364
+ p: 0xfffffffffffffffffffffffffffffffeffffffffffffffffn,
365
+ n: 0xffffffffffffffffffffffff99def836146bc9b1b4d22831n,
366
+ h: 1n,
406
367
  a: 0xfffffffffffffffffffffffffffffffefffffffffffffffcn,
407
368
  b: 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1n,
408
- Fp: Field(0xfffffffffffffffffffffffffffffffeffffffffffffffffn),
409
- n: 0xffffffffffffffffffffffff99def836146bc9b1b4d22831n,
410
369
  Gx: 0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012n,
411
370
  Gy: 0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811n,
412
- hash: sha256,
413
- hmac: hmacSha256,
414
- randomBytes,
415
- });
371
+ };
372
+ const p192_Point = weierstrass(p192_CURVE);
416
373
  ```
417
374
 
418
375
  Short Weierstrass curve's formula is `y² = x³ + ax + b`. `weierstrass`
419
- expects arguments `a`, `b`, field `Fp`, curve order `n`, cofactor `h`
420
- and coordinates `Gx`, `Gy` of generator point.
421
- `hmac` and `hash` must be specified for deterministic `k` generation.
422
-
423
- **Weierstrass points:**
376
+ expects arguments `a`, `b`, field characteristic `p`, curve order `n`,
377
+ cofactor `h` and coordinates `Gx`, `Gy` of generator point.
378
+
379
+ #### Projective Weierstrass Point
380
+
381
+ ```js
382
+ // # weierstrass Point methods
383
+ // projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)
384
+ // const p = new Point(x, y, z);
385
+ const p = Point.BASE;
386
+ // arithmetics
387
+ p.add(p).equals(p.double());
388
+ p.subtract(p).equals(Point.ZERO);
389
+ p.negate();
390
+ p.multiply(31415n);
391
+
392
+ // decoding, encoding
393
+ const b = p.toBytes();
394
+ const p2 = Point.fromBytes(b);
395
+ // affine conversion
396
+ const { x, y } = p.toAffine();
397
+ const p3 = Point.fromAffine({ x, y });
398
+
399
+ // Multi-scalar-multiplication (MSM) is basically `(Pa + Qb + Rc + ...)`.
400
+ // It's 10-30x faster vs naive addition for large amount of points.
401
+ // Pippenger algorithm is used underneath.
402
+ const points = [Point.BASE, Point.BASE.multiply(2n), Point.BASE.multiply(4n), Point.BASE.multiply(8n)];
403
+ Point.msm(points, [3n, 5n, 7n, 11n]).equals(Point.BASE.multiply(129n)); // 129*G
404
+ ```
424
405
 
425
- - Are exported as `ProjectivePoint`
426
- - Are represented in projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)
427
- - Use complete exception-free formulas for addition and doubling
428
- - Can be decoded/encoded from/to Uint8Array / hex strings using
429
- `ProjectivePoint.fromHex` and `ProjectivePoint#toRawBytes()`
430
- - Have `assertValidity()` which checks for being on-curve
431
- - Have `toAffine()` and `x` / `y` getters which convert to 2d xy affine coordinates
406
+ #### ECDSA signatures
407
+
408
+ ```js
409
+ import { ecdsa } from '@noble/curves/abstract/weierstrass.js';
410
+ import { sha256 } from '@noble/hashes/sha2.js';
411
+ const p192 = ecdsa(p192_Point, sha256);
412
+ const priv = p192.utils.randomPrivateKey();
413
+ const pub = p192.getPublicKey(priv);
414
+ const msg = sha256(new TextEncoder().encode('custom curve'));
415
+ const sig = p192.sign(msg);
416
+ const isValid = p192.verify(sig, msg, pub);
417
+ ```
432
418
 
433
- **ECDSA signatures:**
419
+ ECDSA signatures:
434
420
 
435
421
  - Are represented by `Signature` instances with `r, s` and optional `recovery` properties
436
- - Have `recoverPublicKey()`, `toCompactRawBytes()` and `toDERRawBytes()` methods
422
+ - Have `recoverPublicKey()`, `toBytes()` with optional `format: 'compact' | 'der'`
437
423
  - Can be prehashed, or non-prehashed:
438
424
  - `sign(msgHash, privKey)` (default, prehash: false) - you did hashing before
439
425
  - `sign(msg, privKey, {prehash: true})` - curves will do hashing for you
@@ -441,85 +427,66 @@ and coordinates `Gx`, `Gy` of generator point.
441
427
  - Consider [hedged ECDSA with noise](#hedged-ecdsa-with-noise) for adding randomness into
442
428
  for signatures, to get improved security against fault attacks.
443
429
 
444
- More examples:
445
-
446
- ```typescript
447
- // All curves expose same generic interface.
448
- const priv = secq256k1.utils.randomPrivateKey();
449
- secq256k1.getPublicKey(priv); // Convert private key to public.
450
- const sig = secq256k1.sign(msg, priv); // Sign msg with private key.
451
- const sig2 = secq256k1.sign(msg, priv, { prehash: true }); // hash(msg)
452
- secq256k1.verify(sig, msg, priv); // Verify if sig is correct.
453
-
454
- // Default behavior is "try DER, then try compact if fails". Can be explicit:
455
- secq256k1.verify(sig.toCompactHex(), msg, priv, { format: 'compact' });
456
-
457
- const Point = secq256k1.ProjectivePoint;
458
- const point = Point.BASE; // Elliptic curve Point class and BASE point static var.
459
- point.add(point).equals(point.double()); // add(), equals(), double() methods
460
- point.subtract(point).equals(Point.ZERO); // subtract() method, ZERO static var
461
- point.negate(); // Flips point over x/y coordinate.
462
- point.multiply(31415n); // Multiplication of Point by scalar.
463
-
464
- point.assertValidity(); // Checks for being on-curve
465
- point.toAffine(); // Converts to 2d affine xy coordinates
466
-
467
- secq256k1.CURVE.n;
468
- secq256k1.CURVE.p;
469
- secq256k1.CURVE.Fp.mod();
470
- secq256k1.CURVE.hash();
471
-
472
- // precomputes
473
- const fast = secq256k1.utils.precompute(8, Point.fromHex(someonesPubKey));
474
- fast.multiply(privKey); // much faster ECDH now
475
- ```
476
-
477
430
  ### edwards: Twisted Edwards curve
478
431
 
479
432
  ```ts
480
- import { twistedEdwards } from '@noble/curves/abstract/edwards';
481
- import { Field } from '@noble/curves/abstract/modular';
482
- import { sha512 } from '@noble/hashes/sha512';
483
- import { randomBytes } from '@noble/hashes/utils';
484
-
485
- const Fp = Field(2n ** 255n - 19n);
486
- const ed25519 = twistedEdwards({
487
- a: Fp.create(-1n),
488
- d: Fp.div(-121665n, 121666n), // -121665n/121666n mod p
489
- Fp: Fp,
490
- n: 2n ** 252n + 27742317777372353535851937790883648493n,
433
+ import { edwards } from '@noble/curves/abstract/edwards.js';
434
+ const ed25519_CURVE = {
435
+ p: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,
436
+ n: 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,
491
437
  h: 8n,
492
- Gx: 15112221349535400772501151409588531511454012693041857206046113283949847762202n,
493
- Gy: 46316835694926478169428394003475163141307993866256225615783033603165251855960n,
494
- hash: sha512,
495
- randomBytes,
496
- adjustScalarBytes(bytes) {
497
- // optional; but mandatory in ed25519
498
- bytes[0] &= 248;
499
- bytes[31] &= 127;
500
- bytes[31] |= 64;
501
- return bytes;
502
- },
503
- } as const);
438
+ a: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,
439
+ d: 0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,
440
+ Gx: 0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,
441
+ Gy: 0x6666666666666666666666666666666666666666666666666666666666666658n,
442
+ };
443
+ const ed25519_Point = edwards(ed25519_CURVE);
504
444
  ```
505
445
 
506
446
  Twisted Edwards curve's formula is `ax² + y² = 1 + dx²y²`.
507
- You must specify `a`, `d`, field `Fp`, order `n`, cofactor `h`
508
- and coordinates `Gx`, `Gy` of generator point.
509
- For EdDSA signatures, `hash` param required.
510
- `adjustScalarBytes` which instructs how to change private scalars could be specified.
447
+ You must specify `a`, `d`, field characteristic `p`, curve order `n` (sometimes named as `L`),
448
+ cofactor `h` and coordinates `Gx`, `Gy` of generator point.
449
+
450
+ #### Extended Edwards Point
451
+
452
+ ```js
453
+ const Point = ed25519_Point;
454
+ // extended coordinates: (x, y, z, t) ∋ (x=x/z, y=y/z)
455
+ // const p = new Point(x, y, z, t);
456
+
457
+ const p = Point.BASE;
458
+ // arithmetics
459
+ p.add(p).equals(p.double());
460
+ p.subtract(p).equals(Point.ZERO);
461
+ p.negate();
462
+ p.multiply(31415n);
463
+
464
+ // decoding, encoding
465
+ const b = p.toBytes();
466
+ const p2 = Point.fromBytes(b);
467
+ // on-curve test
468
+ p.assertValidity();
469
+ // affine conversion
470
+ const { x, y } = p.toAffine();
471
+ const p3 = Point.fromAffine({ x, y });
472
+ // misc
473
+ const pcl = p.clearCofactor();
474
+ console.log(p.isTorsionFree(), p.isSmallOrder());
475
+ ```
476
+
477
+ #### EdDSA signatures
511
478
 
512
- **Edwards points:**
479
+ ```js
480
+ const ed25519 = eddsa(ed25519_Point, { hash: sha512 });
481
+ // ed25519.getPublicKey();
482
+ // ed25519.sign();
483
+ // ed25519.verify();
484
+ ```
513
485
 
514
- - Are exported as `ExtendedPoint`
515
- - Are represented in extended coordinates: (x, y, z, t) (x=x/z, y=y/z)
516
- - Use complete exception-free formulas for addition and doubling
517
- - Can be decoded/encoded from/to Uint8Array / hex strings using `ExtendedPoint.fromHex` and `ExtendedPoint#toRawBytes()`
518
- - Have `assertValidity()` which checks for being on-curve
519
- - Have `toAffine()` and `x` / `y` getters which convert to 2d xy affine coordinates
520
- - Have `isTorsionFree()`, `clearCofactor()` and `isSmallOrder()` utilities to handle torsions
486
+ We define ed25519, ed448; user can use custom curves with EdDSA,
487
+ but EdDSA in general is not defined. Check out `edwards.ts` source code.
521
488
 
522
- **EdDSA signatures:**
489
+ For EdDSA signatures:
523
490
 
524
491
  - `zip215: true` is default behavior. It has slightly looser verification logic
525
492
  to be [consensus-friendly](https://hdevalence.ca/blog/2020-10-04-its-25519am), following [ZIP215](https://zips.z.cash/zip-0215) rules
@@ -532,9 +499,6 @@ For EdDSA signatures, `hash` param required.
532
499
  - Blockchains: transaction of amount X might also be valid for a different amount Y
533
500
  - Both modes have SUF-CMA (strong unforgeability under chosen message attacks).
534
501
 
535
- Check out [RFC9496](https://www.rfc-editor.org/rfc/rfc9496) for description of
536
- ristretto and decaf groups which we implement.
537
-
538
502
  ### montgomery: Montgomery curve
539
503
 
540
504
  The module contains methods for x-only ECDH on Curve25519 / Curve448 from RFC7748.
@@ -562,13 +526,13 @@ The module allows to hash arbitrary strings to elliptic curve points. Implements
562
526
  Every curve has exported `hashToCurve` and `encodeToCurve` methods. You should always prefer `hashToCurve` for security:
563
527
 
564
528
  ```ts
565
- import { hashToCurve, encodeToCurve } from '@noble/curves/secp256k1';
566
- import { randomBytes } from '@noble/hashes/utils';
529
+ import { hashToCurve, encodeToCurve } from '@noble/curves/secp256k1.js';
530
+ import { randomBytes } from '@noble/hashes/utils.js';
567
531
  hashToCurve('0102abcd');
568
532
  console.log(hashToCurve(randomBytes()));
569
533
  console.log(encodeToCurve(randomBytes()));
570
534
 
571
- import { bls12_381 } from '@noble/curves/bls12-381';
535
+ import { bls12_381 } from '@noble/curves/bls12-381.js';
572
536
  bls12_381.G1.hashToCurve(randomBytes(), { DST: 'another' });
573
537
  bls12_381.G2.hashToCurve(randomBytes(), { DST: 'custom' });
574
538
  ```
@@ -620,10 +584,10 @@ permutation and sponge.
620
584
 
621
585
  There are many poseidon variants with different constants.
622
586
  We don't provide them: you should construct them manually.
623
- Check out [micro-starknet](https://github.com/paulmillr/micro-starknet) package for a proper example.
587
+ Check out [scure-starknet](https://github.com/paulmillr/scure-starknet) package for a proper example.
624
588
 
625
589
  ```ts
626
- import { poseidon, poseidonSponge } from '@noble/curves/abstract/poseidon';
590
+ import { poseidon, poseidonSponge } from '@noble/curves/abstract/poseidon.js';
627
591
 
628
592
  const rate = 2;
629
593
  const capacity = 1;
@@ -650,7 +614,7 @@ const sponge = poseidon.poseidonSponge(opts); // use carefully, not specced
650
614
  ### modular: Modular arithmetics utilities
651
615
 
652
616
  ```ts
653
- import * as mod from '@noble/curves/abstract/modular';
617
+ import * as mod from '@noble/curves/abstract/modular.js';
654
618
 
655
619
  // Finite Field utils
656
620
  const fp = mod.Field(2n ** 255n - 19n); // Finite field over 2^255-19
@@ -700,10 +664,10 @@ Use [abstract/hash-to-curve](#hash-to-curve-hashing-strings-to-curve-points)
700
664
  if you need to hash to **public key**.
701
665
 
702
666
  ```ts
703
- import { p256 } from '@noble/curves/nist';
704
- import { sha256 } from '@noble/hashes/sha256';
705
- import { hkdf } from '@noble/hashes/hkdf';
706
- import * as mod from '@noble/curves/abstract/modular';
667
+ import { p256 } from '@noble/curves/nist.js';
668
+ import { sha256 } from '@noble/hashes/sha2.js';
669
+ import { hkdf } from '@noble/hashes/hkdf.js';
670
+ import * as mod from '@noble/curves/abstract/modular.js';
707
671
  const someKey = new Uint8Array(32).fill(2); // Needs to actually be random, not .fill(2)
708
672
  const derived = hkdf(sha256, someKey, undefined, 'application', 48); // 48 bytes for 32-byte priv
709
673
  const validPrivateKey = mod.hashToPrivateScalar(derived, p256.CURVE.n);
@@ -712,7 +676,7 @@ const validPrivateKey = mod.hashToPrivateScalar(derived, p256.CURVE.n);
712
676
  ### utils: Useful utilities
713
677
 
714
678
  ```ts
715
- import * as utils from '@noble/curves/abstract/utils';
679
+ import * as utils from '@noble/curves/abstract/utils.js';
716
680
 
717
681
  utils.bytesToHex(Uint8Array.from([0xde, 0xad, 0xbe, 0xef]));
718
682
  utils.hexToBytes('deadbeef');
@@ -729,6 +693,11 @@ utils.nLength(255n);
729
693
  utils.equalBytes(Uint8Array.from([0xde]), Uint8Array.from([0xde]));
730
694
  ```
731
695
 
696
+ ### Unreleased bits
697
+
698
+ - `test/unreleased-xeddsa.ts` contains implementation of XEd25519, defined by Signal
699
+ - `test/misc/endomorphism.js` contains tool for generation of endomorphism params for Koblitz curves
700
+
732
701
  ## Security
733
702
 
734
703
  The library has been independently audited:
@@ -946,6 +915,17 @@ aggregateSignatures/2048 x 0 ops/sec @ 2823ms/op
946
915
 
947
916
  ## Upgrading
948
917
 
918
+ Supported node.js versions:
919
+
920
+ - v2: v20.19+ (ESM-only)
921
+ - v1: v14.21+ (ESM & CJS)
922
+
923
+ ### curves v1 => curves v2
924
+
925
+ WIP. Changelog of v2, when upgrading from curves v1.
926
+
927
+ ### noble-secp256k1 v1 => curves v1
928
+
949
929
  Previously, the library was split into single-feature packages
950
930
  [noble-secp256k1](https://github.com/paulmillr/noble-secp256k1),
951
931
  [noble-ed25519](https://github.com/paulmillr/noble-ed25519) and
@@ -955,10 +935,6 @@ Curves continue their original work. The single-feature packages changed their
955
935
  direction towards providing minimal 4kb implementations of cryptography,
956
936
  which means they have less features.
957
937
 
958
- Upgrading from noble-secp256k1 2.0 or noble-ed25519 2.0: no changes, libraries are compatible.
959
-
960
- Upgrading from noble-secp256k1 1.7:
961
-
962
938
  - `getPublicKey`
963
939
  - now produce 33-byte compressed signatures by default
964
940
  - to use old behavior, which produced 65-byte uncompressed keys, set
@@ -985,6 +961,8 @@ Upgrading from noble-secp256k1 1.7:
985
961
  - `utils` were split into `utils` (same api as in noble-curves) and
986
962
  `etc` (`hmacSha256Sync` and others)
987
963
 
964
+ ### noble-ed25519 v1 => curves v1
965
+
988
966
  Upgrading from [@noble/ed25519](https://github.com/paulmillr/noble-ed25519) 1.7:
989
967
 
990
968
  - Methods are now sync by default
@@ -996,6 +974,8 @@ Upgrading from [@noble/ed25519](https://github.com/paulmillr/noble-ed25519) 1.7:
996
974
  - `getSharedSecret` was moved to `x25519` module
997
975
  - `toX25519` has been moved to `edwardsToMontgomeryPub` and `edwardsToMontgomeryPriv` methods
998
976
 
977
+ ### noble-bls12-381 => curves v1
978
+
999
979
  Upgrading from [@noble/bls12-381](https://github.com/paulmillr/noble-bls12-381):
1000
980
 
1001
981
  - Methods and classes were renamed:
@@ -14,5 +14,6 @@ export type CurveDef = Readonly<Omit<CurveType, 'hash'>>;
14
14
  export type CurveFnWithCreate = CurveFn & {
15
15
  create: (hash: CHash) => CurveFn;
16
16
  };
17
+ /** @deprecated use new `weierstrass()` and `ecdsa()` methods */
17
18
  export declare function createCurve(curveDef: CurveDef, defHash: CHash): CurveFnWithCreate;
18
19
  //# sourceMappingURL=_shortw_utils.d.ts.map