@noble/curves 0.5.1 → 0.5.2
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 +1 -4
- package/lib/_shortw_utils.d.ts +2 -6
- package/lib/abstract/bls.d.ts +17 -8
- package/lib/abstract/bls.js +15 -78
- package/lib/abstract/edwards.d.ts +7 -16
- package/lib/abstract/edwards.js +89 -106
- package/lib/abstract/modular.js +26 -23
- package/lib/abstract/montgomery.js +1 -1
- package/lib/abstract/utils.d.ts +5 -3
- package/lib/abstract/utils.js +22 -14
- package/lib/abstract/weierstrass.d.ts +8 -8
- package/lib/abstract/weierstrass.js +209 -168
- package/lib/bls12-381.d.ts +1 -0
- package/lib/bls12-381.js +13 -8
- package/lib/ed25519.js +5 -5
- package/lib/ed448.js +2 -1
- package/lib/esm/abstract/bls.js +19 -82
- package/lib/esm/abstract/edwards.js +90 -107
- package/lib/esm/abstract/modular.js +26 -23
- package/lib/esm/abstract/montgomery.js +2 -4
- package/lib/esm/abstract/utils.js +20 -13
- package/lib/esm/abstract/weierstrass.js +210 -169
- package/lib/esm/bls12-381.js +12 -7
- package/lib/esm/ed25519.js +5 -5
- package/lib/esm/ed448.js +2 -1
- package/lib/esm/jubjub.js +5 -4
- package/lib/esm/secp256k1.js +22 -25
- package/lib/esm/stark.js +3 -2
- package/lib/jubjub.d.ts +1 -0
- package/lib/jubjub.js +5 -4
- package/lib/p192.d.ts +4 -12
- package/lib/p224.d.ts +4 -12
- package/lib/p256.d.ts +4 -12
- package/lib/p384.d.ts +4 -12
- package/lib/p521.d.ts +4 -12
- package/lib/secp256k1.d.ts +2 -6
- package/lib/secp256k1.js +22 -25
- package/lib/stark.d.ts +0 -2
- package/lib/stark.js +3 -2
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
2
|
import * as mod from './modular.js';
|
|
3
|
+
import * as ut from './utils.js';
|
|
3
4
|
import { Hex, PrivKey } from './utils.js';
|
|
4
|
-
import * as utils from './utils.js';
|
|
5
5
|
import { htfOpts } from './hash-to-curve.js';
|
|
6
6
|
import { Group, GroupConstructor } from './group.js';
|
|
7
7
|
declare type HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
@@ -14,10 +14,11 @@ declare type EndomorphismOpts = {
|
|
|
14
14
|
k2: bigint;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
export declare type BasicCurve<T> =
|
|
17
|
+
export declare type BasicCurve<T> = ut.BasicCurve<T> & {
|
|
18
18
|
a: T;
|
|
19
19
|
b: T;
|
|
20
20
|
normalizePrivateKey?: (key: PrivKey) => PrivKey;
|
|
21
|
+
wrapPrivateKey?: boolean;
|
|
21
22
|
endo?: EndomorphismOpts;
|
|
22
23
|
isTorsionFree?: (c: ProjectiveConstructor<T>, point: ProjectivePointType<T>) => boolean;
|
|
23
24
|
clearCofactor?: (c: ProjectiveConstructor<T>, point: ProjectivePointType<T>) => ProjectivePointType<T>;
|
|
@@ -28,7 +29,7 @@ export declare type BasicCurve<T> = utils.BasicCurve<T> & {
|
|
|
28
29
|
};
|
|
29
30
|
};
|
|
30
31
|
declare type Entropy = Hex | true;
|
|
31
|
-
declare type SignOpts = {
|
|
32
|
+
export declare type SignOpts = {
|
|
32
33
|
lowS?: boolean;
|
|
33
34
|
extraEntropy?: Entropy;
|
|
34
35
|
};
|
|
@@ -127,7 +128,7 @@ export declare type SignatureConstructor = {
|
|
|
127
128
|
export declare type PubKey = Hex | PointType<bigint>;
|
|
128
129
|
export declare type CurveType = BasicCurve<bigint> & {
|
|
129
130
|
lowS?: boolean;
|
|
130
|
-
hash:
|
|
131
|
+
hash: ut.CHash;
|
|
131
132
|
hmac: HmacFnSync;
|
|
132
133
|
randomBytes: (bytesLength?: number) => Uint8Array;
|
|
133
134
|
truncateHash?: (hash: Uint8Array, truncateOnly?: boolean) => bigint;
|
|
@@ -145,7 +146,7 @@ declare function validateOpts(curve: CurveType): Readonly<{
|
|
|
145
146
|
readonly allowInfinityPoint?: boolean | undefined;
|
|
146
147
|
readonly a: bigint;
|
|
147
148
|
readonly b: bigint;
|
|
148
|
-
readonly normalizePrivateKey?: ((key: PrivKey) => PrivKey) | undefined;
|
|
149
|
+
readonly normalizePrivateKey?: ((key: ut.PrivKey) => ut.PrivKey) | undefined;
|
|
149
150
|
readonly endo?: EndomorphismOpts | undefined;
|
|
150
151
|
readonly isTorsionFree?: ((c: ProjectiveConstructor<bigint>, point: ProjectivePointType<bigint>) => boolean) | undefined;
|
|
151
152
|
readonly clearCofactor?: ((c: ProjectiveConstructor<bigint>, point: ProjectivePointType<bigint>) => ProjectivePointType<bigint>) | undefined;
|
|
@@ -155,7 +156,7 @@ declare function validateOpts(curve: CurveType): Readonly<{
|
|
|
155
156
|
y: bigint;
|
|
156
157
|
}) | undefined;
|
|
157
158
|
lowS: boolean;
|
|
158
|
-
readonly hash:
|
|
159
|
+
readonly hash: ut.CHash;
|
|
159
160
|
readonly hmac: HmacFnSync;
|
|
160
161
|
readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
|
|
161
162
|
readonly truncateHash?: ((hash: Uint8Array, truncateOnly?: boolean | undefined) => bigint) | undefined;
|
|
@@ -165,6 +166,7 @@ export declare type CurveFn = {
|
|
|
165
166
|
getPublicKey: (privateKey: PrivKey, isCompressed?: boolean) => Uint8Array;
|
|
166
167
|
getSharedSecret: (privateA: PrivKey, publicB: PubKey, isCompressed?: boolean) => Uint8Array;
|
|
167
168
|
sign: (msgHash: Hex, privKey: PrivKey, opts?: SignOpts) => SignatureType;
|
|
169
|
+
signUnhashed: (msg: Uint8Array, privKey: PrivKey, opts?: SignOpts) => SignatureType;
|
|
168
170
|
verify: (signature: Hex | SignatureType, msgHash: Hex, publicKey: PubKey, opts?: {
|
|
169
171
|
lowS?: boolean;
|
|
170
172
|
}) => boolean;
|
|
@@ -172,8 +174,6 @@ export declare type CurveFn = {
|
|
|
172
174
|
ProjectivePoint: ProjectiveConstructor<bigint>;
|
|
173
175
|
Signature: SignatureConstructor;
|
|
174
176
|
utils: {
|
|
175
|
-
mod: (a: bigint, b?: bigint) => bigint;
|
|
176
|
-
invert: (number: bigint, modulo?: bigint) => bigint;
|
|
177
177
|
_bigintToBytes: (num: bigint) => Uint8Array;
|
|
178
178
|
_bigintToString: (num: bigint) => string;
|
|
179
179
|
_normalizePrivateKey: (key: PrivKey) => bigint;
|