@noble/curves 1.2.0 → 1.3.0

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 (89) hide show
  1. package/README.md +125 -191
  2. package/abstract/bls.d.ts +27 -10
  3. package/abstract/bls.d.ts.map +1 -1
  4. package/abstract/bls.js +58 -8
  5. package/abstract/bls.js.map +1 -1
  6. package/abstract/curve.js.map +1 -1
  7. package/abstract/edwards.js.map +1 -1
  8. package/abstract/hash-to-curve.d.ts +1 -1
  9. package/abstract/hash-to-curve.d.ts.map +1 -1
  10. package/abstract/hash-to-curve.js +8 -8
  11. package/abstract/hash-to-curve.js.map +1 -1
  12. package/abstract/modular.js.map +1 -1
  13. package/abstract/montgomery.d.ts.map +1 -1
  14. package/abstract/montgomery.js +5 -7
  15. package/abstract/montgomery.js.map +1 -1
  16. package/abstract/poseidon.js.map +1 -1
  17. package/abstract/utils.d.ts +2 -1
  18. package/abstract/utils.d.ts.map +1 -1
  19. package/abstract/utils.js +55 -31
  20. package/abstract/utils.js.map +1 -1
  21. package/abstract/weierstrass.d.ts +23 -27
  22. package/abstract/weierstrass.d.ts.map +1 -1
  23. package/abstract/weierstrass.js +4 -4
  24. package/abstract/weierstrass.js.map +1 -1
  25. package/bls12-381.d.ts.map +1 -1
  26. package/bls12-381.js +137 -82
  27. package/bls12-381.js.map +1 -1
  28. package/bn254.d.ts +3 -2
  29. package/bn254.d.ts.map +1 -1
  30. package/bn254.js +3 -2
  31. package/bn254.js.map +1 -1
  32. package/ed25519.d.ts +4 -2
  33. package/ed25519.d.ts.map +1 -1
  34. package/ed25519.js +8 -2
  35. package/ed25519.js.map +1 -1
  36. package/ed448.d.ts +4 -2
  37. package/ed448.d.ts.map +1 -1
  38. package/ed448.js +10 -1
  39. package/ed448.js.map +1 -1
  40. package/esm/abstract/bls.js +58 -8
  41. package/esm/abstract/bls.js.map +1 -1
  42. package/esm/abstract/curve.js.map +1 -1
  43. package/esm/abstract/edwards.js.map +1 -1
  44. package/esm/abstract/hash-to-curve.js +9 -9
  45. package/esm/abstract/hash-to-curve.js.map +1 -1
  46. package/esm/abstract/modular.js.map +1 -1
  47. package/esm/abstract/montgomery.js +5 -7
  48. package/esm/abstract/montgomery.js.map +1 -1
  49. package/esm/abstract/poseidon.js.map +1 -1
  50. package/esm/abstract/utils.js +53 -30
  51. package/esm/abstract/utils.js.map +1 -1
  52. package/esm/abstract/weierstrass.js +4 -4
  53. package/esm/abstract/weierstrass.js.map +1 -1
  54. package/esm/bls12-381.js +138 -83
  55. package/esm/bls12-381.js.map +1 -1
  56. package/esm/bn254.js +3 -2
  57. package/esm/bn254.js.map +1 -1
  58. package/esm/ed25519.js +8 -2
  59. package/esm/ed25519.js.map +1 -1
  60. package/esm/ed448.js +10 -1
  61. package/esm/ed448.js.map +1 -1
  62. package/esm/jubjub.js.map +1 -1
  63. package/esm/p256.js +2 -2
  64. package/esm/p256.js.map +1 -1
  65. package/esm/p384.js +2 -2
  66. package/esm/p384.js.map +1 -1
  67. package/esm/p521.js +3 -3
  68. package/esm/p521.js.map +1 -1
  69. package/esm/secp256k1.js +6 -6
  70. package/esm/secp256k1.js.map +1 -1
  71. package/jubjub.js.map +1 -1
  72. package/p256.js +2 -2
  73. package/p256.js.map +1 -1
  74. package/p384.js +2 -2
  75. package/p384.js.map +1 -1
  76. package/p521.js +3 -3
  77. package/p521.js.map +1 -1
  78. package/package.json +5 -5
  79. package/secp256k1.js +6 -6
  80. package/secp256k1.js.map +1 -1
  81. package/src/abstract/bls.ts +117 -19
  82. package/src/abstract/hash-to-curve.ts +10 -9
  83. package/src/abstract/montgomery.ts +4 -6
  84. package/src/abstract/utils.ts +52 -26
  85. package/src/abstract/weierstrass.ts +16 -7
  86. package/src/bls12-381.ts +127 -69
  87. package/src/bn254.ts +3 -2
  88. package/src/ed25519.ts +10 -2
  89. package/src/ed448.ts +18 -3
package/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  Audited & minimal JS implementation of elliptic curve cryptography.
4
4
 
5
- - 🔒 [**Audited**](#security) by an independent security firm
5
+ - 🔒 [**Audited**](#security) by independent security firms
6
6
  - 🔻 Tree-shaking-friendly: use only what's necessary, other code won't be included
7
7
  - 🏎 Ultra-fast, hand-optimized for caveats of JS engines
8
8
  - 🔍 Unique tests ensure correctness: property-based, cross-library and Wycheproof vectors, fuzzing
9
9
  - ➰ Short Weierstrass, Edwards, Montgomery curves
10
10
  - ✍️ ECDSA, EdDSA, Schnorr, BLS signature schemes, ECDH key agreement
11
- - 🔖 SUF-CMA and SBS (non-repudiation) for ed25519, ed448 and others
11
+ - 🔖 SUF-CMA, SBS (non-repudiation), ZIP215 (consensus friendliness) features for ed25519
12
12
  - #️⃣ hash-to-curve for encoding or hashing an arbitrary string to an elliptic curve point
13
13
  - 🧜‍♂️ Poseidon ZK-friendly hash
14
14
 
@@ -16,16 +16,15 @@ Audited & minimal JS implementation of elliptic curve cryptography.
16
16
 
17
17
  > **noble-crypto** — high-security, easily auditable set of contained cryptographic libraries and tools.
18
18
 
19
- - No dependencies, protection against supply chain attacks
20
- - Auditable TypeScript / JS code
21
- - Supported on all major platforms
22
- - Releases are signed with PGP keys and built transparently with NPM provenance
23
- - Check out [homepage](https://paulmillr.com/noble/) & all libraries:
19
+ - Zero or minimal dependencies
20
+ - Highly readable TypeScript / JS code
21
+ - PGP-signed releases and transparent NPM builds
22
+ - All libraries:
24
23
  [ciphers](https://github.com/paulmillr/noble-ciphers),
25
24
  [curves](https://github.com/paulmillr/noble-curves),
26
- [hashes](https://github.com/paulmillr/noble-hashes),
27
- 4kb [secp256k1](https://github.com/paulmillr/noble-secp256k1) /
28
- [ed25519](https://github.com/paulmillr/noble-ed25519)
25
+ [hashes](https://github.com/paulmillr/noble-hashes)
26
+ - [Check out homepage](https://paulmillr.com/noble/)
27
+ for reading resources, documentation and apps built with noble
29
28
 
30
29
  ## Usage
31
30
 
@@ -33,13 +32,19 @@ Audited & minimal JS implementation of elliptic curve cryptography.
33
32
 
34
33
  We support all major platforms and runtimes.
35
34
  For [Deno](https://deno.land), ensure to use [npm specifier](https://deno.land/manual@v1.28.0/node/npm_specifiers).
36
- For React Native, you may need a [polyfill for crypto.getRandomValues](https://github.com/LinusU/react-native-get-random-values).
37
- If you don't like NPM, a standalone [noble-curves.js](https://github.com/paulmillr/noble-curves/releases) is also available.
35
+ For React Native, you may need a [polyfill for getRandomValues](https://github.com/LinusU/react-native-get-random-values).
36
+ A standalone file [noble-curves.js](https://github.com/paulmillr/noble-curves/releases) is also available.
37
+
38
+ ```js
39
+ // import * from '@noble/curves'; // Error: use sub-imports, to ensure small app size
40
+ import { secp256k1 } from '@noble/curves/secp256k1'; // ESM and Common.js
41
+ // import { secp256k1 } from 'npm:@noble/curves@1.2.0/secp256k1'; // Deno
42
+ ```
38
43
 
39
44
  - [Implementations](#implementations)
40
45
  - [ECDSA signature scheme](#ecdsa-signature-scheme)
41
46
  - [ECDSA public key recovery & extra entropy](#ecdsa-public-key-recovery--extra-entropy)
42
- - [ECDH (Elliptic Curve Diffie-Hellman)](#ecdh-elliptic-curve-diffie-hellman)
47
+ - [ECDH: Elliptic Curve Diffie-Hellman](#ecdh-elliptic-curve-diffie-hellman)
43
48
  - [Schnorr signatures over secp256k1, BIP340](#schnorr-signatures-over-secp256k1-bip340)
44
49
  - [ed25519, X25519, ristretto255](#ed25519-x25519-ristretto255)
45
50
  - [ed448, X448, decaf448](#ed448-x448-decaf448)
@@ -47,37 +52,32 @@ If you don't like NPM, a standalone [noble-curves.js](https://github.com/paulmil
47
52
  - [All available imports](#all-available-imports)
48
53
  - [Accessing a curve's variables](#accessing-a-curves-variables)
49
54
  - [Abstract API](#abstract-api)
50
- - [abstract/weierstrass: Short Weierstrass curve](#abstractweierstrass-short-weierstrass-curve)
51
- - [abstract/edwards: Twisted Edwards curve](#abstractedwards-twisted-edwards-curve)
52
- - [abstract/montgomery: Montgomery curve](#abstractmontgomery-montgomery-curve)
53
- - [abstract/bls: Barreto-Lynn-Scott curves](#abstractbls-barreto-lynn-scott-curves)
54
- - [abstract/hash-to-curve: Hashing strings to curve points](#abstracthash-to-curve-hashing-strings-to-curve-points)
55
- - [abstract/poseidon: Poseidon hash](#abstractposeidon-poseidon-hash)
56
- - [abstract/modular: Modular arithmetics utilities](#abstractmodular-modular-arithmetics-utilities)
55
+ - [weierstrass: Short Weierstrass curve](#weierstrass-short-weierstrass-curve)
56
+ - [edwards: Twisted Edwards curve](#edwards-twisted-edwards-curve)
57
+ - [montgomery: Montgomery curve](#montgomery-montgomery-curve)
58
+ - [bls: Barreto-Lynn-Scott curves](#bls-barreto-lynn-scott-curves)
59
+ - [hash-to-curve: Hashing strings to curve points](#hash-to-curve-hashing-strings-to-curve-points)
60
+ - [poseidon: Poseidon hash](#poseidon-poseidon-hash)
61
+ - [modular: Modular arithmetics utilities](#modular-modular-arithmetics-utilities)
57
62
  - [Creating private keys from hashes](#creating-private-keys-from-hashes)
58
- - [abstract/utils: Useful utilities](#abstractutils-useful-utilities)
63
+ - [utils: Useful utilities](#utils-useful-utilities)
59
64
  - [Security](#security)
60
65
  - [Speed](#speed)
61
- - [Contributing & testing](#contributing--testing)
62
66
  - [Upgrading](#upgrading)
67
+ - [Contributing & testing](#contributing--testing)
63
68
  - [Resources](#resources)
64
- - [Demos](#demos)
65
- - [Projects using curves](#projects-using-curves)
66
- - [License](#license)
67
69
 
68
70
  ### Implementations
69
71
 
70
- Implementations are utilizing [noble-hashes](https://github.com/paulmillr/noble-hashes).
71
- [Abstract API](#abstract-api) doesn't depend on them: you can use a different hashing library.
72
+ Implementations use [noble-hashes](https://github.com/paulmillr/noble-hashes).
73
+ If you want to use a different hashing library, [abstract API](#abstract-api) doesn't depend on them.
72
74
 
73
75
  #### ECDSA signature scheme
74
76
 
75
77
  Generic example that works for all curves, shown for secp256k1:
76
78
 
77
79
  ```ts
78
- // import * from '@noble/curves'; // Error: use sub-imports, to ensure small app size
79
- import { secp256k1 } from '@noble/curves/secp256k1'; // ESM and Common.js
80
- // import { secp256k1 } from 'npm:@noble/curves@1.2.0/secp256k1'; // Deno
80
+ import { secp256k1 } from '@noble/curves/secp256k1';
81
81
  const priv = secp256k1.utils.randomPrivateKey();
82
82
  const pub = secp256k1.getPublicKey(priv);
83
83
  const msg = new Uint8Array(32).fill(1); // message hash (not message) in ecdsa
@@ -92,13 +92,15 @@ const pub2 = secp256k1.getPublicKey(privHex);
92
92
  #### ECDSA public key recovery & extra entropy
93
93
 
94
94
  ```ts
95
+ // let sig = secp256k1.Signature.fromCompact(sigHex); // or .fromDER(sigDERHex)
96
+ // sig = sig.addRecoveryBit(bit); // bit is not serialized into compact / der format
95
97
  sig.recoverPublicKey(msg).toRawBytes(); // === pub; // public key recovery
96
98
 
97
99
  // extraEntropy https://moderncrypto.org/mail-archive/curves/2017/000925.html
98
100
  const sigImprovedSecurity = secp256k1.sign(msg, priv, { extraEntropy: true });
99
101
  ```
100
102
 
101
- #### ECDH (Elliptic Curve Diffie-Hellman)
103
+ #### ECDH: Elliptic Curve Diffie-Hellman
102
104
 
103
105
  ```ts
104
106
  // 1. The output includes parity byte. Strip it using shared.slice(1)
@@ -274,7 +276,7 @@ Precomputes are enabled for weierstrass and edwards BASE points of a curve. You
274
276
  could precompute any other point (e.g. for ECDH) using `utils.precompute()`
275
277
  method: check out examples.
276
278
 
277
- ### abstract/weierstrass: Short Weierstrass curve
279
+ ### weierstrass: Short Weierstrass curve
278
280
 
279
281
  ```ts
280
282
  import { weierstrass } from '@noble/curves/abstract/weierstrass';
@@ -316,6 +318,10 @@ type CHash = {
316
318
  outputLen: number;
317
319
  create(): any;
318
320
  };
321
+
322
+ // example
323
+ function sha256(message: Uint8Array) { return _internal_lowlvl(message) }
324
+ sha256.outputLen = 32; // 32 bytes of output for sha2-256
319
325
  ```
320
326
 
321
327
  **Message hash** is expected instead of message itself:
@@ -441,7 +447,7 @@ const fast = secq256k1.utils.precompute(8, Point.fromHex(someonesPubKey));
441
447
  fast.multiply(privKey); // much faster ECDH now
442
448
  ```
443
449
 
444
- ### abstract/edwards: Twisted Edwards curve
450
+ ### edwards: Twisted Edwards curve
445
451
 
446
452
  ```ts
447
453
  import { twistedEdwards } from '@noble/curves/abstract/edwards';
@@ -531,7 +537,7 @@ interface ExtPointConstructor extends GroupConstructor<ExtPointType> {
531
537
  }
532
538
  ```
533
539
 
534
- ### abstract/montgomery: Montgomery curve
540
+ ### montgomery: Montgomery curve
535
541
 
536
542
  ```typescript
537
543
  import { montgomery } from '@noble/curves/abstract/montgomery';
@@ -558,7 +564,7 @@ Proper Elliptic Curve Points are not implemented yet.
558
564
 
559
565
  You must specify curve params `Fp`, `a`, `Gu` coordinate of u, `montgomeryBits` and `nByteLength`.
560
566
 
561
- ### abstract/bls: Barreto-Lynn-Scott curves
567
+ ### bls: Barreto-Lynn-Scott curves
562
568
 
563
569
  The module abstracts BLS (Barreto-Lynn-Scott) pairing-friendly elliptic curve construction.
564
570
  They allow to construct [zk-SNARKs](https://z.cash/technology/zksnarks/) and
@@ -567,6 +573,8 @@ use aggregated, batch-verifiable
567
573
  using Boneh-Lynn-Shacham signature scheme.
568
574
 
569
575
  The module doesn't expose `CURVE` property: use `G1.CURVE`, `G2.CURVE` instead.
576
+ Only BLS12-381 is implemented currently.
577
+ Defining BLS12-377 and BLS24 should be straightforward.
570
578
 
571
579
  Main methods and properties are:
572
580
 
@@ -579,8 +587,13 @@ Main methods and properties are:
579
587
  - `Signature` property with `fromHex`, `toHex` methods
580
588
  - `fields` containing `Fp`, `Fp2`, `Fp6`, `Fp12`, `Fr`
581
589
 
582
- Right now we only implement BLS12-381 (compatible with ETH and others),
583
- but in theory defining BLS12-377, BLS24 should be straightforward. An example:
590
+ The default BLS uses short public keys (with public keys in G1 and signatures in G2).
591
+ Short signatures (public keys in G2 and signatures in G1) is also supported, using:
592
+
593
+ - `getPublicKeyForShortSignatures(privateKey)`
594
+ - `signShortSignature(message, privateKey)`
595
+ - `verifyShortSignature(signature, message, publicKey)`
596
+ - `aggregateShortSignatures(signatures)`
584
597
 
585
598
  ```ts
586
599
  import { bls12_381 as bls } from '@noble/curves/bls12-381';
@@ -612,68 +625,19 @@ const isValid3 = bls.verifyBatch(aggSignature3, messages, publicKeys);
612
625
  console.log({ publicKeys, signatures3, aggSignature3, isValid3 });
613
626
 
614
627
  // Pairings, with and without final exponentiation
615
- // bls.pairing(PointG1, PointG2);
616
- // bls.pairing(PointG1, PointG2, false);
617
- // bls.fields.Fp12.finalExponentiate(bls.fields.Fp12.mul(eGS, ePHm));
628
+ bls.pairing(PointG1, PointG2);
629
+ bls.pairing(PointG1, PointG2, false);
630
+ bls.fields.Fp12.finalExponentiate(bls.fields.Fp12.mul(PointG1, PointG2));
618
631
 
619
632
  // Others
620
- // bls.G1.ProjectivePoint.BASE, bls.G2.ProjectivePoint.BASE
621
- // bls.fields.Fp, bls.fields.Fp2, bls.fields.Fp12, bls.fields.Fr
633
+ bls.G1.ProjectivePoint.BASE, bls.G2.ProjectivePoint.BASE
634
+ bls.fields.Fp, bls.fields.Fp2, bls.fields.Fp12, bls.fields.Fr
635
+ bls.params.x, bls.params.r, bls.params.G1b, bls.params.G2b
622
636
 
623
637
  // hash-to-curve examples can be seen below
624
638
  ```
625
639
 
626
- Full types:
627
-
628
- ```ts
629
- getPublicKey: (privateKey: PrivKey) => Uint8Array;
630
- sign: {
631
- (message: Hex, privateKey: PrivKey): Uint8Array;
632
- (message: ProjPointType<Fp2>, privateKey: PrivKey): ProjPointType<Fp2>;
633
- };
634
- verify: (
635
- signature: Hex | ProjPointType<Fp2>,
636
- message: Hex | ProjPointType<Fp2>,
637
- publicKey: Hex | ProjPointType<Fp>
638
- ) => boolean;
639
- verifyBatch: (
640
- signature: Hex | ProjPointType<Fp2>,
641
- messages: (Hex | ProjPointType<Fp2>)[],
642
- publicKeys: (Hex | ProjPointType<Fp>)[]
643
- ) => boolean;
644
- aggregatePublicKeys: {
645
- (publicKeys: Hex[]): Uint8Array;
646
- (publicKeys: ProjPointType<Fp>[]): ProjPointType<Fp>;
647
- };
648
- aggregateSignatures: {
649
- (signatures: Hex[]): Uint8Array;
650
- (signatures: ProjPointType<Fp2>[]): ProjPointType<Fp2>;
651
- };
652
- millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12;
653
- pairing: (P: ProjPointType<Fp>, Q: ProjPointType<Fp2>, withFinalExponent?: boolean) => Fp12;
654
- G1: CurvePointsRes<Fp> & ReturnType<typeof htf.createHasher<Fp>>;
655
- G2: CurvePointsRes<Fp2> & ReturnType<typeof htf.createHasher<Fp2>>;
656
- Signature: SignatureCoder<Fp2>;
657
- params: {
658
- x: bigint;
659
- r: bigint;
660
- G1b: bigint;
661
- G2b: Fp2;
662
- };
663
- fields: {
664
- Fp: IField<Fp>;
665
- Fp2: IField<Fp2>;
666
- Fp6: IField<Fp6>;
667
- Fp12: IField<Fp12>;
668
- Fr: IField<bigint>;
669
- };
670
- utils: {
671
- randomPrivateKey: () => Uint8Array;
672
- calcPairingPrecomputes: (p: AffinePoint<Fp2>) => [Fp2, Fp2, Fp2][];
673
- };
674
- ```
675
-
676
- ### abstract/hash-to-curve: Hashing strings to curve points
640
+ ### hash-to-curve: Hashing strings to curve points
677
641
 
678
642
  The module allows to hash arbitrary strings to elliptic curve points. Implements [RFC 9380](https://www.rfc-editor.org/rfc/rfc9380).
679
643
 
@@ -731,7 +695,7 @@ type Opts = {
731
695
  };
732
696
  ```
733
697
 
734
- ### abstract/poseidon: Poseidon hash
698
+ ### poseidon: Poseidon hash
735
699
 
736
700
  Implements [Poseidon](https://www.poseidon-hash.info) ZK-friendly hash.
737
701
 
@@ -755,7 +719,7 @@ type PoseidonOpts = {
755
719
  const instance = poseidon(opts: PoseidonOpts);
756
720
  ```
757
721
 
758
- ### abstract/modular: Modular arithmetics utilities
722
+ ### modular: Modular arithmetics utilities
759
723
 
760
724
  ```ts
761
725
  import * as mod from '@noble/curves/abstract/modular';
@@ -799,12 +763,13 @@ if you need to hash to **public key**.
799
763
  import { p256 } from '@noble/curves/p256';
800
764
  import { sha256 } from '@noble/hashes/sha256';
801
765
  import { hkdf } from '@noble/hashes/hkdf';
766
+ import * as mod from '@noble/curves/abstract/modular';
802
767
  const someKey = new Uint8Array(32).fill(2); // Needs to actually be random, not .fill(2)
803
768
  const derived = hkdf(sha256, someKey, undefined, 'application', 48); // 48 bytes for 32-byte priv
804
769
  const validPrivateKey = mod.hashToPrivateScalar(derived, p256.CURVE.n);
805
770
  ```
806
771
 
807
- ### abstract/utils: Useful utilities
772
+ ### utils: Useful utilities
808
773
 
809
774
  ```ts
810
775
  import * as utils from '@noble/curves/abstract/utils';
@@ -826,43 +791,61 @@ utils.equalBytes(Uint8Array.from([0xde]), Uint8Array.from([0xde]));
826
791
 
827
792
  ## Security
828
793
 
829
- 1. The library has been independently audited:
830
-
831
- - in Feb 2023 by [Trail of Bits](https://www.trailofbits.com):
832
- [PDF](https://github.com/trailofbits/publications/blob/master/reviews/2023-01-ryanshea-noblecurveslibrary-securityreview.pdf).
833
- The audit has been funded by [Ryan Shea](https://www.shea.io).
834
- Audit scope was abstract modules `curve`, `hash-to-curve`, `modular`, `poseidon`, `utils`, `weierstrass`,
835
- and top-level modules `_shortw_utils` and `secp256k1`.
836
- See [changes since v0.7.3 audit](https://github.com/paulmillr/noble-curves/compare/0.7.3..main).
837
-
838
- 2. The library has been fuzzed by [Guido Vranken's cryptofuzz](https://github.com/guidovranken/cryptofuzz).
839
- You can run the fuzzer by yourself to check it.
840
- 3. [Timing attack](https://en.wikipedia.org/wiki/Timing_attack) considerations:
841
- _JIT-compiler_ and _Garbage Collector_ make "constant time" extremely hard to
842
- achieve in a scripting language. Which means _any other JS library can't have
843
- constant-timeness_. Even statically typed Rust, a language without GC,
844
- [makes it harder to achieve constant-time](https://www.chosenplaintext.ca/open-source/rust-timing-shield/security)
845
- for some cases. If your goal is absolute security, don't use any JS lib — including bindings to native ones.
846
- Use low-level libraries & languages. Nonetheless we're targetting algorithmic constant time.
847
-
848
- We consider infrastructure attacks like rogue NPM modules very important;
849
- that's why it's crucial to minimize the amount of 3rd-party dependencies & native bindings.
850
- If your app uses 500 dependencies, any dep could get hacked and you'll be
851
- downloading malware with every `npm install`. Our goal is to minimize this attack vector.
852
- As for devDependencies used by the library:
853
-
854
- - `@scure` base, bip32, bip39 (used in tests), micro-bmark (benchmark), micro-should (testing)
855
- are developed by us and follow the same practices such as: minimal library size, auditability,
856
- signed releases
857
- - prettier (linter), fast-check (property-based testing), typescript versions
858
- are locked and rarely updated. Every update is checked with `npm-diff`.
859
- The packages are big, which makes it hard to audit their source code thoroughly and fully.
860
- - They are only used if you clone the git repo and want to add some feature to it. End-users won't use them.
861
-
862
- As for key generation, we're deferring to built-in
794
+ The library has been independently audited:
795
+
796
+ - at version 1.2.0, in Sep 2023, by [Kudelski Security](https://kudelskisecurity.com)
797
+ - PDFs: [offline](./audit/2023-09-kudelski-audit-starknet.pdf)
798
+ - [Changes since audit](https://github.com/paulmillr/noble-curves/compare/1.2.0..main)
799
+ - Scope: [scure-starknet](https://github.com/paulmillr/scure-starknet) and its related
800
+ abstract modules of noble-curves: `curve`, `modular`, `poseidon`, `weierstrass`
801
+ - The audit has been funded by [Starkware](https://starkware.co)
802
+ - at version 0.7.3, in Feb 2023, by [Trail of Bits](https://www.trailofbits.com)
803
+ - PDFs: [online](https://github.com/trailofbits/publications/blob/master/reviews/2023-01-ryanshea-noblecurveslibrary-securityreview.pdf),
804
+ [offline](./audit/2023-01-trailofbits-audit-curves.pdf)
805
+ - [Changes since audit](https://github.com/paulmillr/noble-curves/compare/0.7.3..main)
806
+ - Scope: abstract modules `curve`, `hash-to-curve`, `modular`, `poseidon`, `utils`, `weierstrass` and
807
+ top-level modules `_shortw_utils` and `secp256k1`
808
+ - The audit has been funded by [Ryan Shea](https://www.shea.io)
809
+
810
+ It is tested against property-based, cross-library and Wycheproof vectors,
811
+ and has fuzzing by [Guido Vranken's cryptofuzz](https://github.com/guidovranken/cryptofuzz).
812
+
813
+ If you see anything unusual: investigate and report.
814
+
815
+ ### Constant-timeness
816
+
817
+ _JIT-compiler_ and _Garbage Collector_ make "constant time" extremely hard to
818
+ achieve [timing attack](https://en.wikipedia.org/wiki/Timing_attack) resistance
819
+ in a scripting language. Which means _any other JS library can't have
820
+ constant-timeness_. Even statically typed Rust, a language without GC,
821
+ [makes it harder to achieve constant-time](https://www.chosenplaintext.ca/open-source/rust-timing-shield/security)
822
+ for some cases. If your goal is absolute security, don't use any JS lib — including bindings to native ones.
823
+ Use low-level libraries & languages. Nonetheless we're targetting algorithmic constant time.
824
+
825
+ ### Supply chain security
826
+
827
+ * **Commits** are signed with PGP keys, to prevent forgery. Make sure to verify commit signatures.
828
+ * **Releases** are transparent and built on GitHub CI. Make sure to verify [provenance](https://docs.npmjs.com/generating-provenance-statements) logs
829
+ * **Rare releasing** is followed to ensure less re-audit need for end-users
830
+ * **Dependencies** are minimized and locked-down:
831
+ - If your app has 500 dependencies, any dep could get hacked and you'll be downloading
832
+ malware with every install. We make sure to use as few dependencies as possible
833
+ - We prevent automatic dependency updates by locking-down version ranges. Every update is checked with `npm-diff`
834
+ - One dependency [noble-hashes](https://github.com/paulmillr/noble-hashes) is used, by the same author, to provide hashing functionality
835
+ * **Dev Dependencies** are only used if you want to contribute to the repo. They are disabled for end-users:
836
+ - scure-base, scure-bip32, scure-bip39, micro-bmark and micro-should are developed by the same author and follow identical security practices
837
+ - prettier (linter), fast-check (property-based testing) and typescript are used for code quality, vector generation and ts compilation. The packages are big, which makes it hard to audit their source code thoroughly and fully
838
+
839
+ ### Randomness
840
+
841
+ We're deferring to built-in
863
842
  [crypto.getRandomValues](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues)
864
843
  which is considered cryptographically secure (CSPRNG).
865
844
 
845
+ In the past, browsers had bugs that made it weak: it may happen again.
846
+ Implementing a userspace CSPRNG to get resilient to the weakness
847
+ is even worse: there is no reliable userspace source of quality entropy.
848
+
866
849
  ## Speed
867
850
 
868
851
  Benchmark results on Apple M2 with node v20:
@@ -944,13 +927,6 @@ ed25519 x 3,088 ops/sec @ 323μs/op
944
927
  ed448 x 1,247 ops/sec @ 801μs/op
945
928
  ```
946
929
 
947
- ## Contributing & testing
948
-
949
- 1. Clone the repository
950
- 2. `npm install` to install build dependencies like TypeScript
951
- 3. `npm run build` to compile TypeScript code
952
- 4. `npm run test` will execute all main tests
953
-
954
930
  ## Upgrading
955
931
 
956
932
  Previously, the library was split into single-feature packages
@@ -971,7 +947,7 @@ Upgrading from noble-secp256k1 1.7:
971
947
  - to use old behavior, which produced 65-byte uncompressed keys, set
972
948
  argument `isCompressed` to `false`: `getPublicKey(priv, false)`
973
949
  - `sign`
974
- - is now sync; use `signAsync` for async version
950
+ - is now sync
975
951
  - now returns `Signature` instance with `{ r, s, recovery }` properties
976
952
  - `canonical` option was renamed to `lowS`
977
953
  - `recovered` option has been removed because recovery bit is always returned now
@@ -980,6 +956,7 @@ Upgrading from noble-secp256k1 1.7:
980
956
  Compact encoding is simply a concatenation of 32-byte r and 32-byte s.
981
957
  2. If you must use DER encoding, switch to noble-curves (see above).
982
958
  - `verify`
959
+ - is now sync
983
960
  - `strict` option was renamed to `lowS`
984
961
  - `getSharedSecret`
985
962
  - now produce 33-byte compressed signatures by default
@@ -1009,61 +986,18 @@ Upgrading from [@noble/bls12-381](https://github.com/paulmillr/noble-bls12-381):
1009
986
  - PointG2.fromSignature -> Signature.decode, PointG2.toSignature -> Signature.encode
1010
987
  - Fp2 ORDER was corrected
1011
988
 
989
+ ## Contributing & testing
990
+
991
+ 1. Clone the repository
992
+ 2. `npm install` to install build dependencies like TypeScript
993
+ 3. `npm run build` to compile TypeScript code
994
+ 4. `npm run test` will execute all main tests
995
+
1012
996
  ## Resources
1013
997
 
1014
- - [Learning fast elliptic-curve cryptography](https://paulmillr.com/posts/noble-secp256k1-fast-ecc/)
1015
- - EdDSA
1016
- - [A Deep dive into Ed25519 Signatures](https://cendyne.dev/posts/2022-03-06-ed25519-signatures.html)
1017
- - [Ed25519 Deep Dive Addendum](https://cendyne.dev/posts/2022-09-11-ed25519-deep-dive-addendum.html)
1018
- - [It’s 255:19AM. Do you know what your validation criteria are?](https://hdevalence.ca/blog/2020-10-04-its-25519am)
1019
- - [Taming the many EdDSAs](https://csrc.nist.gov/csrc/media/Presentations/2023/crclub-2023-03-08/images-media/20230308-crypto-club-slides--taming-the-many-EdDSAs.pdf)
1020
- that describes concepts of Strong UnForgeability under Chosen Message Attacks and Strongly Binding Signatures
1021
- - [Cofactor Explained: Clearing Elliptic Curves’ dirty little secret](https://loup-vaillant.fr/tutorials/cofactor)
1022
- - [Surrounded by Elligators](https://loup-vaillant.fr/articles/implementing-elligator)
1023
- - Pairings and BLS
1024
- - [BLS signatures for busy people](https://gist.github.com/paulmillr/18b802ad219b1aee34d773d08ec26ca2)
1025
- - [BLS12-381 for the rest of us](https://hackmd.io/@benjaminion/bls12-381)
1026
- - [Key concepts of pairings](https://medium.com/@alonmuroch_65570/bls-signatures-part-2-key-concepts-of-pairings-27a8a9533d0c)
1027
- - Pairing over bls12-381:
1028
- [fields](https://research.nccgroup.com/2020/07/06/pairing-over-bls12-381-part-1-fields/),
1029
- [curves](https://research.nccgroup.com/2020/07/13/pairing-over-bls12-381-part-2-curves/),
1030
- [pairings](https://research.nccgroup.com/2020/08/13/pairing-over-bls12-381-part-3-pairing/)
1031
- - [Estimating the bit security of pairing-friendly curves](https://research.nccgroup.com/2022/02/03/estimating-the-bit-security-of-pairing-friendly-curves/)
1032
-
1033
- ### Demos
1034
-
1035
- - [Elliptic Curve Calculator](https://paulmillr.com/noble): add / multiply points, sign messages
1036
- - [BLS threshold signatures](https://genthresh.com)
1037
-
1038
- ### Projects using curves
1039
-
1040
- - HDkey libraries: [scure-bip32](https://github.com/paulmillr/scure-bip32), [bip32](https://github.com/bitcoinjs/bip32)
1041
- - Social networks: [nostr](https://github.com/nbd-wtf/nostr-tools), [bluesky](https://github.com/bluesky-social/atproto)
1042
- - Ethereum libraries:
1043
- - [ethereum-cryptography](https://github.com/ethereum/js-ethereum-cryptography)
1044
- - [micro-eth-signer](https://github.com/paulmillr/micro-eth-signer),
1045
- [ethers](https://github.com/ethers-io/ethers.js) (old noble),
1046
- [viem.sh](https://viem.sh),
1047
- [@ethereumjs](https://github.com/ethereumjs/ethereumjs-monorepo)
1048
- - [metamask's eth-sig-util](https://github.com/MetaMask/eth-sig-util)
1049
- - [gridplus lattice sdk](https://github.com/GridPlus/lattice-eth2-utils)
1050
- - Bitcoin libraries:
1051
- - [scure-btc-signer](https://github.com/paulmillr/scure-btc-signer)
1052
- - [tapscript](https://github.com/cmdruid/tapscript)
1053
- - Solana libraries: [micro-sol-signer](https://github.com/paulmillr/micro-sol-signer), [solana-web3.js](https://github.com/solana-labs/solana-web3.js)
1054
- - Other web3 stuff:
1055
- - [scure-starknet](https://github.com/paulmillr/scure-starknet)
1056
- - [aztec](https://github.com/AztecProtocol/aztec-packages)
1057
- - [polkadot.js](https://github.com/polkadot-js/common), [drand-client](https://github.com/drand/drand-client), [moneroj](https://github.com/beritani/moneroj), [tronlib](https://github.com/CoinSpace/tronlib)
1058
- - [protonmail](https://github.com/ProtonMail/WebClients) (old noble for now)
1059
- - [did-jwt](https://github.com/decentralized-identity/did-jwt), [hpke-js](https://github.com/dajiaji/hpke-js),
1060
- [js-libp2p-noise](https://github.com/ChainSafe/js-libp2p-noise)
1061
- - [ed25519-keygen](https://github.com/paulmillr/ed25519-keygen) SSH, PGP, TOR key generation
1062
- - [secp256k1 compatibility layer](https://github.com/ethereum/js-ethereum-cryptography/blob/2.0.0/src/secp256k1-compat.ts)
1063
- for users who want to switch from secp256k1-node or tiny-secp256k1. Allows to see which methods map to corresponding noble code.
1064
- - [BLS BBS signatures](https://github.com/Wind4Greg/BBS-Draft-Checks) following [draft-irtf-cfrg-bbs-signatures-latest](https://identity.foundation/bbs-signature/draft-irtf-cfrg-bbs-signatures.html)
1065
- - [KZG trusted setup ceremony](https://github.com/dsrvlabs/czg-keremony)
1066
- - See [full list of projects on GitHub](https://github.com/paulmillr/noble-curves/network/dependents).
998
+ Check out [paulmillr.com/noble](https://paulmillr.com/noble/)
999
+ for useful resources, articles, documentation and demos
1000
+ related to the library.
1067
1001
 
1068
1002
  ## License
1069
1003
 
package/abstract/bls.d.ts CHANGED
@@ -14,9 +14,14 @@
14
14
  import { AffinePoint } from './curve.js';
15
15
  import { IField } from './modular.js';
16
16
  import { Hex, PrivKey, CHash } from './utils.js';
17
- import * as htf from './hash-to-curve.js';
17
+ import { MapToCurve, Opts as HTFOpts, htfBasicOpts, createHasher } from './hash-to-curve.js';
18
18
  import { CurvePointsType, ProjPointType as ProjPointType, CurvePointsRes } from './weierstrass.js';
19
19
  type Fp = bigint;
20
+ export type ShortSignatureCoder<Fp> = {
21
+ fromHex(hex: Hex): ProjPointType<Fp>;
22
+ toRawBytes(point: ProjPointType<Fp>): Uint8Array;
23
+ toHex(point: ProjPointType<Fp>): string;
24
+ };
20
25
  export type SignatureCoder<Fp2> = {
21
26
  fromHex(hex: Hex): ProjPointType<Fp2>;
22
27
  toRawBytes(point: ProjPointType<Fp2>): Uint8Array;
@@ -24,13 +29,14 @@ export type SignatureCoder<Fp2> = {
24
29
  };
25
30
  export type CurveType<Fp, Fp2, Fp6, Fp12> = {
26
31
  G1: Omit<CurvePointsType<Fp>, 'n'> & {
27
- mapToCurve: htf.MapToCurve<Fp>;
28
- htfDefaults: htf.Opts;
32
+ ShortSignature: SignatureCoder<Fp>;
33
+ mapToCurve: MapToCurve<Fp>;
34
+ htfDefaults: HTFOpts;
29
35
  };
30
36
  G2: Omit<CurvePointsType<Fp2>, 'n'> & {
31
37
  Signature: SignatureCoder<Fp2>;
32
- mapToCurve: htf.MapToCurve<Fp2>;
33
- htfDefaults: htf.Opts;
38
+ mapToCurve: MapToCurve<Fp2>;
39
+ htfDefaults: HTFOpts;
34
40
  };
35
41
  fields: {
36
42
  Fp: IField<Fp>;
@@ -55,18 +61,24 @@ export type CurveType<Fp, Fp2, Fp6, Fp12> = {
55
61
  x: bigint;
56
62
  r: bigint;
57
63
  };
58
- htfDefaults: htf.Opts;
64
+ htfDefaults: HTFOpts;
59
65
  hash: CHash;
60
66
  randomBytes: (bytesLength?: number) => Uint8Array;
61
67
  };
62
68
  export type CurveFn<Fp, Fp2, Fp6, Fp12> = {
63
69
  getPublicKey: (privateKey: PrivKey) => Uint8Array;
70
+ getPublicKeyForShortSignatures: (privateKey: PrivKey) => Uint8Array;
64
71
  sign: {
65
72
  (message: Hex, privateKey: PrivKey): Uint8Array;
66
73
  (message: ProjPointType<Fp2>, privateKey: PrivKey): ProjPointType<Fp2>;
67
74
  };
68
- verify: (signature: Hex | ProjPointType<Fp2>, message: Hex | ProjPointType<Fp2>, publicKey: Hex | ProjPointType<Fp>) => boolean;
69
- verifyBatch: (signature: Hex | ProjPointType<Fp2>, messages: (Hex | ProjPointType<Fp2>)[], publicKeys: (Hex | ProjPointType<Fp>)[]) => boolean;
75
+ signShortSignature: {
76
+ (message: Hex, privateKey: PrivKey): Uint8Array;
77
+ (message: ProjPointType<Fp>, privateKey: PrivKey): ProjPointType<Fp>;
78
+ };
79
+ verify: (signature: Hex | ProjPointType<Fp2>, message: Hex | ProjPointType<Fp2>, publicKey: Hex | ProjPointType<Fp>, htfOpts?: htfBasicOpts) => boolean;
80
+ verifyShortSignature: (signature: Hex | ProjPointType<Fp>, message: Hex | ProjPointType<Fp>, publicKey: Hex | ProjPointType<Fp2>, htfOpts?: htfBasicOpts) => boolean;
81
+ verifyBatch: (signature: Hex | ProjPointType<Fp2>, messages: (Hex | ProjPointType<Fp2>)[], publicKeys: (Hex | ProjPointType<Fp>)[], htfOpts?: htfBasicOpts) => boolean;
70
82
  aggregatePublicKeys: {
71
83
  (publicKeys: Hex[]): Uint8Array;
72
84
  (publicKeys: ProjPointType<Fp>[]): ProjPointType<Fp>;
@@ -75,11 +87,16 @@ export type CurveFn<Fp, Fp2, Fp6, Fp12> = {
75
87
  (signatures: Hex[]): Uint8Array;
76
88
  (signatures: ProjPointType<Fp2>[]): ProjPointType<Fp2>;
77
89
  };
90
+ aggregateShortSignatures: {
91
+ (signatures: Hex[]): Uint8Array;
92
+ (signatures: ProjPointType<Fp>[]): ProjPointType<Fp>;
93
+ };
78
94
  millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12;
79
95
  pairing: (P: ProjPointType<Fp>, Q: ProjPointType<Fp2>, withFinalExponent?: boolean) => Fp12;
80
- G1: CurvePointsRes<Fp> & ReturnType<typeof htf.createHasher<Fp>>;
81
- G2: CurvePointsRes<Fp2> & ReturnType<typeof htf.createHasher<Fp2>>;
96
+ G1: CurvePointsRes<Fp> & ReturnType<typeof createHasher<Fp>>;
97
+ G2: CurvePointsRes<Fp2> & ReturnType<typeof createHasher<Fp2>>;
82
98
  Signature: SignatureCoder<Fp2>;
99
+ ShortSignature: ShortSignatureCoder<Fp>;
83
100
  params: {
84
101
  x: bigint;
85
102
  r: bigint;
@@ -1 +1 @@
1
- {"version":3,"file":"bls.d.ts","sourceRoot":"","sources":["../src/abstract/bls.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,MAAM,EAAoC,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAA+B,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,aAAa,IAAI,aAAa,EAC9B,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAE1B,KAAK,EAAE,GAAG,MAAM,CAAC;AAKjB,MAAM,MAAM,cAAc,CAAC,GAAG,IAAI;IAChC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACtC,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;IAClD,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