@noble/curves 2.0.1 → 2.2.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 +214 -122
- package/abstract/bls.d.ts +299 -16
- package/abstract/bls.d.ts.map +1 -1
- package/abstract/bls.js +82 -22
- package/abstract/bls.js.map +1 -1
- package/abstract/curve.d.ts +274 -27
- package/abstract/curve.d.ts.map +1 -1
- package/abstract/curve.js +177 -23
- package/abstract/curve.js.map +1 -1
- package/abstract/edwards.d.ts +166 -30
- package/abstract/edwards.d.ts.map +1 -1
- package/abstract/edwards.js +221 -86
- package/abstract/edwards.js.map +1 -1
- package/abstract/fft.d.ts +322 -10
- package/abstract/fft.d.ts.map +1 -1
- package/abstract/fft.js +154 -12
- package/abstract/fft.js.map +1 -1
- package/abstract/frost.d.ts +293 -0
- package/abstract/frost.d.ts.map +1 -0
- package/abstract/frost.js +704 -0
- package/abstract/frost.js.map +1 -0
- package/abstract/hash-to-curve.d.ts +173 -24
- package/abstract/hash-to-curve.d.ts.map +1 -1
- package/abstract/hash-to-curve.js +170 -31
- package/abstract/hash-to-curve.js.map +1 -1
- package/abstract/modular.d.ts +429 -37
- package/abstract/modular.d.ts.map +1 -1
- package/abstract/modular.js +414 -119
- package/abstract/modular.js.map +1 -1
- package/abstract/montgomery.d.ts +83 -12
- package/abstract/montgomery.d.ts.map +1 -1
- package/abstract/montgomery.js +32 -7
- package/abstract/montgomery.js.map +1 -1
- package/abstract/oprf.d.ts +164 -91
- package/abstract/oprf.d.ts.map +1 -1
- package/abstract/oprf.js +88 -29
- package/abstract/oprf.js.map +1 -1
- package/abstract/poseidon.d.ts +138 -7
- package/abstract/poseidon.d.ts.map +1 -1
- package/abstract/poseidon.js +178 -15
- package/abstract/poseidon.js.map +1 -1
- package/abstract/tower.d.ts +122 -3
- package/abstract/tower.d.ts.map +1 -1
- package/abstract/tower.js +323 -139
- package/abstract/tower.js.map +1 -1
- package/abstract/weierstrass.d.ts +339 -76
- package/abstract/weierstrass.d.ts.map +1 -1
- package/abstract/weierstrass.js +395 -205
- package/abstract/weierstrass.js.map +1 -1
- package/bls12-381.d.ts +16 -2
- package/bls12-381.d.ts.map +1 -1
- package/bls12-381.js +199 -209
- package/bls12-381.js.map +1 -1
- package/bn254.d.ts +11 -2
- package/bn254.d.ts.map +1 -1
- package/bn254.js +93 -38
- package/bn254.js.map +1 -1
- package/ed25519.d.ts +125 -14
- package/ed25519.d.ts.map +1 -1
- package/ed25519.js +202 -40
- package/ed25519.js.map +1 -1
- package/ed448.d.ts +108 -14
- package/ed448.d.ts.map +1 -1
- package/ed448.js +194 -42
- package/ed448.js.map +1 -1
- package/index.js +7 -1
- package/index.js.map +1 -1
- package/misc.d.ts +106 -7
- package/misc.d.ts.map +1 -1
- package/misc.js +141 -32
- package/misc.js.map +1 -1
- package/nist.d.ts +112 -11
- package/nist.d.ts.map +1 -1
- package/nist.js +139 -17
- package/nist.js.map +1 -1
- package/package.json +11 -6
- package/secp256k1.d.ts +92 -15
- package/secp256k1.d.ts.map +1 -1
- package/secp256k1.js +211 -28
- package/secp256k1.js.map +1 -1
- package/src/abstract/bls.ts +350 -67
- package/src/abstract/curve.ts +327 -44
- package/src/abstract/edwards.ts +367 -143
- package/src/abstract/fft.ts +369 -36
- package/src/abstract/frost.ts +1092 -0
- package/src/abstract/hash-to-curve.ts +255 -56
- package/src/abstract/modular.ts +591 -144
- package/src/abstract/montgomery.ts +114 -30
- package/src/abstract/oprf.ts +383 -194
- package/src/abstract/poseidon.ts +235 -35
- package/src/abstract/tower.ts +428 -159
- package/src/abstract/weierstrass.ts +710 -312
- package/src/bls12-381.ts +239 -236
- package/src/bn254.ts +107 -46
- package/src/ed25519.ts +227 -55
- package/src/ed448.ts +227 -57
- package/src/index.ts +7 -1
- package/src/misc.ts +154 -35
- package/src/nist.ts +143 -20
- package/src/secp256k1.ts +284 -41
- package/src/utils.ts +583 -81
- package/src/webcrypto.ts +302 -73
- package/utils.d.ts +457 -24
- package/utils.d.ts.map +1 -1
- package/utils.js +410 -53
- package/utils.js.map +1 -1
- package/webcrypto.d.ts +167 -25
- package/webcrypto.d.ts.map +1 -1
- package/webcrypto.js +165 -58
- package/webcrypto.js.map +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type CHash } from '../utils.ts';
|
|
1
|
+
import { type CHash, type HmacFn, type TArg, type TRet } from '../utils.ts';
|
|
2
2
|
import { type AffinePoint, type CurveLengths, type CurvePoint, type CurvePointCons } from './curve.ts';
|
|
3
3
|
import { type IField } from './modular.ts';
|
|
4
|
+
/** Shared affine point shape used by Weierstrass helpers. */
|
|
4
5
|
export type { AffinePoint };
|
|
5
6
|
type EndoBasis = [[bigint, bigint], [bigint, bigint]];
|
|
6
7
|
/**
|
|
@@ -24,11 +25,17 @@ type EndoBasis = [[bigint, bigint], [bigint, bigint]];
|
|
|
24
25
|
* Gauss lattice reduction calculates them from initial basis vectors `(n, 0), (-λ, 0)`
|
|
25
26
|
*
|
|
26
27
|
* Check out `test/misc/endomorphism.js` and
|
|
27
|
-
*
|
|
28
|
+
* {@link https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 | this endomorphism gist}.
|
|
28
29
|
*/
|
|
29
30
|
export type EndomorphismOpts = {
|
|
31
|
+
/** Cube root of unity used by the GLV endomorphism. */
|
|
30
32
|
beta: bigint;
|
|
33
|
+
/** Reduced lattice basis used for scalar splitting. */
|
|
31
34
|
basises?: EndoBasis;
|
|
35
|
+
/**
|
|
36
|
+
* Optional custom scalar-splitting helper.
|
|
37
|
+
* Receives one scalar and returns two half-sized scalar components.
|
|
38
|
+
*/
|
|
32
39
|
splitScalar?: (k: bigint) => {
|
|
33
40
|
k1neg: boolean;
|
|
34
41
|
k1: bigint;
|
|
@@ -36,15 +43,18 @@ export type EndomorphismOpts = {
|
|
|
36
43
|
k2: bigint;
|
|
37
44
|
};
|
|
38
45
|
};
|
|
46
|
+
/** Two half-sized scalar components returned by endomorphism splitting. */
|
|
39
47
|
export type ScalarEndoParts = {
|
|
48
|
+
/** Whether the first split scalar should be negated. */
|
|
40
49
|
k1neg: boolean;
|
|
50
|
+
/** Absolute value of the first split scalar. */
|
|
41
51
|
k1: bigint;
|
|
52
|
+
/** Whether the second split scalar should be negated. */
|
|
42
53
|
k2neg: boolean;
|
|
54
|
+
/** Absolute value of the second split scalar. */
|
|
43
55
|
k2: bigint;
|
|
44
56
|
};
|
|
45
|
-
/**
|
|
46
|
-
* Splits scalar for GLV endomorphism.
|
|
47
|
-
*/
|
|
57
|
+
/** Splits scalar for GLV endomorphism. */
|
|
48
58
|
export declare function _splitEndoScalar(k: bigint, basis: EndoBasis, n: bigint): ScalarEndoParts;
|
|
49
59
|
/**
|
|
50
60
|
* Option to enable hedged signatures with improved security.
|
|
@@ -60,7 +70,7 @@ export declare function _splitEndoScalar(k: bigint, basis: EndoBasis, n: bigint)
|
|
|
60
70
|
* * `false` means "disable extra entropy, use purely deterministic k"
|
|
61
71
|
* * `Uint8Array` passed means "incorporate following data into k generation"
|
|
62
72
|
*
|
|
63
|
-
* https://paulmillr.com/posts/deterministic-signatures/
|
|
73
|
+
* See {@link https://paulmillr.com/posts/deterministic-signatures/ | deterministic signatures}.
|
|
64
74
|
*/
|
|
65
75
|
export type ECDSAExtraEntropy = boolean | Uint8Array;
|
|
66
76
|
/**
|
|
@@ -74,39 +84,48 @@ export type ECDSASignatureFormat = 'compact' | 'recovered' | 'der';
|
|
|
74
84
|
* When a custom hash is used, it must be set to `false`.
|
|
75
85
|
*/
|
|
76
86
|
export type ECDSARecoverOpts = {
|
|
87
|
+
/** Whether to hash the message before signature recovery. */
|
|
77
88
|
prehash?: boolean;
|
|
78
89
|
};
|
|
79
90
|
/**
|
|
80
91
|
* - `prehash`: (default: true) indicates whether to do sha256(message).
|
|
81
92
|
* When a custom hash is used, it must be set to `false`.
|
|
82
|
-
* - `lowS`: (default: true) prohibits signatures
|
|
93
|
+
* - `lowS`: (default: true) prohibits signatures with `sig.s >= CURVE.n/2n`.
|
|
83
94
|
* Compatible with BTC/ETH. Setting `lowS: false` allows to create malleable signatures,
|
|
84
95
|
* which is default openssl behavior.
|
|
85
96
|
* Non-malleable signatures can still be successfully verified in openssl.
|
|
86
97
|
* - `format`: (default: 'compact') 'compact' or 'recovered' with recovery byte
|
|
87
98
|
*/
|
|
88
99
|
export type ECDSAVerifyOpts = {
|
|
100
|
+
/** Whether to hash the message before verification. */
|
|
89
101
|
prehash?: boolean;
|
|
102
|
+
/** Whether to reject high-S signatures. */
|
|
90
103
|
lowS?: boolean;
|
|
104
|
+
/** Signature encoding to accept. */
|
|
91
105
|
format?: ECDSASignatureFormat;
|
|
92
106
|
};
|
|
93
107
|
/**
|
|
94
108
|
* - `prehash`: (default: true) indicates whether to do sha256(message).
|
|
95
109
|
* When a custom hash is used, it must be set to `false`.
|
|
96
|
-
* - `lowS`: (default: true) prohibits signatures
|
|
110
|
+
* - `lowS`: (default: true) prohibits signatures with `sig.s >= CURVE.n/2n`.
|
|
97
111
|
* Compatible with BTC/ETH. Setting `lowS: false` allows to create malleable signatures,
|
|
98
112
|
* which is default openssl behavior.
|
|
99
113
|
* Non-malleable signatures can still be successfully verified in openssl.
|
|
100
114
|
* - `format`: (default: 'compact') 'compact' or 'recovered' with recovery byte
|
|
101
|
-
* - `extraEntropy`: (default: false) creates
|
|
115
|
+
* - `extraEntropy`: (default: false) creates signatures with increased
|
|
116
|
+
* security, see {@link ECDSAExtraEntropy}
|
|
102
117
|
*/
|
|
103
118
|
export type ECDSASignOpts = {
|
|
119
|
+
/** Whether to hash the message before signing. */
|
|
104
120
|
prehash?: boolean;
|
|
121
|
+
/** Whether to normalize signatures into the low-S half-order. */
|
|
105
122
|
lowS?: boolean;
|
|
123
|
+
/** Signature encoding to produce. */
|
|
106
124
|
format?: ECDSASignatureFormat;
|
|
125
|
+
/** Optional hedging input for deterministic k generation. */
|
|
107
126
|
extraEntropy?: ECDSAExtraEntropy;
|
|
108
127
|
};
|
|
109
|
-
/**
|
|
128
|
+
/** Projective XYZ point used by short Weierstrass curves. */
|
|
110
129
|
export interface WeierstrassPoint<T> extends CurvePoint<T, WeierstrassPoint<T>> {
|
|
111
130
|
/** projective X coordinate. Different from affine x. */
|
|
112
131
|
readonly X: T;
|
|
@@ -118,14 +137,27 @@ export interface WeierstrassPoint<T> extends CurvePoint<T, WeierstrassPoint<T>>
|
|
|
118
137
|
get x(): T;
|
|
119
138
|
/** affine y coordinate. Different from projective Y. */
|
|
120
139
|
get y(): T;
|
|
121
|
-
/**
|
|
122
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Encode the point into compressed or uncompressed SEC1 bytes.
|
|
142
|
+
* @param isCompressed - Whether to use the compressed form.
|
|
143
|
+
* @returns Encoded point bytes.
|
|
144
|
+
*/
|
|
145
|
+
toBytes(isCompressed?: boolean): TRet<Uint8Array>;
|
|
146
|
+
/**
|
|
147
|
+
* Encode the point into compressed or uncompressed SEC1 hex.
|
|
148
|
+
* @param isCompressed - Whether to use the compressed form.
|
|
149
|
+
* @returns Encoded point hex.
|
|
150
|
+
*/
|
|
123
151
|
toHex(isCompressed?: boolean): string;
|
|
124
152
|
}
|
|
125
|
-
/**
|
|
153
|
+
/** Constructor and metadata helpers for Weierstrass points. */
|
|
126
154
|
export interface WeierstrassPointCons<T> extends CurvePointCons<WeierstrassPoint<T>> {
|
|
127
155
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
128
156
|
new (X: T, Y: T, Z: T): WeierstrassPoint<T>;
|
|
157
|
+
/**
|
|
158
|
+
* Return the curve parameters captured by this point constructor.
|
|
159
|
+
* @returns Curve parameters.
|
|
160
|
+
*/
|
|
129
161
|
CURVE(): WeierstrassOpts<T>;
|
|
130
162
|
}
|
|
131
163
|
/**
|
|
@@ -140,56 +172,108 @@ export interface WeierstrassPointCons<T> extends CurvePointCons<WeierstrassPoint
|
|
|
140
172
|
* * Gy: y coordinate of generator point
|
|
141
173
|
*/
|
|
142
174
|
export type WeierstrassOpts<T> = Readonly<{
|
|
175
|
+
/** Base-field modulus. */
|
|
143
176
|
p: bigint;
|
|
177
|
+
/** Prime subgroup order. */
|
|
144
178
|
n: bigint;
|
|
179
|
+
/** Curve cofactor. */
|
|
145
180
|
h: bigint;
|
|
181
|
+
/** Weierstrass curve parameter `a`. */
|
|
146
182
|
a: T;
|
|
183
|
+
/** Weierstrass curve parameter `b`. */
|
|
147
184
|
b: T;
|
|
185
|
+
/** Generator x coordinate. */
|
|
148
186
|
Gx: T;
|
|
187
|
+
/** Generator y coordinate. */
|
|
149
188
|
Gy: T;
|
|
150
189
|
}>;
|
|
190
|
+
/**
|
|
191
|
+
* Optional helpers and overrides for a Weierstrass point constructor.
|
|
192
|
+
*
|
|
193
|
+
* When a cofactor != 1, there can be effective methods to:
|
|
194
|
+
* 1. Determine whether a point is torsion-free
|
|
195
|
+
* 2. Clear torsion component
|
|
196
|
+
*/
|
|
151
197
|
export type WeierstrassExtraOpts<T> = Partial<{
|
|
198
|
+
/** Optional base-field override. */
|
|
152
199
|
Fp: IField<T>;
|
|
200
|
+
/** Optional scalar-field override. */
|
|
153
201
|
Fn: IField<bigint>;
|
|
202
|
+
/** Whether the point constructor accepts infinity points. */
|
|
154
203
|
allowInfinityPoint: boolean;
|
|
204
|
+
/** Optional GLV endomorphism data. */
|
|
155
205
|
endo: EndomorphismOpts;
|
|
206
|
+
/** Optional torsion-check override. */
|
|
156
207
|
isTorsionFree: (c: WeierstrassPointCons<T>, point: WeierstrassPoint<T>) => boolean;
|
|
208
|
+
/** Optional cofactor-clearing override. */
|
|
157
209
|
clearCofactor: (c: WeierstrassPointCons<T>, point: WeierstrassPoint<T>) => WeierstrassPoint<T>;
|
|
158
|
-
|
|
159
|
-
|
|
210
|
+
/** Optional custom point decoder. */
|
|
211
|
+
fromBytes: (bytes: TArg<Uint8Array>) => AffinePoint<T>;
|
|
212
|
+
/** Optional custom point encoder. */
|
|
213
|
+
toBytes: (c: WeierstrassPointCons<T>, point: WeierstrassPoint<T>, isCompressed: boolean) => TRet<Uint8Array>;
|
|
160
214
|
}>;
|
|
161
215
|
/**
|
|
162
216
|
* Options for ECDSA signatures over a Weierstrass curve.
|
|
163
217
|
*
|
|
164
|
-
* * lowS: (default: true) whether produced
|
|
218
|
+
* * lowS: (default: true) whether produced or verified signatures occupy the
|
|
219
|
+
* low half of `ecdsaOpts.n`. Prevents malleability.
|
|
165
220
|
* * hmac: (default: noble-hashes hmac) function, would be used to init hmac-drbg for k generation.
|
|
166
221
|
* * randomBytes: (default: webcrypto os-level CSPRNG) custom method for fetching secure randomness.
|
|
167
|
-
* * bits2int, bits2int_modN: used in sigs, sometimes overridden by curves
|
|
222
|
+
* * bits2int, bits2int_modN: used in sigs, sometimes overridden by curves. Custom hooks are
|
|
223
|
+
* treated as pure functions over validated bytes and MUST NOT mutate caller-owned buffers or
|
|
224
|
+
* closure-captured option bags. `bits2int_modN` must also return a canonical scalar in
|
|
225
|
+
* `[0..Point.Fn.ORDER-1]`.
|
|
168
226
|
*/
|
|
169
227
|
export type ECDSAOpts = Partial<{
|
|
228
|
+
/** Default low-S policy for this ECDSA instance. */
|
|
170
229
|
lowS: boolean;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
230
|
+
/** HMAC implementation used by RFC6979 DRBG. */
|
|
231
|
+
hmac: HmacFn;
|
|
232
|
+
/** RNG override used by helper constructors. */
|
|
233
|
+
randomBytes: (bytesLength?: number) => TRet<Uint8Array>;
|
|
234
|
+
/** Hash-to-integer conversion override. */
|
|
235
|
+
bits2int: (bytes: TArg<Uint8Array>) => bigint;
|
|
236
|
+
/** Hash-to-integer-mod-n conversion override. Returns a canonical scalar in `[0..Fn.ORDER-1]`. */
|
|
237
|
+
bits2int_modN: (bytes: TArg<Uint8Array>) => bigint;
|
|
175
238
|
}>;
|
|
176
|
-
/**
|
|
177
|
-
* Elliptic Curve Diffie-Hellman interface.
|
|
178
|
-
* Provides keygen, secret-to-public conversion, calculating shared secrets.
|
|
179
|
-
*/
|
|
239
|
+
/** Elliptic Curve Diffie-Hellman helper namespace. */
|
|
180
240
|
export interface ECDH {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Generate a secret/public key pair.
|
|
243
|
+
* @param seed - Optional seed material.
|
|
244
|
+
* @returns Secret/public key pair.
|
|
245
|
+
*/
|
|
246
|
+
keygen: (seed?: TArg<Uint8Array>) => {
|
|
247
|
+
secretKey: TRet<Uint8Array>;
|
|
248
|
+
publicKey: TRet<Uint8Array>;
|
|
184
249
|
};
|
|
185
|
-
|
|
186
|
-
|
|
250
|
+
/**
|
|
251
|
+
* Derive the public key from a secret key.
|
|
252
|
+
* @param secretKey - Secret key bytes.
|
|
253
|
+
* @param isCompressed - Whether to emit compressed SEC1 bytes.
|
|
254
|
+
* @returns Encoded public key.
|
|
255
|
+
*/
|
|
256
|
+
getPublicKey: (secretKey: TArg<Uint8Array>, isCompressed?: boolean) => TRet<Uint8Array>;
|
|
257
|
+
/**
|
|
258
|
+
* Compute the shared secret point from a secret key and peer public key.
|
|
259
|
+
* @param secretKeyA - Local secret key bytes.
|
|
260
|
+
* @param publicKeyB - Peer public key bytes.
|
|
261
|
+
* @param isCompressed - Whether to emit compressed SEC1 bytes.
|
|
262
|
+
* @returns Encoded shared point.
|
|
263
|
+
*/
|
|
264
|
+
getSharedSecret: (secretKeyA: TArg<Uint8Array>, publicKeyB: TArg<Uint8Array>, isCompressed?: boolean) => TRet<Uint8Array>;
|
|
265
|
+
/** Point constructor used by this ECDH instance. */
|
|
187
266
|
Point: WeierstrassPointCons<bigint>;
|
|
267
|
+
/** Validation and random-key helpers. */
|
|
188
268
|
utils: {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
269
|
+
/** Check whether a secret key has the expected encoding. */
|
|
270
|
+
isValidSecretKey: (secretKey: TArg<Uint8Array>) => boolean;
|
|
271
|
+
/** Check whether a public key decodes to a valid point. */
|
|
272
|
+
isValidPublicKey: (publicKey: TArg<Uint8Array>, isCompressed?: boolean) => boolean;
|
|
273
|
+
/** Generate a valid random secret key. */
|
|
274
|
+
randomSecretKey: (seed?: TArg<Uint8Array>) => TRet<Uint8Array>;
|
|
192
275
|
};
|
|
276
|
+
/** Byte lengths for keys and signatures exposed by this curve. */
|
|
193
277
|
lengths: CurveLengths;
|
|
194
278
|
}
|
|
195
279
|
/**
|
|
@@ -197,31 +281,103 @@ export interface ECDH {
|
|
|
197
281
|
* Only supported for prime fields, not Fp2 (extension fields).
|
|
198
282
|
*/
|
|
199
283
|
export interface ECDSA extends ECDH {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Sign a message with the given secret key.
|
|
286
|
+
* @param message - Message bytes.
|
|
287
|
+
* @param secretKey - Secret key bytes.
|
|
288
|
+
* @param opts - Optional signing tweaks. See {@link ECDSASignOpts}.
|
|
289
|
+
* @returns Encoded signature bytes.
|
|
290
|
+
*/
|
|
291
|
+
sign: (message: TArg<Uint8Array>, secretKey: TArg<Uint8Array>, opts?: TArg<ECDSASignOpts>) => TRet<Uint8Array>;
|
|
292
|
+
/**
|
|
293
|
+
* Verify a signature against a message and public key.
|
|
294
|
+
* @param signature - Encoded signature bytes.
|
|
295
|
+
* @param message - Message bytes.
|
|
296
|
+
* @param publicKey - Encoded public key.
|
|
297
|
+
* @param opts - Optional verification tweaks. See {@link ECDSAVerifyOpts}.
|
|
298
|
+
* @returns Whether the signature is valid.
|
|
299
|
+
*/
|
|
300
|
+
verify: (signature: TArg<Uint8Array>, message: TArg<Uint8Array>, publicKey: TArg<Uint8Array>, opts?: TArg<ECDSAVerifyOpts>) => boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Recover the public key encoded into a recoverable signature.
|
|
303
|
+
* @param signature - Recoverable signature bytes.
|
|
304
|
+
* @param message - Message bytes.
|
|
305
|
+
* @param opts - Optional recovery tweaks. See {@link ECDSARecoverOpts}.
|
|
306
|
+
* @returns Encoded recovered public key.
|
|
307
|
+
*/
|
|
308
|
+
recoverPublicKey(signature: TArg<Uint8Array>, message: TArg<Uint8Array>, opts?: TArg<ECDSARecoverOpts>): TRet<Uint8Array>;
|
|
309
|
+
/** Signature constructor and parser helpers. */
|
|
203
310
|
Signature: ECDSASignatureCons;
|
|
204
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* @param m - Error message.
|
|
314
|
+
* @example
|
|
315
|
+
* Throw a DER-specific error when signature parsing encounters invalid bytes.
|
|
316
|
+
*
|
|
317
|
+
* ```ts
|
|
318
|
+
* new DERErr('bad der');
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
205
321
|
export declare class DERErr extends Error {
|
|
206
322
|
constructor(m?: string);
|
|
207
323
|
}
|
|
324
|
+
/** DER helper namespace used by ECDSA signature parsing and encoding. */
|
|
208
325
|
export type IDER = {
|
|
326
|
+
/**
|
|
327
|
+
* DER-specific error constructor.
|
|
328
|
+
* @param m - Error message.
|
|
329
|
+
* @returns DER-specific error instance.
|
|
330
|
+
*/
|
|
209
331
|
Err: typeof DERErr;
|
|
332
|
+
/** Low-level tag-length-value helpers used by DER encoders. */
|
|
210
333
|
_tlv: {
|
|
334
|
+
/**
|
|
335
|
+
* Encode one TLV record.
|
|
336
|
+
* @param tag - ASN.1 tag byte.
|
|
337
|
+
* @param data - Hex-encoded value payload.
|
|
338
|
+
* @returns Encoded TLV string.
|
|
339
|
+
*/
|
|
211
340
|
encode: (tag: number, data: string) => string;
|
|
212
|
-
|
|
341
|
+
/**
|
|
342
|
+
* Decode one TLV record and return the value plus leftover bytes.
|
|
343
|
+
* @param tag - Expected ASN.1 tag byte.
|
|
344
|
+
* @param data - Remaining DER bytes.
|
|
345
|
+
* @returns Parsed value plus leftover bytes.
|
|
346
|
+
*/
|
|
347
|
+
decode(tag: number, data: TArg<Uint8Array>): TRet<{
|
|
213
348
|
v: Uint8Array;
|
|
214
349
|
l: Uint8Array;
|
|
215
|
-
}
|
|
350
|
+
}>;
|
|
216
351
|
};
|
|
352
|
+
/** Positive-integer DER helpers used by ECDSA signature encoding. */
|
|
217
353
|
_int: {
|
|
354
|
+
/**
|
|
355
|
+
* Encode one positive bigint as a DER INTEGER.
|
|
356
|
+
* @param num - Positive integer to encode.
|
|
357
|
+
* @returns Encoded DER INTEGER.
|
|
358
|
+
*/
|
|
218
359
|
encode(num: bigint): string;
|
|
219
|
-
|
|
360
|
+
/**
|
|
361
|
+
* Decode one DER INTEGER into a bigint.
|
|
362
|
+
* @param data - DER INTEGER bytes.
|
|
363
|
+
* @returns Decoded bigint.
|
|
364
|
+
*/
|
|
365
|
+
decode(data: TArg<Uint8Array>): bigint;
|
|
220
366
|
};
|
|
221
|
-
|
|
367
|
+
/**
|
|
368
|
+
* Parse a DER signature into `{ r, s }`.
|
|
369
|
+
* @param bytes - DER signature bytes.
|
|
370
|
+
* @returns Parsed signature components.
|
|
371
|
+
*/
|
|
372
|
+
toSig(bytes: TArg<Uint8Array>): {
|
|
222
373
|
r: bigint;
|
|
223
374
|
s: bigint;
|
|
224
375
|
};
|
|
376
|
+
/**
|
|
377
|
+
* Encode `{ r, s }` as a DER signature.
|
|
378
|
+
* @param sig - Signature components.
|
|
379
|
+
* @returns DER-encoded signature hex.
|
|
380
|
+
*/
|
|
225
381
|
hexFromSig(sig: {
|
|
226
382
|
r: bigint;
|
|
227
383
|
s: bigint;
|
|
@@ -232,46 +388,99 @@ export type IDER = {
|
|
|
232
388
|
*
|
|
233
389
|
* [0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S]
|
|
234
390
|
*
|
|
235
|
-
* Docs: https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der
|
|
391
|
+
* Docs: {@link https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/ | Let's Encrypt ASN.1 guide} and
|
|
392
|
+
* {@link https://luca.ntop.org/Teaching/Appunti/asn1.html | Luca Deri's ASN.1 notes}.
|
|
393
|
+
* @example
|
|
394
|
+
* ASN.1 DER encoding utilities.
|
|
395
|
+
*
|
|
396
|
+
* ```ts
|
|
397
|
+
* const der = DER.hexFromSig({ r: 1n, s: 2n });
|
|
398
|
+
* ```
|
|
236
399
|
*/
|
|
237
400
|
export declare const DER: IDER;
|
|
238
401
|
/**
|
|
239
402
|
* Creates weierstrass Point constructor, based on specified curve options.
|
|
240
403
|
*
|
|
241
404
|
* See {@link WeierstrassOpts}.
|
|
405
|
+
* @param params - Curve parameters. See {@link WeierstrassOpts}.
|
|
406
|
+
* @param extraOpts - Optional helpers and overrides. See {@link WeierstrassExtraOpts}.
|
|
407
|
+
* @returns Weierstrass point constructor.
|
|
408
|
+
* @throws If the curve parameters, overrides, or point codecs are invalid. {@link Error}
|
|
242
409
|
*
|
|
243
410
|
* @example
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
411
|
+
* Construct a point type from explicit Weierstrass curve parameters.
|
|
412
|
+
*
|
|
413
|
+
* ```js
|
|
414
|
+
* const opts = {
|
|
415
|
+
* p: 0xfffffffffffffffffffffffffffffffeffffac73n,
|
|
416
|
+
* n: 0x100000000000000000001b8fa16dfab9aca16b6b3n,
|
|
417
|
+
* h: 1n,
|
|
418
|
+
* a: 0n,
|
|
419
|
+
* b: 7n,
|
|
420
|
+
* Gx: 0x3b4c382ce37aa192a4019e763036f4f5dd4d7ebbn,
|
|
421
|
+
* Gy: 0x938cf935318fdced6bc28286531733c3f03c4feen,
|
|
422
|
+
* };
|
|
423
|
+
* const secp160k1_Point = weierstrass(opts);
|
|
424
|
+
* ```
|
|
256
425
|
*/
|
|
257
426
|
export declare function weierstrass<T>(params: WeierstrassOpts<T>, extraOpts?: WeierstrassExtraOpts<T>): WeierstrassPointCons<T>;
|
|
258
|
-
/**
|
|
427
|
+
/** Parsed ECDSA signature with helpers for recovery and re-encoding. */
|
|
259
428
|
export interface ECDSASignature {
|
|
429
|
+
/** Signature component `r`. */
|
|
260
430
|
readonly r: bigint;
|
|
431
|
+
/** Signature component `s`. */
|
|
261
432
|
readonly s: bigint;
|
|
433
|
+
/** Optional recovery bit for recoverable signatures. */
|
|
262
434
|
readonly recovery?: number;
|
|
435
|
+
/**
|
|
436
|
+
* Return a copy of the signature with a recovery bit attached.
|
|
437
|
+
* @param recovery - Recovery bit to attach.
|
|
438
|
+
* @returns Signature with an attached recovery bit.
|
|
439
|
+
*/
|
|
263
440
|
addRecoveryBit(recovery: number): ECDSASignature & {
|
|
264
441
|
readonly recovery: number;
|
|
265
442
|
};
|
|
443
|
+
/**
|
|
444
|
+
* Check whether the signature uses the high-S half-order.
|
|
445
|
+
* @returns Whether the signature uses the high-S half-order.
|
|
446
|
+
*/
|
|
266
447
|
hasHighS(): boolean;
|
|
267
|
-
|
|
268
|
-
|
|
448
|
+
/**
|
|
449
|
+
* Recover the public key from the hashed message and recovery bit.
|
|
450
|
+
* @param messageHash - Hashed message bytes.
|
|
451
|
+
* @returns Recovered public-key point.
|
|
452
|
+
*/
|
|
453
|
+
recoverPublicKey(messageHash: TArg<Uint8Array>): WeierstrassPoint<bigint>;
|
|
454
|
+
/**
|
|
455
|
+
* Encode the signature into bytes.
|
|
456
|
+
* @param format - Signature encoding to produce.
|
|
457
|
+
* @returns Encoded signature bytes.
|
|
458
|
+
*/
|
|
459
|
+
toBytes(format?: string): TRet<Uint8Array>;
|
|
460
|
+
/**
|
|
461
|
+
* Encode the signature into hex.
|
|
462
|
+
* @param format - Signature encoding to produce.
|
|
463
|
+
* @returns Encoded signature hex.
|
|
464
|
+
*/
|
|
269
465
|
toHex(format?: string): string;
|
|
270
466
|
}
|
|
271
|
-
/**
|
|
467
|
+
/** Constructor and decoding helpers for ECDSA signatures. */
|
|
272
468
|
export type ECDSASignatureCons = {
|
|
469
|
+
/** Create a signature from `r`, `s`, and an optional recovery bit. */
|
|
273
470
|
new (r: bigint, s: bigint, recovery?: number): ECDSASignature;
|
|
274
|
-
|
|
471
|
+
/**
|
|
472
|
+
* Decode a signature from bytes.
|
|
473
|
+
* @param bytes - Encoded signature bytes.
|
|
474
|
+
* @param format - Signature encoding to parse.
|
|
475
|
+
* @returns Parsed signature.
|
|
476
|
+
*/
|
|
477
|
+
fromBytes(bytes: TArg<Uint8Array>, format?: ECDSASignatureFormat): ECDSASignature;
|
|
478
|
+
/**
|
|
479
|
+
* Decode a signature from hex.
|
|
480
|
+
* @param hex - Encoded signature hex.
|
|
481
|
+
* @param format - Signature encoding to parse.
|
|
482
|
+
* @returns Parsed signature.
|
|
483
|
+
*/
|
|
275
484
|
fromHex(hex: string, format?: ECDSASignatureFormat): ECDSASignature;
|
|
276
485
|
};
|
|
277
486
|
/**
|
|
@@ -279,19 +488,47 @@ export type ECDSASignatureCons = {
|
|
|
279
488
|
* TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular.
|
|
280
489
|
* b = True and y = sqrt(u / v) if (u / v) is square in F, and
|
|
281
490
|
* b = False and y = sqrt(Z * (u / v)) otherwise.
|
|
282
|
-
*
|
|
283
|
-
* @param
|
|
284
|
-
* @
|
|
491
|
+
* RFC 9380 expects callers to provide `v != 0`; this helper does not enforce it.
|
|
492
|
+
* @param Fp - Field implementation.
|
|
493
|
+
* @param Z - Simplified SWU map parameter.
|
|
494
|
+
* @returns Square-root ratio helper.
|
|
495
|
+
* @example
|
|
496
|
+
* Build the square-root ratio helper used by SWU map implementations.
|
|
497
|
+
*
|
|
498
|
+
* ```ts
|
|
499
|
+
* import { SWUFpSqrtRatio } from '@noble/curves/abstract/weierstrass.js';
|
|
500
|
+
* import { Field } from '@noble/curves/abstract/modular.js';
|
|
501
|
+
* const Fp = Field(17n);
|
|
502
|
+
* const sqrtRatio = SWUFpSqrtRatio(Fp, 3n);
|
|
503
|
+
* const out = sqrtRatio(4n, 1n);
|
|
504
|
+
* ```
|
|
285
505
|
*/
|
|
286
|
-
export declare function SWUFpSqrtRatio<T>(Fp: IField<T
|
|
506
|
+
export declare function SWUFpSqrtRatio<T>(Fp: TArg<IField<T>>, Z: T): (u: T, v: T) => {
|
|
287
507
|
isValid: boolean;
|
|
288
508
|
value: T;
|
|
289
509
|
};
|
|
290
510
|
/**
|
|
291
511
|
* Simplified Shallue-van de Woestijne-Ulas Method
|
|
292
|
-
* https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2
|
|
512
|
+
* See {@link https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2 | RFC 9380 section 6.6.2}.
|
|
513
|
+
* @param Fp - Field implementation.
|
|
514
|
+
* @param opts - SWU parameters:
|
|
515
|
+
* - `A`: Curve parameter `A`.
|
|
516
|
+
* - `B`: Curve parameter `B`.
|
|
517
|
+
* - `Z`: Simplified SWU map parameter.
|
|
518
|
+
* @returns Deterministic map-to-curve function.
|
|
519
|
+
* @throws If the SWU parameters are invalid or the field lacks the required helpers. {@link Error}
|
|
520
|
+
* @example
|
|
521
|
+
* Map one field element to a Weierstrass curve point with the SWU recipe.
|
|
522
|
+
*
|
|
523
|
+
* ```ts
|
|
524
|
+
* import { mapToCurveSimpleSWU } from '@noble/curves/abstract/weierstrass.js';
|
|
525
|
+
* import { Field } from '@noble/curves/abstract/modular.js';
|
|
526
|
+
* const Fp = Field(17n);
|
|
527
|
+
* const map = mapToCurveSimpleSWU(Fp, { A: 1n, B: 2n, Z: 3n });
|
|
528
|
+
* const point = map(5n);
|
|
529
|
+
* ```
|
|
293
530
|
*/
|
|
294
|
-
export declare function mapToCurveSimpleSWU<T>(Fp: IField<T
|
|
531
|
+
export declare function mapToCurveSimpleSWU<T>(Fp: TArg<IField<T>>, opts: {
|
|
295
532
|
A: T;
|
|
296
533
|
B: T;
|
|
297
534
|
Z: T;
|
|
@@ -302,24 +539,50 @@ export declare function mapToCurveSimpleSWU<T>(Fp: IField<T>, opts: {
|
|
|
302
539
|
/**
|
|
303
540
|
* Sometimes users only need getPublicKey, getSharedSecret, and secret key handling.
|
|
304
541
|
* This helper ensures no signature functionality is present. Less code, smaller bundle size.
|
|
542
|
+
* @param Point - Weierstrass point constructor.
|
|
543
|
+
* @param ecdhOpts - Optional randomness helpers:
|
|
544
|
+
* - `randomBytes` (optional): Optional RNG override.
|
|
545
|
+
* @returns ECDH helper namespace.
|
|
546
|
+
* @example
|
|
547
|
+
* Sometimes users only need getPublicKey, getSharedSecret, and secret key handling.
|
|
548
|
+
*
|
|
549
|
+
* ```ts
|
|
550
|
+
* import { ecdh } from '@noble/curves/abstract/weierstrass.js';
|
|
551
|
+
* import { p256 } from '@noble/curves/nist.js';
|
|
552
|
+
* const dh = ecdh(p256.Point);
|
|
553
|
+
* const alice = dh.keygen();
|
|
554
|
+
* const shared = dh.getSharedSecret(alice.secretKey, alice.publicKey);
|
|
555
|
+
* ```
|
|
305
556
|
*/
|
|
306
|
-
export declare function ecdh(Point: WeierstrassPointCons<bigint>, ecdhOpts?: {
|
|
307
|
-
randomBytes?: (bytesLength?: number) => Uint8Array
|
|
308
|
-
}): ECDH;
|
|
557
|
+
export declare function ecdh(Point: WeierstrassPointCons<bigint>, ecdhOpts?: TArg<{
|
|
558
|
+
randomBytes?: (bytesLength?: number) => TRet<Uint8Array>;
|
|
559
|
+
}>): ECDH;
|
|
309
560
|
/**
|
|
310
561
|
* Creates ECDSA signing interface for given elliptic curve `Point` and `hash` function.
|
|
311
562
|
*
|
|
312
|
-
* @param Point created using {@link weierstrass} function
|
|
313
|
-
* @param hash used for 1) message prehash-ing 2) k generation in `sign`, using hmac_drbg(hash)
|
|
314
|
-
* @param ecdsaOpts rarely needed, see {@link ECDSAOpts}
|
|
563
|
+
* @param Point - created using {@link weierstrass} function
|
|
564
|
+
* @param hash - used for 1) message prehash-ing 2) k generation in `sign`, using hmac_drbg(hash)
|
|
565
|
+
* @param ecdsaOpts - rarely needed, see {@link ECDSAOpts}:
|
|
566
|
+
* - `lowS`: Default low-S policy.
|
|
567
|
+
* - `hmac`: HMAC implementation used by RFC6979 DRBG.
|
|
568
|
+
* - `randomBytes`: Optional RNG override.
|
|
569
|
+
* - `bits2int`: Optional hash-to-int conversion override.
|
|
570
|
+
* - `bits2int_modN`: Optional hash-to-int-mod-n conversion override.
|
|
315
571
|
*
|
|
572
|
+
* @returns ECDSA helper namespace.
|
|
316
573
|
* @example
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
574
|
+
* Create an ECDSA signer/verifier bundle for one curve implementation.
|
|
575
|
+
*
|
|
576
|
+
* ```ts
|
|
577
|
+
* import { ecdsa } from '@noble/curves/abstract/weierstrass.js';
|
|
578
|
+
* import { p256 } from '@noble/curves/nist.js';
|
|
579
|
+
* import { sha256 } from '@noble/hashes/sha2.js';
|
|
580
|
+
* const p256ecdsa = ecdsa(p256.Point, sha256);
|
|
581
|
+
* const { secretKey, publicKey } = p256ecdsa.keygen();
|
|
582
|
+
* const msg = new TextEncoder().encode('hello noble');
|
|
583
|
+
* const sig = p256ecdsa.sign(msg, secretKey);
|
|
584
|
+
* const isValid = p256ecdsa.verify(sig, msg, publicKey);
|
|
322
585
|
* ```
|
|
323
586
|
*/
|
|
324
|
-
export declare function ecdsa(Point: WeierstrassPointCons<bigint>, hash: CHash
|
|
587
|
+
export declare function ecdsa(Point: WeierstrassPointCons<bigint>, hash: TArg<CHash>, ecdsaOpts?: TArg<ECDSAOpts>): ECDSA;
|
|
325
588
|
//# sourceMappingURL=weierstrass.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weierstrass.d.ts","sourceRoot":"","sources":["../src/abstract/weierstrass.ts"],"names":[],"mappings":"AA6BA,OAAO,
|
|
1
|
+
{"version":3,"file":"weierstrass.d.ts","sourceRoot":"","sources":["../src/abstract/weierstrass.ts"],"names":[],"mappings":"AA6BA,OAAO,EAiBL,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAOL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