@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
package/utils.d.ts
CHANGED
|
@@ -1,95 +1,514 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Hex, bytes and number utilities.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
6
|
+
import { anumber as anumber_, bytesToHex as bytesToHex_, isBytes as isBytes_ } from '@noble/hashes/utils.js';
|
|
7
|
+
/**
|
|
8
|
+
* Bytes API type helpers for old + new TypeScript.
|
|
9
|
+
*
|
|
10
|
+
* TS 5.6 has `Uint8Array`, while TS 5.9+ made it generic `Uint8Array<ArrayBuffer>`.
|
|
11
|
+
* We can't use specific return type, because TS 5.6 will error.
|
|
12
|
+
* We can't use generic return type, because most TS 5.9 software will expect specific type.
|
|
13
|
+
*
|
|
14
|
+
* Maps typed-array input leaves to broad forms.
|
|
15
|
+
* These are compatibility adapters, not ownership guarantees.
|
|
16
|
+
*
|
|
17
|
+
* - `TArg` keeps byte inputs broad.
|
|
18
|
+
* - `TRet` marks byte outputs for TS 5.6 and TS 5.9+ compatibility.
|
|
19
|
+
*/
|
|
20
|
+
export type TypedArg<T> = T extends BigInt64Array ? BigInt64Array : T extends BigUint64Array ? BigUint64Array : T extends Float32Array ? Float32Array : T extends Float64Array ? Float64Array : T extends Int16Array ? Int16Array : T extends Int32Array ? Int32Array : T extends Int8Array ? Int8Array : T extends Uint16Array ? Uint16Array : T extends Uint32Array ? Uint32Array : T extends Uint8ClampedArray ? Uint8ClampedArray : T extends Uint8Array ? Uint8Array : never;
|
|
21
|
+
/** Maps typed-array output leaves to narrow TS-compatible forms. */
|
|
22
|
+
export type TypedRet<T> = T extends BigInt64Array ? ReturnType<typeof BigInt64Array.of> : T extends BigUint64Array ? ReturnType<typeof BigUint64Array.of> : T extends Float32Array ? ReturnType<typeof Float32Array.of> : T extends Float64Array ? ReturnType<typeof Float64Array.of> : T extends Int16Array ? ReturnType<typeof Int16Array.of> : T extends Int32Array ? ReturnType<typeof Int32Array.of> : T extends Int8Array ? ReturnType<typeof Int8Array.of> : T extends Uint16Array ? ReturnType<typeof Uint16Array.of> : T extends Uint32Array ? ReturnType<typeof Uint32Array.of> : T extends Uint8ClampedArray ? ReturnType<typeof Uint8ClampedArray.of> : T extends Uint8Array ? ReturnType<typeof Uint8Array.of> : never;
|
|
23
|
+
/** Recursively adapts byte-carrying API input types. See {@link TypedArg}. */
|
|
24
|
+
export type TArg<T> = T | ([TypedArg<T>] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: {
|
|
25
|
+
[K in keyof A]: TRet<A[K]>;
|
|
26
|
+
}) => TArg<R>) & {
|
|
27
|
+
[K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TArg<T[K]>;
|
|
28
|
+
} : T extends [infer A, ...infer R] ? [TArg<A>, ...{
|
|
29
|
+
[K in keyof R]: TArg<R[K]>;
|
|
30
|
+
}] : T extends readonly [infer A, ...infer R] ? readonly [TArg<A>, ...{
|
|
31
|
+
[K in keyof R]: TArg<R[K]>;
|
|
32
|
+
}] : T extends (infer A)[] ? TArg<A>[] : T extends readonly (infer A)[] ? readonly TArg<A>[] : T extends Promise<infer A> ? Promise<TArg<A>> : T extends object ? {
|
|
33
|
+
[K in keyof T]: TArg<T[K]>;
|
|
34
|
+
} : T : TypedArg<T>);
|
|
35
|
+
/** Recursively adapts byte-carrying API output types. See {@link TypedArg}. */
|
|
36
|
+
export type TRet<T> = T extends unknown ? T & ([TypedRet<T>] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: {
|
|
37
|
+
[K in keyof A]: TArg<A[K]>;
|
|
38
|
+
}) => TRet<R>) & {
|
|
39
|
+
[K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TRet<T[K]>;
|
|
40
|
+
} : T extends [infer A, ...infer R] ? [TRet<A>, ...{
|
|
41
|
+
[K in keyof R]: TRet<R[K]>;
|
|
42
|
+
}] : T extends readonly [infer A, ...infer R] ? readonly [TRet<A>, ...{
|
|
43
|
+
[K in keyof R]: TRet<R[K]>;
|
|
44
|
+
}] : T extends (infer A)[] ? TRet<A>[] : T extends readonly (infer A)[] ? readonly TRet<A>[] : T extends Promise<infer A> ? Promise<TRet<A>> : T extends object ? {
|
|
45
|
+
[K in keyof T]: TRet<T[K]>;
|
|
46
|
+
} : T : TypedRet<T>) : never;
|
|
47
|
+
/**
|
|
48
|
+
* Validates that a value is a byte array.
|
|
49
|
+
* @param value - Value to validate.
|
|
50
|
+
* @param length - Optional exact byte length.
|
|
51
|
+
* @param title - Optional field name.
|
|
52
|
+
* @returns Original byte array.
|
|
53
|
+
* @example
|
|
54
|
+
* Reject non-byte input before passing data into curve code.
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* abytes(new Uint8Array(1));
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare const abytes: <T extends TArg<Uint8Array>>(value: T, length?: number, title?: string) => T;
|
|
61
|
+
/**
|
|
62
|
+
* Validates that a value is a non-negative safe integer.
|
|
63
|
+
* @param n - Value to validate.
|
|
64
|
+
* @param title - Optional field name.
|
|
65
|
+
* @example
|
|
66
|
+
* Validate a numeric length before allocating buffers.
|
|
67
|
+
*
|
|
68
|
+
* ```ts
|
|
69
|
+
* anumber(1);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare const anumber: typeof anumber_;
|
|
73
|
+
/**
|
|
74
|
+
* Encodes bytes as lowercase hex.
|
|
75
|
+
* @param bytes - Bytes to encode.
|
|
76
|
+
* @returns Lowercase hex string.
|
|
77
|
+
* @example
|
|
78
|
+
* Serialize bytes as hex for logging or fixtures.
|
|
79
|
+
*
|
|
80
|
+
* ```ts
|
|
81
|
+
* bytesToHex(Uint8Array.of(1, 2, 3));
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare const bytesToHex: typeof bytesToHex_;
|
|
85
|
+
/**
|
|
86
|
+
* Concatenates byte arrays.
|
|
87
|
+
* @param arrays - Byte arrays to join.
|
|
88
|
+
* @returns Concatenated bytes.
|
|
89
|
+
* @example
|
|
90
|
+
* Join domain-separated chunks into one buffer.
|
|
91
|
+
*
|
|
92
|
+
* ```ts
|
|
93
|
+
* concatBytes(Uint8Array.of(1), Uint8Array.of(2));
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare const concatBytes: (...arrays: TArg<Uint8Array[]>) => TRet<Uint8Array>;
|
|
97
|
+
/**
|
|
98
|
+
* Decodes lowercase or uppercase hex into bytes.
|
|
99
|
+
* @param hex - Hex string to decode.
|
|
100
|
+
* @returns Decoded bytes.
|
|
101
|
+
* @example
|
|
102
|
+
* Parse fixture hex into bytes before hashing.
|
|
103
|
+
*
|
|
104
|
+
* ```ts
|
|
105
|
+
* hexToBytes('0102');
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export declare const hexToBytes: (hex: string) => TRet<Uint8Array>;
|
|
109
|
+
/**
|
|
110
|
+
* Checks whether a value is a Uint8Array.
|
|
111
|
+
* @param a - Value to inspect.
|
|
112
|
+
* @returns `true` when `a` is a Uint8Array.
|
|
113
|
+
* @example
|
|
114
|
+
* Branch on byte input before decoding it.
|
|
115
|
+
*
|
|
116
|
+
* ```ts
|
|
117
|
+
* isBytes(new Uint8Array(1));
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare const isBytes: typeof isBytes_;
|
|
121
|
+
/**
|
|
122
|
+
* Reads random bytes from the platform CSPRNG.
|
|
123
|
+
* @param bytesLength - Number of random bytes to read.
|
|
124
|
+
* @returns Fresh random bytes.
|
|
125
|
+
* @example
|
|
126
|
+
* Generate a random seed for a keypair.
|
|
127
|
+
*
|
|
128
|
+
* ```ts
|
|
129
|
+
* randomBytes(2);
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare const randomBytes: (bytesLength?: number) => TRet<Uint8Array>;
|
|
133
|
+
/** Callable hash interface with metadata and optional extendable output support. */
|
|
2
134
|
export type CHash = {
|
|
3
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Hash one message.
|
|
137
|
+
* @param message - Message bytes to hash.
|
|
138
|
+
* @returns Digest bytes.
|
|
139
|
+
*/
|
|
140
|
+
(message: TArg<Uint8Array>): TRet<Uint8Array>;
|
|
141
|
+
/** Hash block length in bytes. */
|
|
4
142
|
blockLen: number;
|
|
143
|
+
/** Default output length in bytes. */
|
|
5
144
|
outputLen: number;
|
|
145
|
+
/** Whether `.create()` can be used as an XOF stream. */
|
|
146
|
+
canXOF: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Create one stateful hash or XOF instance, for example SHAKE with a custom output length.
|
|
149
|
+
* @param opts - Optional extendable-output configuration:
|
|
150
|
+
* - `dkLen` (optional): Optional output length for XOF-style hashes.
|
|
151
|
+
* @returns Hash instance.
|
|
152
|
+
*/
|
|
6
153
|
create(opts?: {
|
|
7
154
|
dkLen?: number;
|
|
8
155
|
}): any;
|
|
9
156
|
};
|
|
10
|
-
|
|
157
|
+
/** Plain callable hash interface. */
|
|
158
|
+
export type FHash = (message: TArg<Uint8Array>) => TRet<Uint8Array>;
|
|
159
|
+
/** HMAC callback signature. */
|
|
160
|
+
export type HmacFn = (key: TArg<Uint8Array>, message: TArg<Uint8Array>) => TRet<Uint8Array>;
|
|
161
|
+
/**
|
|
162
|
+
* Validates that a flag is boolean.
|
|
163
|
+
* @param value - Value to validate.
|
|
164
|
+
* @param title - Optional field name.
|
|
165
|
+
* @returns Original value.
|
|
166
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
167
|
+
* @example
|
|
168
|
+
* Reject non-boolean option flags early.
|
|
169
|
+
*
|
|
170
|
+
* ```ts
|
|
171
|
+
* abool(true);
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
11
174
|
export declare function abool(value: boolean, title?: string): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Validates that a value is a non-negative bigint or safe integer.
|
|
177
|
+
* @param n - Value to validate.
|
|
178
|
+
* @returns The same validated value.
|
|
179
|
+
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
180
|
+
* @example
|
|
181
|
+
* Validate one integer-like value before serializing it.
|
|
182
|
+
*
|
|
183
|
+
* ```ts
|
|
184
|
+
* abignumber(1n);
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export declare function abignumber<T extends number | bigint>(n: T): T;
|
|
188
|
+
/**
|
|
189
|
+
* Validates that a value is a safe integer.
|
|
190
|
+
* @param value - Integer to validate.
|
|
191
|
+
* @param title - Optional field name.
|
|
192
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
193
|
+
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
194
|
+
* @example
|
|
195
|
+
* Validate a window size before scalar arithmetic uses it.
|
|
196
|
+
*
|
|
197
|
+
* ```ts
|
|
198
|
+
* asafenumber(1);
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
12
201
|
export declare function asafenumber(value: number, title?: string): void;
|
|
202
|
+
/**
|
|
203
|
+
* Encodes a bigint into even-length big-endian hex.
|
|
204
|
+
* The historical "unpadded" name only means "no fixed-width field padding"; odd-length hex still
|
|
205
|
+
* gets one leading zero nibble so the result always represents whole bytes.
|
|
206
|
+
* @param num - Number to encode.
|
|
207
|
+
* @returns Big-endian hex string.
|
|
208
|
+
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
209
|
+
* @example
|
|
210
|
+
* Encode a scalar into hex without a `0x` prefix.
|
|
211
|
+
*
|
|
212
|
+
* ```ts
|
|
213
|
+
* numberToHexUnpadded(255n);
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
13
216
|
export declare function numberToHexUnpadded(num: number | bigint): string;
|
|
217
|
+
/**
|
|
218
|
+
* Parses a big-endian hex string into bigint.
|
|
219
|
+
* Accepts odd-length hex through the native `BigInt('0x' + hex)` parser and currently surfaces the
|
|
220
|
+
* same native `SyntaxError` for malformed hex instead of wrapping it in a library-specific error.
|
|
221
|
+
* @param hex - Hex string without `0x`.
|
|
222
|
+
* @returns Parsed bigint value.
|
|
223
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
224
|
+
* @example
|
|
225
|
+
* Parse a scalar from fixture hex.
|
|
226
|
+
*
|
|
227
|
+
* ```ts
|
|
228
|
+
* hexToNumber('ff');
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
14
231
|
export declare function hexToNumber(hex: string): bigint;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
232
|
+
/**
|
|
233
|
+
* Parses big-endian bytes into bigint.
|
|
234
|
+
* @param bytes - Bytes in big-endian order.
|
|
235
|
+
* @returns Parsed bigint value.
|
|
236
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
237
|
+
* @example
|
|
238
|
+
* Read a scalar encoded in network byte order.
|
|
239
|
+
*
|
|
240
|
+
* ```ts
|
|
241
|
+
* bytesToNumberBE(Uint8Array.of(1, 0));
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
export declare function bytesToNumberBE(bytes: TArg<Uint8Array>): bigint;
|
|
245
|
+
/**
|
|
246
|
+
* Parses little-endian bytes into bigint.
|
|
247
|
+
* @param bytes - Bytes in little-endian order.
|
|
248
|
+
* @returns Parsed bigint value.
|
|
249
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
250
|
+
* @example
|
|
251
|
+
* Read a scalar encoded in little-endian form.
|
|
252
|
+
*
|
|
253
|
+
* ```ts
|
|
254
|
+
* bytesToNumberLE(Uint8Array.of(1, 0));
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
export declare function bytesToNumberLE(bytes: TArg<Uint8Array>): bigint;
|
|
258
|
+
/**
|
|
259
|
+
* Encodes a bigint into fixed-length big-endian bytes.
|
|
260
|
+
* @param n - Number to encode.
|
|
261
|
+
* @param len - Output length in bytes. Must be greater than zero.
|
|
262
|
+
* @returns Big-endian byte array.
|
|
263
|
+
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
264
|
+
* @example
|
|
265
|
+
* Serialize a scalar into a 32-byte field element.
|
|
266
|
+
*
|
|
267
|
+
* ```ts
|
|
268
|
+
* numberToBytesBE(255n, 2);
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
export declare function numberToBytesBE(n: number | bigint, len: number): TRet<Uint8Array>;
|
|
272
|
+
/**
|
|
273
|
+
* Encodes a bigint into fixed-length little-endian bytes.
|
|
274
|
+
* @param n - Number to encode.
|
|
275
|
+
* @param len - Output length in bytes.
|
|
276
|
+
* @returns Little-endian byte array.
|
|
277
|
+
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
278
|
+
* @example
|
|
279
|
+
* Serialize a scalar for little-endian protocols.
|
|
280
|
+
*
|
|
281
|
+
* ```ts
|
|
282
|
+
* numberToBytesLE(255n, 2);
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
export declare function numberToBytesLE(n: number | bigint, len: number): TRet<Uint8Array>;
|
|
286
|
+
/**
|
|
287
|
+
* Encodes a bigint into variable-length big-endian bytes.
|
|
288
|
+
* @param n - Number to encode.
|
|
289
|
+
* @returns Variable-length big-endian bytes.
|
|
290
|
+
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
291
|
+
* @example
|
|
292
|
+
* Serialize a bigint without fixed-width padding.
|
|
293
|
+
*
|
|
294
|
+
* ```ts
|
|
295
|
+
* numberToVarBytesBE(255n);
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
export declare function numberToVarBytesBE(n: number | bigint): TRet<Uint8Array>;
|
|
299
|
+
/**
|
|
300
|
+
* Compares two byte arrays in constant-ish time.
|
|
301
|
+
* @param a - Left byte array.
|
|
302
|
+
* @param b - Right byte array.
|
|
303
|
+
* @returns `true` when bytes match.
|
|
304
|
+
* @example
|
|
305
|
+
* Compare two encoded points without early exit.
|
|
306
|
+
*
|
|
307
|
+
* ```ts
|
|
308
|
+
* equalBytes(Uint8Array.of(1), Uint8Array.of(1));
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
export declare function equalBytes(a: TArg<Uint8Array>, b: TArg<Uint8Array>): boolean;
|
|
21
312
|
/**
|
|
22
313
|
* Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer,
|
|
23
314
|
* and Buffer#slice creates mutable copy. Never use Buffers!
|
|
315
|
+
* @param bytes - Bytes to copy.
|
|
316
|
+
* @returns Detached copy.
|
|
317
|
+
* @example
|
|
318
|
+
* Make an isolated copy before mutating serialized bytes.
|
|
319
|
+
*
|
|
320
|
+
* ```ts
|
|
321
|
+
* copyBytes(Uint8Array.of(1, 2, 3));
|
|
322
|
+
* ```
|
|
24
323
|
*/
|
|
25
|
-
export declare function copyBytes(bytes: Uint8Array): Uint8Array
|
|
324
|
+
export declare function copyBytes(bytes: TArg<Uint8Array>): TRet<Uint8Array>;
|
|
26
325
|
/**
|
|
27
326
|
* Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols
|
|
28
327
|
* Should be safe to use for things expected to be ASCII.
|
|
29
328
|
* Returns exact same result as `TextEncoder` for ASCII or throws.
|
|
329
|
+
* @param ascii - ASCII input text.
|
|
330
|
+
* @returns Encoded bytes.
|
|
331
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
332
|
+
* @example
|
|
333
|
+
* Encode an ASCII domain-separation tag.
|
|
334
|
+
*
|
|
335
|
+
* ```ts
|
|
336
|
+
* asciiToBytes('ABC');
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
export declare function asciiToBytes(ascii: string): TRet<Uint8Array>;
|
|
340
|
+
/**
|
|
341
|
+
* Checks whether a bigint lies inside a half-open range.
|
|
342
|
+
* @param n - Candidate value.
|
|
343
|
+
* @param min - Inclusive lower bound.
|
|
344
|
+
* @param max - Exclusive upper bound.
|
|
345
|
+
* @returns `true` when the value is inside the range.
|
|
346
|
+
* @example
|
|
347
|
+
* Check whether a candidate scalar fits the field order.
|
|
348
|
+
*
|
|
349
|
+
* ```ts
|
|
350
|
+
* inRange(2n, 1n, 3n);
|
|
351
|
+
* ```
|
|
30
352
|
*/
|
|
31
|
-
export declare function asciiToBytes(ascii: string): Uint8Array;
|
|
32
353
|
export declare function inRange(n: bigint, min: bigint, max: bigint): boolean;
|
|
33
354
|
/**
|
|
34
|
-
* Asserts min <= n < max
|
|
355
|
+
* Asserts `min <= n < max`. NOTE: upper bound is exclusive.
|
|
356
|
+
* @param title - Value label for error messages.
|
|
357
|
+
* @param n - Candidate value.
|
|
358
|
+
* @param min - Inclusive lower bound.
|
|
359
|
+
* @param max - Exclusive upper bound.
|
|
360
|
+
* Wrong-type inputs are not separated from out-of-range values here: they still flow through the
|
|
361
|
+
* shared `RangeError` path because this is only a throwing wrapper around `inRange(...)`.
|
|
362
|
+
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
35
363
|
* @example
|
|
36
|
-
*
|
|
364
|
+
* Assert that a bigint stays within one half-open range.
|
|
365
|
+
*
|
|
366
|
+
* ```ts
|
|
367
|
+
* aInRange('x', 2n, 1n, 256n);
|
|
368
|
+
* ```
|
|
37
369
|
*/
|
|
38
370
|
export declare function aInRange(title: string, n: bigint, min: bigint, max: bigint): void;
|
|
39
371
|
/**
|
|
40
372
|
* Calculates amount of bits in a bigint.
|
|
41
373
|
* Same as `n.toString(2).length`
|
|
42
374
|
* TODO: merge with nLength in modular
|
|
375
|
+
* @param n - Value to inspect.
|
|
376
|
+
* @returns Bit length.
|
|
377
|
+
* @throws If the value is negative. {@link Error}
|
|
378
|
+
* @example
|
|
379
|
+
* Measure the bit length of a scalar before serialization.
|
|
380
|
+
*
|
|
381
|
+
* ```ts
|
|
382
|
+
* bitLen(8n);
|
|
383
|
+
* ```
|
|
43
384
|
*/
|
|
44
385
|
export declare function bitLen(n: bigint): number;
|
|
45
386
|
/**
|
|
46
387
|
* Gets single bit at position.
|
|
47
388
|
* NOTE: first bit position is 0 (same as arrays)
|
|
48
389
|
* Same as `!!+Array.from(n.toString(2)).reverse()[pos]`
|
|
390
|
+
* @param n - Source value.
|
|
391
|
+
* @param pos - Bit position. Negative positions are passed through to raw
|
|
392
|
+
* bigint shift semantics; because the mask is built as `1n << pos`,
|
|
393
|
+
* they currently collapse to `0n` and make the helper a no-op.
|
|
394
|
+
* @returns Bit as bigint.
|
|
395
|
+
* @example
|
|
396
|
+
* Gets single bit at position.
|
|
397
|
+
*
|
|
398
|
+
* ```ts
|
|
399
|
+
* bitGet(5n, 0);
|
|
400
|
+
* ```
|
|
49
401
|
*/
|
|
50
402
|
export declare function bitGet(n: bigint, pos: number): bigint;
|
|
51
403
|
/**
|
|
52
404
|
* Sets single bit at position.
|
|
405
|
+
* @param n - Source value.
|
|
406
|
+
* @param pos - Bit position. Negative positions are passed through to raw bigint shift semantics,
|
|
407
|
+
* so they currently behave like left shifts.
|
|
408
|
+
* @param value - Whether the bit should be set.
|
|
409
|
+
* @returns Updated bigint.
|
|
410
|
+
* @example
|
|
411
|
+
* Sets single bit at position.
|
|
412
|
+
*
|
|
413
|
+
* ```ts
|
|
414
|
+
* bitSet(0n, 1, true);
|
|
415
|
+
* ```
|
|
53
416
|
*/
|
|
54
417
|
export declare function bitSet(n: bigint, pos: number, value: boolean): bigint;
|
|
55
418
|
/**
|
|
56
419
|
* Calculate mask for N bits. Not using ** operator with bigints because of old engines.
|
|
57
420
|
* Same as BigInt(`0b${Array(i).fill('1').join('')}`)
|
|
421
|
+
* @param n - Number of bits. Negative widths are currently passed through to raw bigint shift
|
|
422
|
+
* semantics and therefore produce `-1n`.
|
|
423
|
+
* @returns Bitmask value.
|
|
424
|
+
* @example
|
|
425
|
+
* Calculate mask for N bits.
|
|
426
|
+
*
|
|
427
|
+
* ```ts
|
|
428
|
+
* bitMask(4);
|
|
429
|
+
* ```
|
|
58
430
|
*/
|
|
59
431
|
export declare const bitMask: (n: number) => bigint;
|
|
60
|
-
type Pred<T> = (v: Uint8Array) => T | undefined;
|
|
432
|
+
type Pred<T> = (v: TArg<Uint8Array>) => T | undefined;
|
|
61
433
|
/**
|
|
62
434
|
* Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.
|
|
63
|
-
* @
|
|
435
|
+
* @param hashLen - Hash output size in bytes. Callers are expected to pass a positive length; `0`
|
|
436
|
+
* is not rejected here and would make the internal generate loop non-progressing.
|
|
437
|
+
* @param qByteLen - Requested output size in bytes. Callers are expected to pass a positive length.
|
|
438
|
+
* @param hmacFn - HMAC implementation.
|
|
439
|
+
* @returns Function that will call DRBG until the predicate returns anything
|
|
440
|
+
* other than `undefined`.
|
|
441
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
64
442
|
* @example
|
|
65
|
-
*
|
|
66
|
-
*
|
|
443
|
+
* Build a deterministic nonce generator for RFC6979-style signing.
|
|
444
|
+
*
|
|
445
|
+
* ```ts
|
|
446
|
+
* import { createHmacDrbg } from '@noble/curves/utils.js';
|
|
447
|
+
* import { hmac } from '@noble/hashes/hmac.js';
|
|
448
|
+
* import { sha256 } from '@noble/hashes/sha2.js';
|
|
449
|
+
* const drbg = createHmacDrbg(32, 32, (key, msg) => hmac(sha256, key, msg));
|
|
450
|
+
* const seed = new Uint8Array(32);
|
|
451
|
+
* drbg(seed, (bytes) => bytes);
|
|
452
|
+
* ```
|
|
67
453
|
*/
|
|
68
|
-
export declare function createHmacDrbg<T>(hashLen: number, qByteLen: number, hmacFn:
|
|
69
|
-
export declare function validateObject(object: Record<string, any>, fields?: Record<string, string>, optFields?: Record<string, string>): void;
|
|
454
|
+
export declare function createHmacDrbg<T>(hashLen: number, qByteLen: number, hmacFn: TArg<HmacFn>): TRet<(seed: Uint8Array, predicate: Pred<T>) => T>;
|
|
70
455
|
/**
|
|
71
|
-
*
|
|
456
|
+
* Validates declared required and optional field types on a plain object.
|
|
457
|
+
* Extra keys are intentionally ignored because many callers validate only the subset they use from
|
|
458
|
+
* richer option bags or runtime objects.
|
|
459
|
+
* @param object - Object to validate.
|
|
460
|
+
* @param fields - Required field types.
|
|
461
|
+
* @param optFields - Optional field types.
|
|
462
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
463
|
+
* @example
|
|
464
|
+
* Check user options before building a curve helper.
|
|
465
|
+
*
|
|
466
|
+
* ```ts
|
|
467
|
+
* validateObject({ flag: true }, { flag: 'boolean' });
|
|
468
|
+
* ```
|
|
72
469
|
*/
|
|
73
|
-
export declare
|
|
470
|
+
export declare function validateObject(object: Record<string, any>, fields?: Record<string, string>, optFields?: Record<string, string>): void;
|
|
74
471
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
472
|
+
* Throws not implemented error.
|
|
473
|
+
* @returns Never returns.
|
|
474
|
+
* @throws If the unfinished code path is reached. {@link Error}
|
|
475
|
+
* @example
|
|
476
|
+
* Surface the placeholder error from an unfinished code path.
|
|
477
|
+
*
|
|
478
|
+
* ```ts
|
|
479
|
+
* try {
|
|
480
|
+
* notImplemented();
|
|
481
|
+
* } catch {}
|
|
482
|
+
* ```
|
|
77
483
|
*/
|
|
78
|
-
export declare
|
|
484
|
+
export declare const notImplemented: () => never;
|
|
485
|
+
/** Generic keygen/getPublicKey interface shared by curve helpers. */
|
|
79
486
|
export interface CryptoKeys {
|
|
487
|
+
/** Public byte lengths for keys and optional seeds. */
|
|
80
488
|
lengths: {
|
|
81
489
|
seed?: number;
|
|
82
490
|
public?: number;
|
|
83
491
|
secret?: number;
|
|
84
492
|
};
|
|
493
|
+
/**
|
|
494
|
+
* Generate one secret/public keypair.
|
|
495
|
+
* @param seed - Optional seed bytes for deterministic key generation.
|
|
496
|
+
* @returns Fresh secret/public keypair.
|
|
497
|
+
*/
|
|
85
498
|
keygen: (seed?: Uint8Array) => {
|
|
86
499
|
secretKey: Uint8Array;
|
|
87
500
|
publicKey: Uint8Array;
|
|
88
501
|
};
|
|
502
|
+
/**
|
|
503
|
+
* Derive one public key from a secret key.
|
|
504
|
+
* @param secretKey - Secret key bytes.
|
|
505
|
+
* @returns Public key bytes.
|
|
506
|
+
*/
|
|
89
507
|
getPublicKey: (secretKey: Uint8Array) => Uint8Array;
|
|
90
508
|
}
|
|
91
509
|
/** Generic interface for signatures. Has keygen, sign and verify. */
|
|
92
510
|
export interface Signer extends CryptoKeys {
|
|
511
|
+
/** Public byte lengths for keys, signatures, and optional signing randomness. */
|
|
93
512
|
lengths: {
|
|
94
513
|
seed?: number;
|
|
95
514
|
public?: number;
|
|
@@ -97,7 +516,21 @@ export interface Signer extends CryptoKeys {
|
|
|
97
516
|
signRand?: number;
|
|
98
517
|
signature?: number;
|
|
99
518
|
};
|
|
519
|
+
/**
|
|
520
|
+
* Sign one message.
|
|
521
|
+
* @param msg - Message bytes to sign.
|
|
522
|
+
* @param secretKey - Secret key bytes.
|
|
523
|
+
* @returns Signature bytes.
|
|
524
|
+
*/
|
|
100
525
|
sign: (msg: Uint8Array, secretKey: Uint8Array) => Uint8Array;
|
|
526
|
+
/**
|
|
527
|
+
* Verify one signature.
|
|
528
|
+
* @param sig - Signature bytes.
|
|
529
|
+
* @param msg - Signed message bytes.
|
|
530
|
+
* @param publicKey - Public key bytes.
|
|
531
|
+
* @returns `true` when the signature is valid.
|
|
532
|
+
*/
|
|
101
533
|
verify: (sig: Uint8Array, msg: Uint8Array, publicKey: Uint8Array) => boolean;
|
|
102
534
|
}
|
|
535
|
+
export {};
|
|
103
536
|
//# sourceMappingURL=utils.d.ts.map
|
package/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,sEAAsE;AACtE,OAAO,EAEL,OAAO,IAAI,QAAQ,EACnB,UAAU,IAAI,WAAW,EAGzB,OAAO,IAAI,QA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