@noble/curves 0.4.0 → 0.5.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.
- package/README.md +203 -162
- package/lib/_shortw_utils.d.ts +75 -0
- package/lib/_shortw_utils.js +20 -0
- package/lib/{bls.d.ts → abstract/bls.d.ts} +2 -1
- package/lib/{bls.js → abstract/bls.js} +28 -27
- package/lib/{edwards.d.ts → abstract/edwards.d.ts} +17 -0
- package/lib/{edwards.js → abstract/edwards.js} +45 -4
- package/lib/{group.d.ts → abstract/group.d.ts} +2 -1
- package/lib/{group.js → abstract/group.js} +4 -3
- package/lib/{hashToCurve.d.ts → abstract/hash-to-curve.d.ts} +6 -0
- package/lib/{hashToCurve.js → abstract/hash-to-curve.js} +15 -2
- package/lib/{modular.d.ts → abstract/modular.d.ts} +10 -4
- package/lib/{modular.js → abstract/modular.js} +110 -19
- package/lib/{montgomery.d.ts → abstract/montgomery.d.ts} +2 -1
- package/lib/{montgomery.js → abstract/montgomery.js} +17 -8
- package/lib/{utils.d.ts → abstract/utils.d.ts} +1 -1
- package/lib/{utils.js → abstract/utils.js} +1 -1
- package/lib/{weierstrass.d.ts → abstract/weierstrass.d.ts} +28 -16
- package/lib/{weierstrass.js → abstract/weierstrass.js} +261 -127
- package/lib/bls12-381.d.ts +66 -0
- package/lib/bls12-381.js +1132 -0
- package/lib/bn.d.ts +7 -0
- package/lib/bn.js +24 -0
- package/lib/ed25519.d.ts +48 -0
- package/lib/ed25519.js +322 -0
- package/lib/ed448.d.ts +3 -0
- package/lib/ed448.js +128 -0
- package/lib/esm/_shortw_utils.js +15 -0
- package/lib/esm/{bls.js → abstract/bls.js} +25 -24
- package/lib/esm/{edwards.js → abstract/edwards.js} +45 -4
- package/lib/esm/{group.js → abstract/group.js} +4 -3
- package/lib/esm/{hashToCurve.js → abstract/hash-to-curve.js} +13 -1
- package/lib/esm/{modular.js → abstract/modular.js} +108 -18
- package/lib/esm/{montgomery.js → abstract/montgomery.js} +17 -8
- package/lib/esm/{utils.js → abstract/utils.js} +1 -1
- package/lib/esm/{weierstrass.js → abstract/weierstrass.js} +255 -123
- package/lib/esm/bls12-381.js +1129 -0
- package/lib/esm/bn.js +21 -0
- package/lib/esm/ed25519.js +318 -0
- package/lib/esm/ed448.js +125 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/jubjub.js +52 -0
- package/lib/esm/p192.js +21 -0
- package/lib/esm/p224.js +21 -0
- package/lib/esm/p256.js +39 -0
- package/lib/esm/p384.js +44 -0
- package/lib/esm/p521.js +58 -0
- package/lib/esm/pasta.js +29 -0
- package/lib/esm/secp256k1.js +290 -0
- package/lib/esm/stark.js +222 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.js +2 -0
- package/lib/jubjub.d.ts +7 -0
- package/lib/jubjub.js +57 -0
- package/lib/p192.d.ts +130 -0
- package/lib/p192.js +24 -0
- package/lib/p224.d.ts +130 -0
- package/lib/p224.js +24 -0
- package/lib/p256.d.ts +130 -0
- package/lib/p256.js +42 -0
- package/lib/p384.d.ts +130 -0
- package/lib/p384.js +47 -0
- package/lib/p521.d.ts +131 -0
- package/lib/p521.js +61 -0
- package/lib/pasta.d.ts +4 -0
- package/lib/pasta.js +32 -0
- package/lib/secp256k1.d.ts +96 -0
- package/lib/secp256k1.js +294 -0
- package/lib/stark.d.ts +72 -0
- package/lib/stark.js +243 -0
- package/package.json +146 -50
- package/index.js +0 -1
package/lib/p192.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export declare const P192: 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 wrapPrivateKey?: boolean | undefined;
|
|
13
|
+
readonly allowInfinityPoint?: boolean | undefined;
|
|
14
|
+
readonly a: bigint;
|
|
15
|
+
readonly b: bigint;
|
|
16
|
+
readonly normalizePrivateKey?: ((key: import("./abstract/utils.js").PrivKey) => import("./abstract/utils.js").PrivKey) | 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").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => boolean) | undefined;
|
|
27
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => import("./abstract/weierstrass.js").ProjectivePointType<bigint>) | undefined;
|
|
28
|
+
readonly htfDefaults?: import("./abstract/hash-to-curve.js").htfOpts | undefined;
|
|
29
|
+
readonly mapToCurve?: ((scalar: bigint[]) => {
|
|
30
|
+
x: bigint;
|
|
31
|
+
y: bigint;
|
|
32
|
+
}) | undefined;
|
|
33
|
+
lowS: boolean;
|
|
34
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
35
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
36
|
+
readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
|
|
37
|
+
readonly truncateHash?: ((hash: Uint8Array, truncateOnly?: boolean | undefined) => bigint) | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
40
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/weierstrass.js").PubKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
41
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: {
|
|
42
|
+
lowS?: boolean | undefined;
|
|
43
|
+
extraEntropy?: (true | import("./abstract/utils.js").Hex) | undefined;
|
|
44
|
+
} | undefined) => import("./abstract/weierstrass.js").SignatureType;
|
|
45
|
+
verify: (signature: import("./abstract/utils.js").Hex | import("./abstract/weierstrass.js").SignatureType, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/weierstrass.js").PubKey, opts?: {
|
|
46
|
+
lowS?: boolean | undefined;
|
|
47
|
+
} | undefined) => boolean;
|
|
48
|
+
Point: import("./abstract/weierstrass.js").PointConstructor<bigint>;
|
|
49
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>;
|
|
50
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
51
|
+
utils: {
|
|
52
|
+
mod: (a: bigint, b?: bigint | undefined) => bigint;
|
|
53
|
+
invert: (number: bigint, modulo?: bigint | undefined) => bigint;
|
|
54
|
+
_bigintToBytes: (num: bigint) => Uint8Array;
|
|
55
|
+
_bigintToString: (num: bigint) => string;
|
|
56
|
+
_normalizePrivateKey: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
57
|
+
_normalizePublicKey: (publicKey: import("./abstract/weierstrass.js").PubKey) => import("./abstract/weierstrass.js").PointType<bigint>;
|
|
58
|
+
_isWithinCurveOrder: (num: bigint) => boolean;
|
|
59
|
+
_isValidFieldElement: (num: bigint) => boolean;
|
|
60
|
+
_weierstrassEquation: (x: bigint) => bigint;
|
|
61
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
62
|
+
hashToPrivateKey: (hash: import("./abstract/utils.js").Hex) => Uint8Array;
|
|
63
|
+
randomPrivateKey: () => Uint8Array;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
export declare const secp192r1: Readonly<{
|
|
67
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
68
|
+
CURVE: Readonly<{
|
|
69
|
+
readonly nBitLength: number;
|
|
70
|
+
readonly nByteLength: number;
|
|
71
|
+
readonly Fp: import("./abstract/modular.js").Field<bigint>;
|
|
72
|
+
readonly n: bigint;
|
|
73
|
+
readonly h: bigint;
|
|
74
|
+
readonly hEff?: bigint | undefined;
|
|
75
|
+
readonly Gx: bigint;
|
|
76
|
+
readonly Gy: bigint;
|
|
77
|
+
readonly wrapPrivateKey?: boolean | undefined;
|
|
78
|
+
readonly allowInfinityPoint?: boolean | undefined;
|
|
79
|
+
readonly a: bigint;
|
|
80
|
+
readonly b: bigint;
|
|
81
|
+
readonly normalizePrivateKey?: ((key: import("./abstract/utils.js").PrivKey) => import("./abstract/utils.js").PrivKey) | undefined;
|
|
82
|
+
readonly endo?: {
|
|
83
|
+
beta: bigint;
|
|
84
|
+
splitScalar: (k: bigint) => {
|
|
85
|
+
k1neg: boolean;
|
|
86
|
+
k1: bigint;
|
|
87
|
+
k2neg: boolean;
|
|
88
|
+
k2: bigint;
|
|
89
|
+
};
|
|
90
|
+
} | undefined;
|
|
91
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => boolean) | undefined;
|
|
92
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => import("./abstract/weierstrass.js").ProjectivePointType<bigint>) | undefined;
|
|
93
|
+
readonly htfDefaults?: import("./abstract/hash-to-curve.js").htfOpts | undefined;
|
|
94
|
+
readonly mapToCurve?: ((scalar: bigint[]) => {
|
|
95
|
+
x: bigint;
|
|
96
|
+
y: bigint;
|
|
97
|
+
}) | undefined;
|
|
98
|
+
lowS: boolean;
|
|
99
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
100
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
101
|
+
readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
|
|
102
|
+
readonly truncateHash?: ((hash: Uint8Array, truncateOnly?: boolean | undefined) => bigint) | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
105
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/weierstrass.js").PubKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
106
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: {
|
|
107
|
+
lowS?: boolean | undefined;
|
|
108
|
+
extraEntropy?: (true | import("./abstract/utils.js").Hex) | undefined;
|
|
109
|
+
} | undefined) => import("./abstract/weierstrass.js").SignatureType;
|
|
110
|
+
verify: (signature: import("./abstract/utils.js").Hex | import("./abstract/weierstrass.js").SignatureType, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/weierstrass.js").PubKey, opts?: {
|
|
111
|
+
lowS?: boolean | undefined;
|
|
112
|
+
} | undefined) => boolean;
|
|
113
|
+
Point: import("./abstract/weierstrass.js").PointConstructor<bigint>;
|
|
114
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>;
|
|
115
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
116
|
+
utils: {
|
|
117
|
+
mod: (a: bigint, b?: bigint | undefined) => bigint;
|
|
118
|
+
invert: (number: bigint, modulo?: bigint | undefined) => bigint;
|
|
119
|
+
_bigintToBytes: (num: bigint) => Uint8Array;
|
|
120
|
+
_bigintToString: (num: bigint) => string;
|
|
121
|
+
_normalizePrivateKey: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
122
|
+
_normalizePublicKey: (publicKey: import("./abstract/weierstrass.js").PubKey) => import("./abstract/weierstrass.js").PointType<bigint>;
|
|
123
|
+
_isWithinCurveOrder: (num: bigint) => boolean;
|
|
124
|
+
_isValidFieldElement: (num: bigint) => boolean;
|
|
125
|
+
_weierstrassEquation: (x: bigint) => bigint;
|
|
126
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
127
|
+
hashToPrivateKey: (hash: import("./abstract/utils.js").Hex) => Uint8Array;
|
|
128
|
+
randomPrivateKey: () => Uint8Array;
|
|
129
|
+
};
|
|
130
|
+
}>;
|
package/lib/p192.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.secp192r1 = exports.P192 = 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 secp192r1 aka P192
|
|
9
|
+
// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/secg/secp192r1
|
|
10
|
+
exports.P192 = (0, _shortw_utils_js_1.createCurve)({
|
|
11
|
+
// Params: a, b
|
|
12
|
+
a: BigInt('0xfffffffffffffffffffffffffffffffefffffffffffffffc'),
|
|
13
|
+
b: BigInt('0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1'),
|
|
14
|
+
// Field over which we'll do calculations; 2n ** 192n - 2n ** 64n - 1n
|
|
15
|
+
Fp: (0, modular_js_1.Fp)(BigInt('0xfffffffffffffffffffffffffffffffeffffffffffffffff')),
|
|
16
|
+
// Curve order, total count of valid points in the field.
|
|
17
|
+
n: BigInt('0xffffffffffffffffffffffff99def836146bc9b1b4d22831'),
|
|
18
|
+
// Base point (x, y) aka generator point
|
|
19
|
+
Gx: BigInt('0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012'),
|
|
20
|
+
Gy: BigInt('0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811'),
|
|
21
|
+
h: BigInt(1),
|
|
22
|
+
lowS: false,
|
|
23
|
+
}, sha256_1.sha256);
|
|
24
|
+
exports.secp192r1 = exports.P192;
|
package/lib/p224.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
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 wrapPrivateKey?: boolean | undefined;
|
|
13
|
+
readonly allowInfinityPoint?: boolean | undefined;
|
|
14
|
+
readonly a: bigint;
|
|
15
|
+
readonly b: bigint;
|
|
16
|
+
readonly normalizePrivateKey?: ((key: import("./abstract/utils.js").PrivKey) => import("./abstract/utils.js").PrivKey) | 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").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => boolean) | undefined;
|
|
27
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => import("./abstract/weierstrass.js").ProjectivePointType<bigint>) | undefined;
|
|
28
|
+
readonly htfDefaults?: import("./abstract/hash-to-curve.js").htfOpts | undefined;
|
|
29
|
+
readonly mapToCurve?: ((scalar: bigint[]) => {
|
|
30
|
+
x: bigint;
|
|
31
|
+
y: bigint;
|
|
32
|
+
}) | undefined;
|
|
33
|
+
lowS: boolean;
|
|
34
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
35
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
36
|
+
readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
|
|
37
|
+
readonly truncateHash?: ((hash: Uint8Array, truncateOnly?: boolean | undefined) => bigint) | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
40
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/weierstrass.js").PubKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
41
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: {
|
|
42
|
+
lowS?: boolean | undefined;
|
|
43
|
+
extraEntropy?: (true | import("./abstract/utils.js").Hex) | undefined;
|
|
44
|
+
} | undefined) => import("./abstract/weierstrass.js").SignatureType;
|
|
45
|
+
verify: (signature: import("./abstract/utils.js").Hex | import("./abstract/weierstrass.js").SignatureType, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/weierstrass.js").PubKey, opts?: {
|
|
46
|
+
lowS?: boolean | undefined;
|
|
47
|
+
} | undefined) => boolean;
|
|
48
|
+
Point: import("./abstract/weierstrass.js").PointConstructor<bigint>;
|
|
49
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>;
|
|
50
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
51
|
+
utils: {
|
|
52
|
+
mod: (a: bigint, b?: bigint | undefined) => bigint;
|
|
53
|
+
invert: (number: bigint, modulo?: bigint | undefined) => bigint;
|
|
54
|
+
_bigintToBytes: (num: bigint) => Uint8Array;
|
|
55
|
+
_bigintToString: (num: bigint) => string;
|
|
56
|
+
_normalizePrivateKey: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
57
|
+
_normalizePublicKey: (publicKey: import("./abstract/weierstrass.js").PubKey) => import("./abstract/weierstrass.js").PointType<bigint>;
|
|
58
|
+
_isWithinCurveOrder: (num: bigint) => boolean;
|
|
59
|
+
_isValidFieldElement: (num: bigint) => boolean;
|
|
60
|
+
_weierstrassEquation: (x: bigint) => bigint;
|
|
61
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
62
|
+
hashToPrivateKey: (hash: import("./abstract/utils.js").Hex) => Uint8Array;
|
|
63
|
+
randomPrivateKey: () => Uint8Array;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
export declare const secp224r1: Readonly<{
|
|
67
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
68
|
+
CURVE: Readonly<{
|
|
69
|
+
readonly nBitLength: number;
|
|
70
|
+
readonly nByteLength: number;
|
|
71
|
+
readonly Fp: import("./abstract/modular.js").Field<bigint>;
|
|
72
|
+
readonly n: bigint;
|
|
73
|
+
readonly h: bigint;
|
|
74
|
+
readonly hEff?: bigint | undefined;
|
|
75
|
+
readonly Gx: bigint;
|
|
76
|
+
readonly Gy: bigint;
|
|
77
|
+
readonly wrapPrivateKey?: boolean | undefined;
|
|
78
|
+
readonly allowInfinityPoint?: boolean | undefined;
|
|
79
|
+
readonly a: bigint;
|
|
80
|
+
readonly b: bigint;
|
|
81
|
+
readonly normalizePrivateKey?: ((key: import("./abstract/utils.js").PrivKey) => import("./abstract/utils.js").PrivKey) | undefined;
|
|
82
|
+
readonly endo?: {
|
|
83
|
+
beta: bigint;
|
|
84
|
+
splitScalar: (k: bigint) => {
|
|
85
|
+
k1neg: boolean;
|
|
86
|
+
k1: bigint;
|
|
87
|
+
k2neg: boolean;
|
|
88
|
+
k2: bigint;
|
|
89
|
+
};
|
|
90
|
+
} | undefined;
|
|
91
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => boolean) | undefined;
|
|
92
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => import("./abstract/weierstrass.js").ProjectivePointType<bigint>) | undefined;
|
|
93
|
+
readonly htfDefaults?: import("./abstract/hash-to-curve.js").htfOpts | undefined;
|
|
94
|
+
readonly mapToCurve?: ((scalar: bigint[]) => {
|
|
95
|
+
x: bigint;
|
|
96
|
+
y: bigint;
|
|
97
|
+
}) | undefined;
|
|
98
|
+
lowS: boolean;
|
|
99
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
100
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
101
|
+
readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
|
|
102
|
+
readonly truncateHash?: ((hash: Uint8Array, truncateOnly?: boolean | undefined) => bigint) | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
105
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/weierstrass.js").PubKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
106
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: {
|
|
107
|
+
lowS?: boolean | undefined;
|
|
108
|
+
extraEntropy?: (true | import("./abstract/utils.js").Hex) | undefined;
|
|
109
|
+
} | undefined) => import("./abstract/weierstrass.js").SignatureType;
|
|
110
|
+
verify: (signature: import("./abstract/utils.js").Hex | import("./abstract/weierstrass.js").SignatureType, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/weierstrass.js").PubKey, opts?: {
|
|
111
|
+
lowS?: boolean | undefined;
|
|
112
|
+
} | undefined) => boolean;
|
|
113
|
+
Point: import("./abstract/weierstrass.js").PointConstructor<bigint>;
|
|
114
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>;
|
|
115
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
116
|
+
utils: {
|
|
117
|
+
mod: (a: bigint, b?: bigint | undefined) => bigint;
|
|
118
|
+
invert: (number: bigint, modulo?: bigint | undefined) => bigint;
|
|
119
|
+
_bigintToBytes: (num: bigint) => Uint8Array;
|
|
120
|
+
_bigintToString: (num: bigint) => string;
|
|
121
|
+
_normalizePrivateKey: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
122
|
+
_normalizePublicKey: (publicKey: import("./abstract/weierstrass.js").PubKey) => import("./abstract/weierstrass.js").PointType<bigint>;
|
|
123
|
+
_isWithinCurveOrder: (num: bigint) => boolean;
|
|
124
|
+
_isValidFieldElement: (num: bigint) => boolean;
|
|
125
|
+
_weierstrassEquation: (x: bigint) => bigint;
|
|
126
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
127
|
+
hashToPrivateKey: (hash: import("./abstract/utils.js").Hex) => Uint8Array;
|
|
128
|
+
randomPrivateKey: () => Uint8Array;
|
|
129
|
+
};
|
|
130
|
+
}>;
|
package/lib/p224.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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; 2n**224n - 2n**96n + 1n
|
|
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;
|
package/lib/p256.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export declare const P256: 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 wrapPrivateKey?: boolean | undefined;
|
|
13
|
+
readonly allowInfinityPoint?: boolean | undefined;
|
|
14
|
+
readonly a: bigint;
|
|
15
|
+
readonly b: bigint;
|
|
16
|
+
readonly normalizePrivateKey?: ((key: import("./abstract/utils.js").PrivKey) => import("./abstract/utils.js").PrivKey) | 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").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => boolean) | undefined;
|
|
27
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => import("./abstract/weierstrass.js").ProjectivePointType<bigint>) | undefined;
|
|
28
|
+
readonly htfDefaults?: import("./abstract/hash-to-curve.js").htfOpts | undefined;
|
|
29
|
+
readonly mapToCurve?: ((scalar: bigint[]) => {
|
|
30
|
+
x: bigint;
|
|
31
|
+
y: bigint;
|
|
32
|
+
}) | undefined;
|
|
33
|
+
lowS: boolean;
|
|
34
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
35
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
36
|
+
readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
|
|
37
|
+
readonly truncateHash?: ((hash: Uint8Array, truncateOnly?: boolean | undefined) => bigint) | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
40
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/weierstrass.js").PubKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
41
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: {
|
|
42
|
+
lowS?: boolean | undefined;
|
|
43
|
+
extraEntropy?: (true | import("./abstract/utils.js").Hex) | undefined;
|
|
44
|
+
} | undefined) => import("./abstract/weierstrass.js").SignatureType;
|
|
45
|
+
verify: (signature: import("./abstract/utils.js").Hex | import("./abstract/weierstrass.js").SignatureType, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/weierstrass.js").PubKey, opts?: {
|
|
46
|
+
lowS?: boolean | undefined;
|
|
47
|
+
} | undefined) => boolean;
|
|
48
|
+
Point: import("./abstract/weierstrass.js").PointConstructor<bigint>;
|
|
49
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>;
|
|
50
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
51
|
+
utils: {
|
|
52
|
+
mod: (a: bigint, b?: bigint | undefined) => bigint;
|
|
53
|
+
invert: (number: bigint, modulo?: bigint | undefined) => bigint;
|
|
54
|
+
_bigintToBytes: (num: bigint) => Uint8Array;
|
|
55
|
+
_bigintToString: (num: bigint) => string;
|
|
56
|
+
_normalizePrivateKey: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
57
|
+
_normalizePublicKey: (publicKey: import("./abstract/weierstrass.js").PubKey) => import("./abstract/weierstrass.js").PointType<bigint>;
|
|
58
|
+
_isWithinCurveOrder: (num: bigint) => boolean;
|
|
59
|
+
_isValidFieldElement: (num: bigint) => boolean;
|
|
60
|
+
_weierstrassEquation: (x: bigint) => bigint;
|
|
61
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
62
|
+
hashToPrivateKey: (hash: import("./abstract/utils.js").Hex) => Uint8Array;
|
|
63
|
+
randomPrivateKey: () => Uint8Array;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
export declare const secp256r1: Readonly<{
|
|
67
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
68
|
+
CURVE: Readonly<{
|
|
69
|
+
readonly nBitLength: number;
|
|
70
|
+
readonly nByteLength: number;
|
|
71
|
+
readonly Fp: import("./abstract/modular.js").Field<bigint>;
|
|
72
|
+
readonly n: bigint;
|
|
73
|
+
readonly h: bigint;
|
|
74
|
+
readonly hEff?: bigint | undefined;
|
|
75
|
+
readonly Gx: bigint;
|
|
76
|
+
readonly Gy: bigint;
|
|
77
|
+
readonly wrapPrivateKey?: boolean | undefined;
|
|
78
|
+
readonly allowInfinityPoint?: boolean | undefined;
|
|
79
|
+
readonly a: bigint;
|
|
80
|
+
readonly b: bigint;
|
|
81
|
+
readonly normalizePrivateKey?: ((key: import("./abstract/utils.js").PrivKey) => import("./abstract/utils.js").PrivKey) | undefined;
|
|
82
|
+
readonly endo?: {
|
|
83
|
+
beta: bigint;
|
|
84
|
+
splitScalar: (k: bigint) => {
|
|
85
|
+
k1neg: boolean;
|
|
86
|
+
k1: bigint;
|
|
87
|
+
k2neg: boolean;
|
|
88
|
+
k2: bigint;
|
|
89
|
+
};
|
|
90
|
+
} | undefined;
|
|
91
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => boolean) | undefined;
|
|
92
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => import("./abstract/weierstrass.js").ProjectivePointType<bigint>) | undefined;
|
|
93
|
+
readonly htfDefaults?: import("./abstract/hash-to-curve.js").htfOpts | undefined;
|
|
94
|
+
readonly mapToCurve?: ((scalar: bigint[]) => {
|
|
95
|
+
x: bigint;
|
|
96
|
+
y: bigint;
|
|
97
|
+
}) | undefined;
|
|
98
|
+
lowS: boolean;
|
|
99
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
100
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
101
|
+
readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
|
|
102
|
+
readonly truncateHash?: ((hash: Uint8Array, truncateOnly?: boolean | undefined) => bigint) | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
105
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/weierstrass.js").PubKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
106
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: {
|
|
107
|
+
lowS?: boolean | undefined;
|
|
108
|
+
extraEntropy?: (true | import("./abstract/utils.js").Hex) | undefined;
|
|
109
|
+
} | undefined) => import("./abstract/weierstrass.js").SignatureType;
|
|
110
|
+
verify: (signature: import("./abstract/utils.js").Hex | import("./abstract/weierstrass.js").SignatureType, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/weierstrass.js").PubKey, opts?: {
|
|
111
|
+
lowS?: boolean | undefined;
|
|
112
|
+
} | undefined) => boolean;
|
|
113
|
+
Point: import("./abstract/weierstrass.js").PointConstructor<bigint>;
|
|
114
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>;
|
|
115
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
116
|
+
utils: {
|
|
117
|
+
mod: (a: bigint, b?: bigint | undefined) => bigint;
|
|
118
|
+
invert: (number: bigint, modulo?: bigint | undefined) => bigint;
|
|
119
|
+
_bigintToBytes: (num: bigint) => Uint8Array;
|
|
120
|
+
_bigintToString: (num: bigint) => string;
|
|
121
|
+
_normalizePrivateKey: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
122
|
+
_normalizePublicKey: (publicKey: import("./abstract/weierstrass.js").PubKey) => import("./abstract/weierstrass.js").PointType<bigint>;
|
|
123
|
+
_isWithinCurveOrder: (num: bigint) => boolean;
|
|
124
|
+
_isValidFieldElement: (num: bigint) => boolean;
|
|
125
|
+
_weierstrassEquation: (x: bigint) => bigint;
|
|
126
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
127
|
+
hashToPrivateKey: (hash: import("./abstract/utils.js").Hex) => Uint8Array;
|
|
128
|
+
randomPrivateKey: () => Uint8Array;
|
|
129
|
+
};
|
|
130
|
+
}>;
|
package/lib/p256.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.secp256r1 = exports.P256 = 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
|
+
const weierstrass_js_1 = require("./abstract/weierstrass.js");
|
|
9
|
+
// NIST secp256r1 aka P256
|
|
10
|
+
// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-256
|
|
11
|
+
// Field over which we'll do calculations; 2n**224n * (2n**32n-1n) + 2n**192n + 2n**96n-1n
|
|
12
|
+
const Fp = (0, modular_js_1.Fp)(BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff'));
|
|
13
|
+
const CURVE_A = Fp.create(BigInt('-3'));
|
|
14
|
+
const CURVE_B = BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b');
|
|
15
|
+
const mapSWU = (0, weierstrass_js_1.mapToCurveSimpleSWU)(Fp, {
|
|
16
|
+
A: CURVE_A,
|
|
17
|
+
B: CURVE_B,
|
|
18
|
+
Z: Fp.create(BigInt('-10')),
|
|
19
|
+
});
|
|
20
|
+
exports.P256 = (0, _shortw_utils_js_1.createCurve)({
|
|
21
|
+
// Params: a, b
|
|
22
|
+
a: CURVE_A,
|
|
23
|
+
b: CURVE_B,
|
|
24
|
+
Fp,
|
|
25
|
+
// Curve order, total count of valid points in the field
|
|
26
|
+
n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'),
|
|
27
|
+
// Base point (x, y) aka generator point
|
|
28
|
+
Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'),
|
|
29
|
+
Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'),
|
|
30
|
+
h: BigInt(1),
|
|
31
|
+
lowS: false,
|
|
32
|
+
mapToCurve: (scalars) => mapSWU(scalars[0]),
|
|
33
|
+
htfDefaults: {
|
|
34
|
+
DST: 'P256_XMD:SHA-256_SSWU_RO_',
|
|
35
|
+
p: Fp.ORDER,
|
|
36
|
+
m: 1,
|
|
37
|
+
k: 128,
|
|
38
|
+
expand: true,
|
|
39
|
+
hash: sha256_1.sha256,
|
|
40
|
+
},
|
|
41
|
+
}, sha256_1.sha256);
|
|
42
|
+
exports.secp256r1 = exports.P256;
|
package/lib/p384.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export declare const P384: 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 wrapPrivateKey?: boolean | undefined;
|
|
13
|
+
readonly allowInfinityPoint?: boolean | undefined;
|
|
14
|
+
readonly a: bigint;
|
|
15
|
+
readonly b: bigint;
|
|
16
|
+
readonly normalizePrivateKey?: ((key: import("./abstract/utils.js").PrivKey) => import("./abstract/utils.js").PrivKey) | 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").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => boolean) | undefined;
|
|
27
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => import("./abstract/weierstrass.js").ProjectivePointType<bigint>) | undefined;
|
|
28
|
+
readonly htfDefaults?: import("./abstract/hash-to-curve.js").htfOpts | undefined;
|
|
29
|
+
readonly mapToCurve?: ((scalar: bigint[]) => {
|
|
30
|
+
x: bigint;
|
|
31
|
+
y: bigint;
|
|
32
|
+
}) | undefined;
|
|
33
|
+
lowS: boolean;
|
|
34
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
35
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
36
|
+
readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
|
|
37
|
+
readonly truncateHash?: ((hash: Uint8Array, truncateOnly?: boolean | undefined) => bigint) | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
40
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/weierstrass.js").PubKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
41
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: {
|
|
42
|
+
lowS?: boolean | undefined;
|
|
43
|
+
extraEntropy?: (true | import("./abstract/utils.js").Hex) | undefined;
|
|
44
|
+
} | undefined) => import("./abstract/weierstrass.js").SignatureType;
|
|
45
|
+
verify: (signature: import("./abstract/utils.js").Hex | import("./abstract/weierstrass.js").SignatureType, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/weierstrass.js").PubKey, opts?: {
|
|
46
|
+
lowS?: boolean | undefined;
|
|
47
|
+
} | undefined) => boolean;
|
|
48
|
+
Point: import("./abstract/weierstrass.js").PointConstructor<bigint>;
|
|
49
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>;
|
|
50
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
51
|
+
utils: {
|
|
52
|
+
mod: (a: bigint, b?: bigint | undefined) => bigint;
|
|
53
|
+
invert: (number: bigint, modulo?: bigint | undefined) => bigint;
|
|
54
|
+
_bigintToBytes: (num: bigint) => Uint8Array;
|
|
55
|
+
_bigintToString: (num: bigint) => string;
|
|
56
|
+
_normalizePrivateKey: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
57
|
+
_normalizePublicKey: (publicKey: import("./abstract/weierstrass.js").PubKey) => import("./abstract/weierstrass.js").PointType<bigint>;
|
|
58
|
+
_isWithinCurveOrder: (num: bigint) => boolean;
|
|
59
|
+
_isValidFieldElement: (num: bigint) => boolean;
|
|
60
|
+
_weierstrassEquation: (x: bigint) => bigint;
|
|
61
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
62
|
+
hashToPrivateKey: (hash: import("./abstract/utils.js").Hex) => Uint8Array;
|
|
63
|
+
randomPrivateKey: () => Uint8Array;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
export declare const secp384r1: Readonly<{
|
|
67
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
68
|
+
CURVE: Readonly<{
|
|
69
|
+
readonly nBitLength: number;
|
|
70
|
+
readonly nByteLength: number;
|
|
71
|
+
readonly Fp: import("./abstract/modular.js").Field<bigint>;
|
|
72
|
+
readonly n: bigint;
|
|
73
|
+
readonly h: bigint;
|
|
74
|
+
readonly hEff?: bigint | undefined;
|
|
75
|
+
readonly Gx: bigint;
|
|
76
|
+
readonly Gy: bigint;
|
|
77
|
+
readonly wrapPrivateKey?: boolean | undefined;
|
|
78
|
+
readonly allowInfinityPoint?: boolean | undefined;
|
|
79
|
+
readonly a: bigint;
|
|
80
|
+
readonly b: bigint;
|
|
81
|
+
readonly normalizePrivateKey?: ((key: import("./abstract/utils.js").PrivKey) => import("./abstract/utils.js").PrivKey) | undefined;
|
|
82
|
+
readonly endo?: {
|
|
83
|
+
beta: bigint;
|
|
84
|
+
splitScalar: (k: bigint) => {
|
|
85
|
+
k1neg: boolean;
|
|
86
|
+
k1: bigint;
|
|
87
|
+
k2neg: boolean;
|
|
88
|
+
k2: bigint;
|
|
89
|
+
};
|
|
90
|
+
} | undefined;
|
|
91
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => boolean) | undefined;
|
|
92
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjectivePointType<bigint>) => import("./abstract/weierstrass.js").ProjectivePointType<bigint>) | undefined;
|
|
93
|
+
readonly htfDefaults?: import("./abstract/hash-to-curve.js").htfOpts | undefined;
|
|
94
|
+
readonly mapToCurve?: ((scalar: bigint[]) => {
|
|
95
|
+
x: bigint;
|
|
96
|
+
y: bigint;
|
|
97
|
+
}) | undefined;
|
|
98
|
+
lowS: boolean;
|
|
99
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
100
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
101
|
+
readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
|
|
102
|
+
readonly truncateHash?: ((hash: Uint8Array, truncateOnly?: boolean | undefined) => bigint) | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
105
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/weierstrass.js").PubKey, isCompressed?: boolean | undefined) => Uint8Array;
|
|
106
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: {
|
|
107
|
+
lowS?: boolean | undefined;
|
|
108
|
+
extraEntropy?: (true | import("./abstract/utils.js").Hex) | undefined;
|
|
109
|
+
} | undefined) => import("./abstract/weierstrass.js").SignatureType;
|
|
110
|
+
verify: (signature: import("./abstract/utils.js").Hex | import("./abstract/weierstrass.js").SignatureType, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/weierstrass.js").PubKey, opts?: {
|
|
111
|
+
lowS?: boolean | undefined;
|
|
112
|
+
} | undefined) => boolean;
|
|
113
|
+
Point: import("./abstract/weierstrass.js").PointConstructor<bigint>;
|
|
114
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjectiveConstructor<bigint>;
|
|
115
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
116
|
+
utils: {
|
|
117
|
+
mod: (a: bigint, b?: bigint | undefined) => bigint;
|
|
118
|
+
invert: (number: bigint, modulo?: bigint | undefined) => bigint;
|
|
119
|
+
_bigintToBytes: (num: bigint) => Uint8Array;
|
|
120
|
+
_bigintToString: (num: bigint) => string;
|
|
121
|
+
_normalizePrivateKey: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
122
|
+
_normalizePublicKey: (publicKey: import("./abstract/weierstrass.js").PubKey) => import("./abstract/weierstrass.js").PointType<bigint>;
|
|
123
|
+
_isWithinCurveOrder: (num: bigint) => boolean;
|
|
124
|
+
_isValidFieldElement: (num: bigint) => boolean;
|
|
125
|
+
_weierstrassEquation: (x: bigint) => bigint;
|
|
126
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
127
|
+
hashToPrivateKey: (hash: import("./abstract/utils.js").Hex) => Uint8Array;
|
|
128
|
+
randomPrivateKey: () => Uint8Array;
|
|
129
|
+
};
|
|
130
|
+
}>;
|