@noble/curves 0.7.1 → 0.7.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 (49) hide show
  1. package/README.md +40 -20
  2. package/abstract/hash-to-curve.d.ts +13 -4
  3. package/abstract/hash-to-curve.d.ts.map +1 -1
  4. package/abstract/hash-to-curve.js +28 -25
  5. package/abstract/hash-to-curve.js.map +1 -1
  6. package/abstract/montgomery.d.ts +4 -0
  7. package/abstract/montgomery.d.ts.map +1 -1
  8. package/abstract/montgomery.js +1 -0
  9. package/abstract/montgomery.js.map +1 -1
  10. package/ed25519.d.ts.map +1 -1
  11. package/ed25519.js +1 -0
  12. package/ed25519.js.map +1 -1
  13. package/ed448.d.ts.map +1 -1
  14. package/ed448.js +1 -0
  15. package/ed448.js.map +1 -1
  16. package/esm/abstract/hash-to-curve.js +29 -26
  17. package/esm/abstract/hash-to-curve.js.map +1 -1
  18. package/esm/abstract/montgomery.js +1 -0
  19. package/esm/abstract/montgomery.js.map +1 -1
  20. package/esm/ed25519.js +1 -0
  21. package/esm/ed25519.js.map +1 -1
  22. package/esm/ed448.js +1 -0
  23. package/esm/ed448.js.map +1 -1
  24. package/esm/stark.js +75 -114
  25. package/esm/stark.js.map +1 -1
  26. package/package.json +2 -12
  27. package/src/abstract/hash-to-curve.ts +39 -38
  28. package/src/abstract/montgomery.ts +3 -0
  29. package/src/ed25519.ts +1 -0
  30. package/src/ed448.ts +1 -0
  31. package/src/stark.ts +92 -130
  32. package/stark.d.ts +12 -17
  33. package/stark.d.ts.map +1 -1
  34. package/stark.js +81 -122
  35. package/stark.js.map +1 -1
  36. package/esm/p192.js +0 -22
  37. package/esm/p192.js.map +0 -1
  38. package/esm/p224.js +0 -22
  39. package/esm/p224.js.map +0 -1
  40. package/p192.d.ts +0 -101
  41. package/p192.d.ts.map +0 -1
  42. package/p192.js +0 -25
  43. package/p192.js.map +0 -1
  44. package/p224.d.ts +0 -101
  45. package/p224.d.ts.map +0 -1
  46. package/p224.js +0 -25
  47. package/p224.js.map +0 -1
  48. package/src/p192.ts +0 -25
  49. package/src/p224.ts +0 -25
package/p224.d.ts DELETED
@@ -1,101 +0,0 @@
1
- export declare const P224: Readonly<{
2
- create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
3
- CURVE: Readonly<{
4
- readonly nBitLength: number;
5
- readonly nByteLength: number;
6
- readonly Fp: import("./abstract/modular.js").Field<bigint>;
7
- readonly n: bigint;
8
- readonly h: bigint;
9
- readonly hEff?: bigint | undefined;
10
- readonly Gx: bigint;
11
- readonly Gy: bigint;
12
- readonly allowInfinityPoint?: boolean | undefined;
13
- readonly a: bigint;
14
- readonly b: bigint;
15
- readonly allowedPrivateKeyLengths?: readonly number[] | undefined;
16
- readonly wrapPrivateKey?: boolean | undefined;
17
- readonly endo?: {
18
- beta: bigint;
19
- splitScalar: (k: bigint) => {
20
- k1neg: boolean;
21
- k1: bigint;
22
- k2neg: boolean;
23
- k2: bigint;
24
- };
25
- } | undefined;
26
- readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => boolean) | undefined;
27
- readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>) | undefined;
28
- readonly hash: import("./abstract/utils.js").CHash;
29
- readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
30
- readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
31
- lowS: boolean;
32
- readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined;
33
- readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined;
34
- }>;
35
- getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array;
36
- getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean | undefined) => Uint8Array;
37
- sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts | undefined) => import("./abstract/weierstrass.js").SignatureType;
38
- verify: (signature: import("./abstract/utils.js").Hex | {
39
- r: bigint;
40
- s: bigint;
41
- }, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts | undefined) => boolean;
42
- ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor<bigint>;
43
- Signature: import("./abstract/weierstrass.js").SignatureConstructor;
44
- utils: {
45
- normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint;
46
- isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
47
- randomPrivateKey: () => Uint8Array;
48
- precompute: (windowSize?: number | undefined, point?: import("./abstract/weierstrass.js").ProjPointType<bigint> | undefined) => import("./abstract/weierstrass.js").ProjPointType<bigint>;
49
- };
50
- }>;
51
- export declare const secp224r1: Readonly<{
52
- create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
53
- CURVE: Readonly<{
54
- readonly nBitLength: number;
55
- readonly nByteLength: number;
56
- readonly Fp: import("./abstract/modular.js").Field<bigint>;
57
- readonly n: bigint;
58
- readonly h: bigint;
59
- readonly hEff?: bigint | undefined;
60
- readonly Gx: bigint;
61
- readonly Gy: bigint;
62
- readonly allowInfinityPoint?: boolean | undefined;
63
- readonly a: bigint;
64
- readonly b: bigint;
65
- readonly allowedPrivateKeyLengths?: readonly number[] | undefined;
66
- readonly wrapPrivateKey?: boolean | undefined;
67
- readonly endo?: {
68
- beta: bigint;
69
- splitScalar: (k: bigint) => {
70
- k1neg: boolean;
71
- k1: bigint;
72
- k2neg: boolean;
73
- k2: bigint;
74
- };
75
- } | undefined;
76
- readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => boolean) | undefined;
77
- readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>) | undefined;
78
- readonly hash: import("./abstract/utils.js").CHash;
79
- readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
80
- readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
81
- lowS: boolean;
82
- readonly bits2int?: ((bytes: Uint8Array) => bigint) | undefined;
83
- readonly bits2int_modN?: ((bytes: Uint8Array) => bigint) | undefined;
84
- }>;
85
- getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array;
86
- getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean | undefined) => Uint8Array;
87
- sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts | undefined) => import("./abstract/weierstrass.js").SignatureType;
88
- verify: (signature: import("./abstract/utils.js").Hex | {
89
- r: bigint;
90
- s: bigint;
91
- }, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts | undefined) => boolean;
92
- ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor<bigint>;
93
- Signature: import("./abstract/weierstrass.js").SignatureConstructor;
94
- utils: {
95
- normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint;
96
- isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
97
- randomPrivateKey: () => Uint8Array;
98
- precompute: (windowSize?: number | undefined, point?: import("./abstract/weierstrass.js").ProjPointType<bigint> | undefined) => import("./abstract/weierstrass.js").ProjPointType<bigint>;
99
- };
100
- }>;
101
- //# sourceMappingURL=p224.d.ts.map
package/p224.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"p224.d.ts","sourceRoot":"","sources":["src/p224.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBhB,CAAC;AACF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAO,CAAC"}
package/p224.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.secp224r1 = exports.P224 = void 0;
4
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5
- const _shortw_utils_js_1 = require("./_shortw_utils.js");
6
- const sha256_1 = require("@noble/hashes/sha256");
7
- const modular_js_1 = require("./abstract/modular.js");
8
- // NIST secp224r1 aka P224
9
- // https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-224
10
- exports.P224 = (0, _shortw_utils_js_1.createCurve)({
11
- // Params: a, b
12
- a: BigInt('0xfffffffffffffffffffffffffffffffefffffffffffffffffffffffe'),
13
- b: BigInt('0xb4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4'),
14
- // Field over which we'll do calculations;
15
- Fp: (0, modular_js_1.Fp)(BigInt('0xffffffffffffffffffffffffffffffff000000000000000000000001')),
16
- // Curve order, total count of valid points in the field
17
- n: BigInt('0xffffffffffffffffffffffffffff16a2e0b8f03e13dd29455c5c2a3d'),
18
- // Base point (x, y) aka generator point
19
- Gx: BigInt('0xb70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21'),
20
- Gy: BigInt('0xbd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34'),
21
- h: BigInt(1),
22
- lowS: false,
23
- }, sha256_1.sha224);
24
- exports.secp224r1 = exports.P224;
25
- //# sourceMappingURL=p224.js.map
package/p224.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"p224.js","sourceRoot":"","sources":["src/p224.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,yDAAiD;AACjD,iDAA8C;AAC9C,sDAA2C;AAE3C,0BAA0B;AAC1B,0EAA0E;AAC7D,QAAA,IAAI,GAAG,IAAA,8BAAW,EAC7B;IACE,eAAe;IACf,CAAC,EAAE,MAAM,CAAC,4DAA4D,CAAC;IACvE,CAAC,EAAE,MAAM,CAAC,4DAA4D,CAAC;IACvE,0CAA0C;IAC1C,EAAE,EAAE,IAAA,eAAE,EAAC,MAAM,CAAC,4DAA4D,CAAC,CAAC;IAC5E,wDAAwD;IACxD,CAAC,EAAE,MAAM,CAAC,4DAA4D,CAAC;IACvE,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC,4DAA4D,CAAC;IACxE,EAAE,EAAE,MAAM,CAAC,4DAA4D,CAAC;IACxE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,IAAI,EAAE,KAAK;CACH,EACV,eAAM,CACP,CAAC;AACW,QAAA,SAAS,GAAG,YAAI,CAAC"}
package/src/p192.ts DELETED
@@ -1,25 +0,0 @@
1
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
- import { createCurve } from './_shortw_utils.js';
3
- import { sha256 } from '@noble/hashes/sha256';
4
- import { Fp } from './abstract/modular.js';
5
-
6
- // NIST secp192r1 aka P192
7
- // https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/secg/secp192r1
8
- export const P192 = createCurve(
9
- {
10
- // Params: a, b
11
- a: BigInt('0xfffffffffffffffffffffffffffffffefffffffffffffffc'),
12
- b: BigInt('0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1'),
13
- // Field over which we'll do calculations; 2n ** 192n - 2n ** 64n - 1n
14
- Fp: Fp(BigInt('0xfffffffffffffffffffffffffffffffeffffffffffffffff')),
15
- // Curve order, total count of valid points in the field.
16
- n: BigInt('0xffffffffffffffffffffffff99def836146bc9b1b4d22831'),
17
- // Base point (x, y) aka generator point
18
- Gx: BigInt('0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012'),
19
- Gy: BigInt('0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811'),
20
- h: BigInt(1),
21
- lowS: false,
22
- } as const,
23
- sha256
24
- );
25
- export const secp192r1 = P192;
package/src/p224.ts DELETED
@@ -1,25 +0,0 @@
1
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
- import { createCurve } from './_shortw_utils.js';
3
- import { sha224 } from '@noble/hashes/sha256';
4
- import { Fp } from './abstract/modular.js';
5
-
6
- // NIST secp224r1 aka P224
7
- // https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-224
8
- export const P224 = createCurve(
9
- {
10
- // Params: a, b
11
- a: BigInt('0xfffffffffffffffffffffffffffffffefffffffffffffffffffffffe'),
12
- b: BigInt('0xb4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4'),
13
- // Field over which we'll do calculations;
14
- Fp: Fp(BigInt('0xffffffffffffffffffffffffffffffff000000000000000000000001')),
15
- // Curve order, total count of valid points in the field
16
- n: BigInt('0xffffffffffffffffffffffffffff16a2e0b8f03e13dd29455c5c2a3d'),
17
- // Base point (x, y) aka generator point
18
- Gx: BigInt('0xb70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21'),
19
- Gy: BigInt('0xbd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34'),
20
- h: BigInt(1),
21
- lowS: false,
22
- } as const,
23
- sha224
24
- );
25
- export const secp224r1 = P224;