@noble/curves 1.8.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.md +17 -14
  2. package/_shortw_utils.d.ts +2 -2
  3. package/_shortw_utils.d.ts.map +1 -1
  4. package/_shortw_utils.js.map +1 -1
  5. package/abstract/bls.d.ts +5 -5
  6. package/abstract/bls.d.ts.map +1 -1
  7. package/abstract/bls.js.map +1 -1
  8. package/abstract/curve.d.ts +1 -1
  9. package/abstract/curve.d.ts.map +1 -1
  10. package/abstract/curve.js.map +1 -1
  11. package/abstract/edwards.d.ts +2 -2
  12. package/abstract/edwards.d.ts.map +1 -1
  13. package/abstract/edwards.js.map +1 -1
  14. package/abstract/hash-to-curve.d.ts +1 -1
  15. package/abstract/hash-to-curve.d.ts.map +1 -1
  16. package/abstract/hash-to-curve.js.map +1 -1
  17. package/abstract/poseidon.d.ts +1 -1
  18. package/abstract/poseidon.d.ts.map +1 -1
  19. package/abstract/poseidon.js.map +1 -1
  20. package/abstract/weierstrass.d.ts +5 -5
  21. package/abstract/weierstrass.d.ts.map +1 -1
  22. package/abstract/weierstrass.js +8 -8
  23. package/abstract/weierstrass.js.map +1 -1
  24. package/bls12-381.d.ts +1 -1
  25. package/bls12-381.d.ts.map +1 -1
  26. package/bls12-381.js +14 -15
  27. package/bls12-381.js.map +1 -1
  28. package/bn254.d.ts +2 -2
  29. package/bn254.d.ts.map +1 -1
  30. package/bn254.js +3 -4
  31. package/bn254.js.map +1 -1
  32. package/ed25519.d.ts +5 -5
  33. package/ed25519.d.ts.map +1 -1
  34. package/ed25519.js +1 -1
  35. package/ed25519.js.map +1 -1
  36. package/ed448.d.ts +5 -5
  37. package/ed448.d.ts.map +1 -1
  38. package/ed448.js +1 -1
  39. package/ed448.js.map +1 -1
  40. package/esm/_shortw_utils.d.ts +2 -2
  41. package/esm/_shortw_utils.d.ts.map +1 -1
  42. package/esm/_shortw_utils.js.map +1 -1
  43. package/esm/abstract/bls.d.ts +5 -5
  44. package/esm/abstract/bls.d.ts.map +1 -1
  45. package/esm/abstract/bls.js.map +1 -1
  46. package/esm/abstract/curve.d.ts +1 -1
  47. package/esm/abstract/curve.d.ts.map +1 -1
  48. package/esm/abstract/curve.js +2 -2
  49. package/esm/abstract/curve.js.map +1 -1
  50. package/esm/abstract/edwards.d.ts +2 -2
  51. package/esm/abstract/edwards.d.ts.map +1 -1
  52. package/esm/abstract/edwards.js +3 -3
  53. package/esm/abstract/edwards.js.map +1 -1
  54. package/esm/abstract/hash-to-curve.d.ts +1 -1
  55. package/esm/abstract/hash-to-curve.d.ts.map +1 -1
  56. package/esm/abstract/hash-to-curve.js.map +1 -1
  57. package/esm/abstract/poseidon.d.ts +1 -1
  58. package/esm/abstract/poseidon.d.ts.map +1 -1
  59. package/esm/abstract/poseidon.js.map +1 -1
  60. package/esm/abstract/weierstrass.d.ts +5 -5
  61. package/esm/abstract/weierstrass.d.ts.map +1 -1
  62. package/esm/abstract/weierstrass.js +10 -10
  63. package/esm/abstract/weierstrass.js.map +1 -1
  64. package/esm/bls12-381.d.ts +1 -1
  65. package/esm/bls12-381.d.ts.map +1 -1
  66. package/esm/bls12-381.js +14 -15
  67. package/esm/bls12-381.js.map +1 -1
  68. package/esm/bn254.d.ts +2 -2
  69. package/esm/bn254.d.ts.map +1 -1
  70. package/esm/bn254.js +3 -4
  71. package/esm/bn254.js.map +1 -1
  72. package/esm/ed25519.d.ts +5 -5
  73. package/esm/ed25519.d.ts.map +1 -1
  74. package/esm/ed25519.js +1 -1
  75. package/esm/ed25519.js.map +1 -1
  76. package/esm/ed448.d.ts +5 -5
  77. package/esm/ed448.d.ts.map +1 -1
  78. package/esm/ed448.js +1 -1
  79. package/esm/ed448.js.map +1 -1
  80. package/esm/index.js +13 -1
  81. package/esm/index.js.map +1 -1
  82. package/esm/jubjub.d.ts +1 -1
  83. package/esm/jubjub.d.ts.map +1 -1
  84. package/esm/jubjub.js.map +1 -1
  85. package/esm/p256.d.ts +2 -2
  86. package/esm/p256.d.ts.map +1 -1
  87. package/esm/p256.js.map +1 -1
  88. package/esm/p384.d.ts +2 -2
  89. package/esm/p384.d.ts.map +1 -1
  90. package/esm/p384.js.map +1 -1
  91. package/esm/p521.d.ts +2 -2
  92. package/esm/p521.d.ts.map +1 -1
  93. package/esm/p521.js.map +1 -1
  94. package/esm/pasta.d.ts +1 -1
  95. package/esm/pasta.d.ts.map +1 -1
  96. package/esm/pasta.js.map +1 -1
  97. package/esm/secp256k1.d.ts +3 -3
  98. package/esm/secp256k1.d.ts.map +1 -1
  99. package/esm/secp256k1.js +1 -1
  100. package/esm/secp256k1.js.map +1 -1
  101. package/index.js +13 -1
  102. package/index.js.map +1 -1
  103. package/jubjub.d.ts +1 -1
  104. package/jubjub.d.ts.map +1 -1
  105. package/jubjub.js.map +1 -1
  106. package/p256.d.ts +2 -2
  107. package/p256.d.ts.map +1 -1
  108. package/p256.js.map +1 -1
  109. package/p384.d.ts +2 -2
  110. package/p384.d.ts.map +1 -1
  111. package/p384.js.map +1 -1
  112. package/p521.d.ts +2 -2
  113. package/p521.d.ts.map +1 -1
  114. package/p521.js.map +1 -1
  115. package/package.json +10 -9
  116. package/pasta.d.ts +1 -1
  117. package/pasta.d.ts.map +1 -1
  118. package/pasta.js.map +1 -1
  119. package/secp256k1.d.ts +3 -3
  120. package/secp256k1.d.ts.map +1 -1
  121. package/secp256k1.js.map +1 -1
  122. package/src/_shortw_utils.ts +2 -2
  123. package/src/abstract/bls.ts +9 -7
  124. package/src/abstract/curve.ts +2 -2
  125. package/src/abstract/edwards.ts +7 -7
  126. package/src/abstract/hash-to-curve.ts +1 -1
  127. package/src/abstract/poseidon.ts +1 -1
  128. package/src/abstract/weierstrass.ts +24 -16
  129. package/src/bls12-381.ts +28 -26
  130. package/src/bn254.ts +7 -9
  131. package/src/ed25519.ts +6 -7
  132. package/src/ed448.ts +7 -7
  133. package/src/index.ts +13 -1
  134. package/src/jubjub.ts +1 -1
  135. package/src/p256.ts +2 -2
  136. package/src/p384.ts +2 -2
  137. package/src/p521.ts +2 -2
  138. package/src/pasta.ts +1 -1
  139. package/src/secp256k1.ts +4 -4
@@ -26,17 +26,25 @@
26
26
  */
27
27
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
28
28
  import {
29
- AffinePoint,
30
- BasicCurve,
31
- Group,
32
- GroupConstructor,
29
+ type AffinePoint,
30
+ type BasicCurve,
31
+ type Group,
32
+ type GroupConstructor,
33
+ pippenger,
33
34
  validateBasic,
34
35
  wNAF,
35
- pippenger,
36
36
  } from './curve.js';
37
- import * as mod from './modular.js';
37
+ import {
38
+ Field,
39
+ type IField,
40
+ getMinHashLength,
41
+ invert,
42
+ mapHashToField,
43
+ mod,
44
+ validateField,
45
+ } from './modular.js';
38
46
  import * as ut from './utils.js';
39
- import { CHash, Hex, PrivKey, ensureBytes, memoized, abool } from './utils.js';
47
+ import { type CHash, type Hex, type PrivKey, abool, ensureBytes, memoized } from './utils.js';
40
48
 
41
49
  export type { AffinePoint };
42
50
  type HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
@@ -279,7 +287,7 @@ const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n =
279
287
  export function weierstrassPoints<T>(opts: CurvePointsType<T>): CurvePointsRes<T> {
280
288
  const CURVE = validatePointOpts(opts);
281
289
  const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ
282
- const Fn = mod.Field(CURVE.n, CURVE.nBitLength);
290
+ const Fn = Field(CURVE.n, CURVE.nBitLength);
283
291
 
284
292
  const toBytes =
285
293
  CURVE.toBytes ||
@@ -341,7 +349,7 @@ export function weierstrassPoints<T>(opts: CurvePointsType<T>): CurvePointsRes<T
341
349
  'invalid private key, expected hex or ' + nByteLength + ' bytes, got ' + typeof key
342
350
  );
343
351
  }
344
- if (wrapPrivateKey) num = mod.mod(num, N); // disabled by default, enabled for BLS
352
+ if (wrapPrivateKey) num = mod(num, N); // disabled by default, enabled for BLS
345
353
  ut.aInRange('private key', num, _1n, N); // num in range [1..N-1]
346
354
  return num;
347
355
  }
@@ -815,10 +823,10 @@ export function weierstrass(curveDef: CurveType): CurveFn {
815
823
  const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32
816
824
 
817
825
  function modN(a: bigint) {
818
- return mod.mod(a, CURVE_ORDER);
826
+ return mod(a, CURVE_ORDER);
819
827
  }
820
828
  function invN(a: bigint) {
821
- return mod.invert(a, CURVE_ORDER);
829
+ return invert(a, CURVE_ORDER);
822
830
  }
823
831
 
824
832
  const {
@@ -982,8 +990,8 @@ export function weierstrass(curveDef: CurveType): CurveFn {
982
990
  * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.
983
991
  */
984
992
  randomPrivateKey: (): Uint8Array => {
985
- const length = mod.getMinHashLength(CURVE.n);
986
- return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n);
993
+ const length = getMinHashLength(CURVE.n);
994
+ return mapHashToField(CURVE.randomBytes(length), CURVE.n);
987
995
  },
988
996
 
989
997
  /**
@@ -1245,7 +1253,7 @@ export function weierstrass(curveDef: CurveType): CurveFn {
1245
1253
  * @returns
1246
1254
  */
1247
1255
  export function SWUFpSqrtRatio<T>(
1248
- Fp: mod.IField<T>,
1256
+ Fp: IField<T>,
1249
1257
  Z: T
1250
1258
  ): (u: T, v: T) => { isValid: boolean; value: T } {
1251
1259
  // Generic implementation
@@ -1320,14 +1328,14 @@ export function SWUFpSqrtRatio<T>(
1320
1328
  * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2
1321
1329
  */
1322
1330
  export function mapToCurveSimpleSWU<T>(
1323
- Fp: mod.IField<T>,
1331
+ Fp: IField<T>,
1324
1332
  opts: {
1325
1333
  A: T;
1326
1334
  B: T;
1327
1335
  Z: T;
1328
1336
  }
1329
1337
  ): (u: T) => { x: T; y: T } {
1330
- mod.validateField(Fp);
1338
+ validateField(Fp);
1331
1339
  if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))
1332
1340
  throw new Error('mapToCurveSimpleSWU: invalid opts');
1333
1341
  const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z);
package/src/bls12-381.ts CHANGED
@@ -1,24 +1,3 @@
1
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
- import { sha256 } from '@noble/hashes/sha256';
3
- import { randomBytes } from '@noble/hashes/utils';
4
- import { bls, CurveFn } from './abstract/bls.js';
5
- import * as mod from './abstract/modular.js';
6
- import {
7
- bitGet,
8
- bitLen,
9
- bytesToHex,
10
- bytesToNumberBE,
11
- concatBytes as concatB,
12
- ensureBytes,
13
- Hex,
14
- numberToBytesBE,
15
- } from './abstract/utils.js';
16
- // Types
17
- import { isogenyMap } from './abstract/hash-to-curve.js';
18
- import { AffinePoint, mapToCurveSimpleSWU, ProjPointType } from './abstract/weierstrass.js';
19
- import { tower12, psiFrobenius } from './abstract/tower.js';
20
- import type { Fp, Fp2, Fp6, Fp12 } from './abstract/tower.js';
21
-
22
1
  /**
23
2
  * bls12-381 is pairing-friendly Barreto-Lynn-Scott elliptic curve construction allowing to:
24
3
  * * Construct zk-SNARKs at the ~120-bit security
@@ -58,11 +37,6 @@ import type { Fp, Fp2, Fp6, Fp12 } from './abstract/tower.js';
58
37
  * Basic math is done over finite fields over p.
59
38
  * More complicated math is done over polynominal extension fields.
60
39
  * To simplify calculations in Fp12, we construct extension tower:
61
- * - Fp₁₂ = Fp₆² => Fp₂³
62
- * - Fp(u) / (u² - β) where β = -1
63
- * - Fp₂(v) / (v³ - ξ) where ξ = u + 1
64
- * - Fp₆(w) / (w² - γ) where γ = v
65
- * Here goes constants && point encoding format
66
40
  *
67
41
  * Embedding degree (k): 12
68
42
  * Seed (X): -15132376222941642752
@@ -73,6 +47,10 @@ import type { Fp, Fp2, Fp6, Fp12 } from './abstract/tower.js';
73
47
  * Ate loop size: X
74
48
  *
75
49
  * ### Towers
50
+ * - Fp₁₂ = Fp₆² => Fp₂³
51
+ * - Fp(u) / (u² - β) where β = -1
52
+ * - Fp₂(v) / (v³ - ξ) where ξ = u + 1
53
+ * - Fp₆(w) / (w² - γ) where γ = v
76
54
  * - Fp²[u] = Fp/u²+1
77
55
  * - Fp⁶[v] = Fp²/v³-1-u
78
56
  * - Fp¹²[w] = Fp⁶/w²-v
@@ -80,6 +58,30 @@ import type { Fp, Fp2, Fp6, Fp12 } from './abstract/tower.js';
80
58
  * @todo construct bls & bn fp/fr from seed.
81
59
  * @module
82
60
  */
61
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
62
+ import { sha256 } from '@noble/hashes/sha256';
63
+ import { randomBytes } from '@noble/hashes/utils';
64
+ import { bls, type CurveFn } from './abstract/bls.js';
65
+ import * as mod from './abstract/modular.js';
66
+ import {
67
+ bitGet,
68
+ bitLen,
69
+ bytesToHex,
70
+ bytesToNumberBE,
71
+ concatBytes as concatB,
72
+ ensureBytes,
73
+ type Hex,
74
+ numberToBytesBE,
75
+ } from './abstract/utils.js';
76
+ // Types
77
+ import { isogenyMap } from './abstract/hash-to-curve.js';
78
+ import type { Fp, Fp12, Fp2, Fp6 } from './abstract/tower.js';
79
+ import { psiFrobenius, tower12 } from './abstract/tower.js';
80
+ import {
81
+ type AffinePoint,
82
+ mapToCurveSimpleSWU,
83
+ type ProjPointType,
84
+ } from './abstract/weierstrass.js';
83
85
 
84
86
  // Be friendly to bad ECMAScript parsers by not using bigint literals
85
87
  // prettier-ignore
package/src/bn254.ts CHANGED
@@ -46,23 +46,21 @@ Ate loop size: 6x+2
46
46
  */
47
47
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
48
48
  import { sha256 } from '@noble/hashes/sha256';
49
- import { getHash } from './_shortw_utils.js';
50
- import { CurveFn, weierstrass } from './abstract/weierstrass.js';
51
49
  import { randomBytes } from '@noble/hashes/utils';
50
+ import { getHash } from './_shortw_utils.js';
52
51
  import {
53
52
  bls,
54
- CurveFn as BLSCurveFn,
55
- PostPrecomputeFn,
56
- PostPrecomputePointAddFn,
53
+ type CurveFn as BLSCurveFn,
54
+ type PostPrecomputeFn,
55
+ type PostPrecomputePointAddFn,
57
56
  } from './abstract/bls.js';
58
57
  import { Field } from './abstract/modular.js';
58
+ import type { Fp, Fp12, Fp2, Fp6 } from './abstract/tower.js';
59
+ import { psiFrobenius, tower12 } from './abstract/tower.js';
59
60
  import { bitGet, bitLen, notImplemented } from './abstract/utils.js';
60
- import { tower12, psiFrobenius } from './abstract/tower.js';
61
- // Types
62
- import type { Fp, Fp2, Fp6, Fp12 } from './abstract/tower.js';
61
+ import { type CurveFn, weierstrass } from './abstract/weierstrass.js';
63
62
  // prettier-ignore
64
63
  const _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);
65
- // prettier-ignore
66
64
  const _6n = BigInt(6);
67
65
 
68
66
  const BN_X = BigInt('4965661367192848881');
package/src/ed25519.ts CHANGED
@@ -8,23 +8,22 @@
8
8
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
9
9
  import { sha512 } from '@noble/hashes/sha512';
10
10
  import { concatBytes, randomBytes, utf8ToBytes } from '@noble/hashes/utils';
11
- import { AffinePoint, Group } from './abstract/curve.js';
12
- import { CurveFn, ExtPointType, twistedEdwards } from './abstract/edwards.js';
11
+ import { type AffinePoint, type Group, pippenger } from './abstract/curve.js';
12
+ import { type CurveFn, type ExtPointType, twistedEdwards } from './abstract/edwards.js';
13
13
  import {
14
14
  createHasher,
15
15
  expand_message_xmd,
16
- htfBasicOpts,
17
- HTFMethod,
16
+ type htfBasicOpts,
17
+ type HTFMethod,
18
18
  } from './abstract/hash-to-curve.js';
19
19
  import { Field, FpSqrtEven, isNegativeLE, mod, pow2 } from './abstract/modular.js';
20
- import { CurveFn as XCurveFn, montgomery } from './abstract/montgomery.js';
21
- import { pippenger } from './abstract/curve.js';
20
+ import { montgomery, type CurveFn as XCurveFn } from './abstract/montgomery.js';
22
21
  import {
23
22
  bytesToHex,
24
23
  bytesToNumberLE,
25
24
  ensureBytes,
26
25
  equalBytes,
27
- Hex,
26
+ type Hex,
28
27
  numberToBytesLE,
29
28
  } from './abstract/utils.js';
30
29
 
package/src/ed448.ts CHANGED
@@ -9,23 +9,23 @@
9
9
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
10
10
  import { shake256 } from '@noble/hashes/sha3';
11
11
  import { concatBytes, randomBytes, utf8ToBytes, wrapConstructor } from '@noble/hashes/utils';
12
- import { AffinePoint, Group } from './abstract/curve.js';
13
- import { CurveFn, ExtPointType, twistedEdwards } from './abstract/edwards.js';
12
+ import type { AffinePoint, Group } from './abstract/curve.js';
13
+ import { pippenger } from './abstract/curve.js';
14
+ import { type CurveFn, type ExtPointType, twistedEdwards } from './abstract/edwards.js';
14
15
  import {
15
16
  createHasher,
16
17
  expand_message_xof,
17
- htfBasicOpts,
18
- HTFMethod,
18
+ type htfBasicOpts,
19
+ type HTFMethod,
19
20
  } from './abstract/hash-to-curve.js';
20
21
  import { Field, isNegativeLE, mod, pow2 } from './abstract/modular.js';
21
- import { CurveFn as XCurveFn, montgomery } from './abstract/montgomery.js';
22
- import { pippenger } from './abstract/curve.js';
22
+ import { montgomery, type CurveFn as XCurveFn } from './abstract/montgomery.js';
23
23
  import {
24
24
  bytesToHex,
25
25
  bytesToNumberLE,
26
26
  ensureBytes,
27
27
  equalBytes,
28
- Hex,
28
+ type Hex,
29
29
  numberToBytesLE,
30
30
  } from './abstract/utils.js';
31
31
 
package/src/index.ts CHANGED
@@ -1,5 +1,17 @@
1
1
  /**
2
- * Audited & minimal JS implementation of elliptic curve cryptography. Check out individual modules.
2
+ * Audited & minimal JS implementation of elliptic curve cryptography.
3
3
  * @module
4
+ * @example
5
+ ```js
6
+ import { secp256k1, schnorr } from '@noble/curves/secp256k1';
7
+ import { ed25519, ed25519ph, ed25519ctx, x25519, RistrettoPoint } from '@noble/curves/ed25519';
8
+ import { ed448, ed448ph, ed448ctx, x448 } from '@noble/curves/ed448';
9
+ import { p256 } from '@noble/curves/p256';
10
+ import { p384 } from '@noble/curves/p384';
11
+ import { p521 } from '@noble/curves/p521';
12
+ import { bls12_381 } from '@noble/curves/bls12-381';
13
+ import { bn254 } from '@noble/curves/bn254';
14
+ import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/abstract/utils';
15
+ ```
4
16
  */
5
17
  throw new Error('root module cannot be imported: import submodules instead. Check out README');
package/src/jubjub.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  import { blake2s } from '@noble/hashes/blake2s';
9
9
  import { sha512 } from '@noble/hashes/sha512';
10
10
  import { concatBytes, randomBytes, utf8ToBytes } from '@noble/hashes/utils';
11
- import { CurveFn, ExtPointType, twistedEdwards } from './abstract/edwards.js';
11
+ import { type CurveFn, type ExtPointType, twistedEdwards } from './abstract/edwards.js';
12
12
  import { Field } from './abstract/modular.js';
13
13
 
14
14
  export const jubjub: CurveFn = /* @__PURE__ */ twistedEdwards({
package/src/p256.ts CHANGED
@@ -5,8 +5,8 @@
5
5
  */
6
6
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
7
7
  import { sha256 } from '@noble/hashes/sha256';
8
- import { createCurve, CurveFnWithCreate } from './_shortw_utils.js';
9
- import { createHasher, HTFMethod } from './abstract/hash-to-curve.js';
8
+ import { createCurve, type CurveFnWithCreate } from './_shortw_utils.js';
9
+ import { createHasher, type HTFMethod } from './abstract/hash-to-curve.js';
10
10
  import { Field } from './abstract/modular.js';
11
11
  import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';
12
12
 
package/src/p384.ts CHANGED
@@ -5,8 +5,8 @@
5
5
  */
6
6
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
7
7
  import { sha384 } from '@noble/hashes/sha512';
8
- import { createCurve, CurveFnWithCreate } from './_shortw_utils.js';
9
- import { createHasher, HTFMethod } from './abstract/hash-to-curve.js';
8
+ import { createCurve, type CurveFnWithCreate } from './_shortw_utils.js';
9
+ import { createHasher, type HTFMethod } from './abstract/hash-to-curve.js';
10
10
  import { Field } from './abstract/modular.js';
11
11
  import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';
12
12
 
package/src/p521.ts CHANGED
@@ -6,8 +6,8 @@
6
6
  */
7
7
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
8
8
  import { sha512 } from '@noble/hashes/sha512';
9
- import { createCurve, CurveFnWithCreate } from './_shortw_utils.js';
10
- import { createHasher, HTFMethod } from './abstract/hash-to-curve.js';
9
+ import { createCurve, type CurveFnWithCreate } from './_shortw_utils.js';
10
+ import { createHasher, type HTFMethod } from './abstract/hash-to-curve.js';
11
11
  import { Field } from './abstract/modular.js';
12
12
  import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';
13
13
 
package/src/pasta.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  import { sha256 } from '@noble/hashes/sha256';
7
7
  import { getHash } from './_shortw_utils.js';
8
8
  import { Field, mod } from './abstract/modular.js';
9
- import { CurveFn, weierstrass } from './abstract/weierstrass.js';
9
+ import { type CurveFn, weierstrass } from './abstract/weierstrass.js';
10
10
 
11
11
  export const p: bigint = BigInt(
12
12
  '0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001'
package/src/secp256k1.ts CHANGED
@@ -13,19 +13,19 @@
13
13
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
14
14
  import { sha256 } from '@noble/hashes/sha256';
15
15
  import { randomBytes } from '@noble/hashes/utils';
16
- import { createCurve, CurveFnWithCreate } from './_shortw_utils.js';
17
- import { createHasher, HTFMethod, isogenyMap } from './abstract/hash-to-curve.js';
16
+ import { createCurve, type CurveFnWithCreate } from './_shortw_utils.js';
17
+ import { createHasher, type HTFMethod, isogenyMap } from './abstract/hash-to-curve.js';
18
18
  import { Field, mod, pow2 } from './abstract/modular.js';
19
19
  import type { Hex, PrivKey } from './abstract/utils.js';
20
20
  import {
21
- inRange,
22
21
  aInRange,
23
22
  bytesToNumberBE,
24
23
  concatBytes,
25
24
  ensureBytes,
25
+ inRange,
26
26
  numberToBytesBE,
27
27
  } from './abstract/utils.js';
28
- import { ProjPointType as PointType, mapToCurveSimpleSWU } from './abstract/weierstrass.js';
28
+ import { mapToCurveSimpleSWU, type ProjPointType as PointType } from './abstract/weierstrass.js';
29
29
 
30
30
  const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');
31
31
  const secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141');