@noble/post-quantum 0.6.0 → 0.7.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/utils.d.ts CHANGED
@@ -4,6 +4,46 @@
4
4
  */
5
5
  /*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
6
6
  import { type CHash, type TypedArray, abytes, concatBytes, randomBytes as randb } 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;
7
47
  /**
8
48
  * Asserts that a value is a byte array and optionally checks its length.
9
49
  * Returns the original reference unchanged on success, and currently also accepts Node `Buffer`
@@ -35,6 +75,8 @@ export { concatBytesDoc as concatBytes };
35
75
  * Requires `globalThis.crypto.getRandomValues` and throws if that API is unavailable.
36
76
  * `bytesLength` is validated by the upstream helper as a non-negative integer before allocation,
37
77
  * so negative and fractional values both throw instead of truncating through JS `ToIndex`.
78
+ * @param bytesLength - Number of random bytes to generate.
79
+ * @returns Fresh random bytes.
38
80
  * @example
39
81
  * Generate a fresh random seed.
40
82
  * ```ts
@@ -42,9 +84,11 @@ export { concatBytesDoc as concatBytes };
42
84
  * ```
43
85
  */
44
86
  export declare const randomBytes: typeof randb;
87
+ export declare function aarray<T>(item: unknown, title: string, inner?: (elm: T, title: string) => void): T[];
88
+ export declare function aobject<T extends object>(value: unknown, title?: string): T;
45
89
  /**
46
90
  * Compares two byte arrays in a length-constant way for equal lengths.
47
- * Unequal lengths return `false` immediately, and there is no runtime type validation.
91
+ * Inputs are validated as byte arrays; unequal lengths return `false` immediately.
48
92
  * @param a - First byte array.
49
93
  * @param b - Second byte array.
50
94
  * @returns Whether both arrays contain the same bytes.
@@ -54,11 +98,10 @@ export declare const randomBytes: typeof randb;
54
98
  * equalBytes(new Uint8Array([1]), new Uint8Array([1]));
55
99
  * ```
56
100
  */
57
- export declare function equalBytes(a: Uint8Array, b: Uint8Array): boolean;
101
+ export declare function equalBytes(a: TArg<Uint8Array>, b: TArg<Uint8Array>): boolean;
58
102
  /**
59
103
  * Copies bytes into a fresh `Uint8Array`.
60
- * Returns a detached plain `Uint8Array`, and currently accepts broader array-like / iterable
61
- * inputs because it delegates directly to `Uint8Array.from(...)`.
104
+ * Returns a detached plain `Uint8Array` after validating that the input is real bytes.
62
105
  * @param bytes - Source bytes.
63
106
  * @returns Copy of the input bytes.
64
107
  * @example
@@ -67,15 +110,32 @@ export declare function equalBytes(a: Uint8Array, b: Uint8Array): boolean;
67
110
  * copyBytes(new Uint8Array([1, 2]));
68
111
  * ```
69
112
  */
70
- export declare function copyBytes(bytes: Uint8Array): Uint8Array;
113
+ export declare function copyBytes(bytes: TArg<Uint8Array>): TRet<Uint8Array>;
71
114
  /**
72
115
  * Byte-swaps each 64-bit lane in place.
73
116
  * Falcon's exact binary64 tables are stored as little-endian byte payloads, so BE runtimes need
74
117
  * this boundary helper before aliasing them as host `Float64Array` lanes.
75
118
  * @param arr - Byte buffer whose length is a multiple of 8.
76
119
  * @returns The same buffer after in-place 64-bit lane byte swaps.
120
+ * @example
121
+ * Byte-swap one 64-bit lane in place.
122
+ * ```ts
123
+ * byteSwap64(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]));
124
+ * ```
77
125
  */
78
126
  export declare function byteSwap64<T extends ArrayBufferView>(arr: T): T;
127
+ /**
128
+ * Byte-swaps 64-bit lanes on big-endian runtimes and returns the input unchanged on little-endian.
129
+ * This keeps Falcon's binary64 tables in canonical little-endian order before aliasing them as
130
+ * `Float64Array` lanes on the current host.
131
+ * @param arr - Buffer to pass through or swap in place.
132
+ * @returns The same buffer, normalized for Falcon's little-endian table layout.
133
+ * @example
134
+ * Normalize one host-endian buffer for Falcon's float tables.
135
+ * ```ts
136
+ * baswap64If(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]));
137
+ * ```
138
+ */
79
139
  export declare const baswap64If: <T extends ArrayBufferView>(arr: T) => T;
80
140
  /** Shared key-generation surface for signers and KEMs. */
81
141
  export type CryptoKeys = {
@@ -94,16 +154,16 @@ export type CryptoKeys = {
94
154
  * @param seed - Optional seed bytes for deterministic key generation.
95
155
  * @returns Fresh secret/public keypair.
96
156
  */
97
- keygen: (seed?: Uint8Array) => {
98
- secretKey: Uint8Array;
99
- publicKey: Uint8Array;
157
+ keygen: (seed?: TArg<Uint8Array>) => {
158
+ secretKey: TRet<Uint8Array>;
159
+ publicKey: TRet<Uint8Array>;
100
160
  };
101
161
  /**
102
162
  * Derive one public key from a secret key.
103
163
  * @param secretKey - Secret key bytes.
104
164
  * @returns Public key bytes.
105
165
  */
106
- getPublicKey: (secretKey: Uint8Array) => Uint8Array;
166
+ getPublicKey: (secretKey: TArg<Uint8Array>) => TRet<Uint8Array>;
107
167
  };
108
168
  /** Verification options shared by the signature APIs. */
109
169
  export type VerOpts = {
@@ -138,7 +198,7 @@ export declare function validateOpts(opts: object): void;
138
198
  * validateVerOpts({ context: new Uint8Array([1]) });
139
199
  * ```
140
200
  */
141
- export declare function validateVerOpts(opts: VerOpts): void;
201
+ export declare function validateVerOpts(opts: TArg<VerOpts>): void;
142
202
  /**
143
203
  * Validates common signing options.
144
204
  * `extraEntropy` is validated with `abytes(...)`; exact lengths and extra algorithm-specific
@@ -151,7 +211,7 @@ export declare function validateVerOpts(opts: VerOpts): void;
151
211
  * validateSigOpts({ extraEntropy: new Uint8Array([1]) });
152
212
  * ```
153
213
  */
154
- export declare function validateSigOpts(opts: SigOpts): void;
214
+ export declare function validateSigOpts(opts: TArg<SigOpts>): void;
155
215
  /** Generic signature interface with key generation, signing, and verification. */
156
216
  export type Signer = CryptoKeys & {
157
217
  /** Public byte lengths for signatures and signing randomness. */
@@ -166,7 +226,7 @@ export type Signer = CryptoKeys & {
166
226
  * @param opts - Optional signing options.
167
227
  * @returns Signature bytes.
168
228
  */
169
- sign: (msg: Uint8Array, secretKey: Uint8Array, opts?: SigOpts) => Uint8Array;
229
+ sign: (msg: TArg<Uint8Array>, secretKey: TArg<Uint8Array>, opts?: TArg<SigOpts>) => TRet<Uint8Array>;
170
230
  /**
171
231
  * Verify one signature.
172
232
  * @param sig - Signature bytes.
@@ -178,7 +238,7 @@ export type Signer = CryptoKeys & {
178
238
  * a verification failure and return `false`.
179
239
  * @throws On malformed API arguments or unsupported verification options.
180
240
  */
181
- verify: (sig: Uint8Array, msg: Uint8Array, publicKey: Uint8Array, opts?: VerOpts) => boolean;
241
+ verify: (sig: TArg<Uint8Array>, msg: TArg<Uint8Array>, publicKey: TArg<Uint8Array>, opts?: TArg<VerOpts>) => boolean;
182
242
  };
183
243
  /** Generic key encapsulation mechanism interface. */
184
244
  export type KEM = CryptoKeys & {
@@ -194,9 +254,9 @@ export type KEM = CryptoKeys & {
194
254
  * @param msg - Optional caller-provided randomness/message seed.
195
255
  * @returns Ciphertext plus shared secret.
196
256
  */
197
- encapsulate: (publicKey: Uint8Array, msg?: Uint8Array) => {
198
- cipherText: Uint8Array;
199
- sharedSecret: Uint8Array;
257
+ encapsulate: (publicKey: TArg<Uint8Array>, msg?: TArg<Uint8Array>) => {
258
+ cipherText: TRet<Uint8Array>;
259
+ sharedSecret: TRet<Uint8Array>;
200
260
  };
201
261
  /**
202
262
  * Recover the shared secret from a ciphertext and recipient secret key.
@@ -204,7 +264,7 @@ export type KEM = CryptoKeys & {
204
264
  * @param secretKey - Recipient secret key bytes.
205
265
  * @returns Decapsulated shared secret.
206
266
  */
207
- decapsulate: (cipherText: Uint8Array, secretKey: Uint8Array) => Uint8Array;
267
+ decapsulate: (cipherText: TArg<Uint8Array>, secretKey: TArg<Uint8Array>) => TRet<Uint8Array>;
208
268
  };
209
269
  /** Bidirectional encoder/decoder interface. */
210
270
  export interface Coder<F, T> {
@@ -259,9 +319,9 @@ type SplitOut<T extends (number | BytesCoderLen<any>)[]> = {
259
319
  * splitCoder('demo', 1, 2).encode([new Uint8Array([1]), new Uint8Array([2, 3])]);
260
320
  * ```
261
321
  */
262
- export declare function splitCoder<T extends (number | BytesCoderLen<any>)[]>(label: string, ...lengths: T): BytesCoder<SplitOut<T>> & {
322
+ export declare function splitCoder<T extends (number | BytesCoderLen<any>)[]>(label: string, ...lengths: T): TRet<BytesCoder<SplitOut<T>> & {
263
323
  bytesLen: number;
264
- };
324
+ }>;
265
325
  /**
266
326
  * Builds a fixed-length vector coder from another fixed-length coder.
267
327
  * Element decoding receives `subarray(...)` views, so aliasing depends on the element coder.
@@ -281,7 +341,7 @@ export declare function splitCoder<T extends (number | BytesCoderLen<any>)[]>(la
281
341
  * ).encode([1, 2]);
282
342
  * ```
283
343
  */
284
- export declare function vecCoder<T>(c: BytesCoderLen<T>, vecLen: number): BytesCoderLen<T[]>;
344
+ export declare function vecCoder<T>(c: TArg<BytesCoderLen<T>>, vecLen: number): TRet<BytesCoderLen<T[]>>;
285
345
  /**
286
346
  * Overwrites supported typed-array inputs with zeroes in place.
287
347
  * Accepts direct typed arrays and one-level arrays of them.
@@ -298,6 +358,8 @@ export declare function cleanBytes(...list: (TypedArray | TypedArray[])[]): void
298
358
  * Creates a 32-bit mask with the lowest `bits` bits set.
299
359
  * @param bits - Number of low bits to keep.
300
360
  * @returns Bit mask with `bits` ones.
361
+ * @throws On wrong argument types. {@link TypeError}
362
+ * @throws On wrong argument ranges or values. {@link RangeError}
301
363
  * @example
302
364
  * Create a low-bit mask for packed-field operations.
303
365
  * ```ts
@@ -306,7 +368,7 @@ export declare function cleanBytes(...list: (TypedArray | TypedArray[])[]): void
306
368
  */
307
369
  export declare function getMask(bits: number): number;
308
370
  /** Shared empty byte array used as the default context. */
309
- export declare const EMPTY: Uint8Array;
371
+ export declare const EMPTY: TRet<Uint8Array>;
310
372
  /**
311
373
  * Builds the domain-separated message payload for the pure sign/verify paths.
312
374
  * Context length `255` is valid; only `ctx.length > 255` is rejected.
@@ -320,7 +382,7 @@ export declare const EMPTY: Uint8Array;
320
382
  * const payload = getMessage(new Uint8Array([1, 2]));
321
383
  * ```
322
384
  */
323
- export declare function getMessage(msg: Uint8Array, ctx?: Uint8Array): Uint8Array;
385
+ export declare function getMessage(msg: TArg<Uint8Array>, ctx?: TArg<Uint8Array>): TRet<Uint8Array>;
324
386
  /**
325
387
  * Validates that a hash exposes a NIST hash OID and enough collision resistance.
326
388
  * Current accepted surface is broader than the FIPS algorithm tables: any hash/XOF under the NIST
@@ -357,5 +419,18 @@ export declare function checkHash(hash: CHash, requiredStrength?: number): void;
357
419
  * getMessagePrehash(sha256, new Uint8Array([1, 2]));
358
420
  * ```
359
421
  */
360
- export declare function getMessagePrehash(hash: CHash, msg: Uint8Array, ctx?: Uint8Array): Uint8Array;
361
- //# sourceMappingURL=utils.d.ts.map
422
+ export declare function getMessagePrehash(hash: CHash, msg: TArg<Uint8Array>, ctx?: TArg<Uint8Array>): TRet<Uint8Array>;
423
+ /**
424
+ * Asserts something is a string.
425
+ * @param value - Value to validate.
426
+ * @param title - Label included in thrown errors.
427
+ * @returns The validated string.
428
+ * @throws On wrong argument types. {@link TypeError}
429
+ * @example
430
+ * Validate a label string.
431
+ *
432
+ * ```ts
433
+ * astring('example', 'label');
434
+ * ```
435
+ */
436
+ export declare function astring(value: unknown, title?: string): string;
package/utils.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * @module
4
4
  */
5
5
  /*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
6
- import { abytes, abytes as abytes_, concatBytes, isLE, randomBytes as randb, } from '@noble/hashes/utils.js';
6
+ import { abytes, abytes as abytes_, ahash as ahash_, anumber, concatBytes, isBytes, isLE, randomBytes as randb, } from '@noble/hashes/utils.js';
7
7
  /**
8
8
  * Asserts that a value is a byte array and optionally checks its length.
9
9
  * Returns the original reference unchanged on success, and currently also accepts Node `Buffer`
@@ -35,6 +35,8 @@ export { concatBytesDoc as concatBytes };
35
35
  * Requires `globalThis.crypto.getRandomValues` and throws if that API is unavailable.
36
36
  * `bytesLength` is validated by the upstream helper as a non-negative integer before allocation,
37
37
  * so negative and fractional values both throw instead of truncating through JS `ToIndex`.
38
+ * @param bytesLength - Number of random bytes to generate.
39
+ * @returns Fresh random bytes.
38
40
  * @example
39
41
  * Generate a fresh random seed.
40
42
  * ```ts
@@ -42,9 +44,23 @@ export { concatBytesDoc as concatBytes };
42
44
  * ```
43
45
  */
44
46
  export const randomBytes = randb;
47
+ export function aarray(item, title, inner = () => { }) {
48
+ if (!Array.isArray(item))
49
+ throw new TypeError(`"${title}" expected array, got type=${typeof item}`);
50
+ for (let i = 0; i < item.length; i++)
51
+ inner(item[i], `${title}[${i}]`);
52
+ return item;
53
+ }
54
+ export function aobject(value, title = 'object') {
55
+ if (value === null || typeof value !== 'object' || Array.isArray(value))
56
+ throw new TypeError(title === 'object'
57
+ ? 'expected valid options object'
58
+ : `"${title}" expected object, got type=${typeof value}`);
59
+ return value;
60
+ }
45
61
  /**
46
62
  * Compares two byte arrays in a length-constant way for equal lengths.
47
- * Unequal lengths return `false` immediately, and there is no runtime type validation.
63
+ * Inputs are validated as byte arrays; unequal lengths return `false` immediately.
48
64
  * @param a - First byte array.
49
65
  * @param b - Second byte array.
50
66
  * @returns Whether both arrays contain the same bytes.
@@ -55,6 +71,8 @@ export const randomBytes = randb;
55
71
  * ```
56
72
  */
57
73
  export function equalBytes(a, b) {
74
+ a = abytes(a);
75
+ b = abytes(b);
58
76
  if (a.length !== b.length)
59
77
  return false;
60
78
  let diff = 0;
@@ -64,8 +82,7 @@ export function equalBytes(a, b) {
64
82
  }
65
83
  /**
66
84
  * Copies bytes into a fresh `Uint8Array`.
67
- * Returns a detached plain `Uint8Array`, and currently accepts broader array-like / iterable
68
- * inputs because it delegates directly to `Uint8Array.from(...)`.
85
+ * Returns a detached plain `Uint8Array` after validating that the input is real bytes.
69
86
  * @param bytes - Source bytes.
70
87
  * @returns Copy of the input bytes.
71
88
  * @example
@@ -75,7 +92,9 @@ export function equalBytes(a, b) {
75
92
  * ```
76
93
  */
77
94
  export function copyBytes(bytes) {
78
- return Uint8Array.from(bytes);
95
+ // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict
96
+ // because callers use it at byte-validation boundaries before mutating the detached copy.
97
+ return Uint8Array.from(abytes(bytes));
79
98
  }
80
99
  /**
81
100
  * Byte-swaps each 64-bit lane in place.
@@ -83,6 +102,11 @@ export function copyBytes(bytes) {
83
102
  * this boundary helper before aliasing them as host `Float64Array` lanes.
84
103
  * @param arr - Byte buffer whose length is a multiple of 8.
85
104
  * @returns The same buffer after in-place 64-bit lane byte swaps.
105
+ * @example
106
+ * Byte-swap one 64-bit lane in place.
107
+ * ```ts
108
+ * byteSwap64(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]));
109
+ * ```
86
110
  */
87
111
  export function byteSwap64(arr) {
88
112
  const bytes = new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
@@ -102,6 +126,18 @@ export function byteSwap64(arr) {
102
126
  }
103
127
  return arr;
104
128
  }
129
+ /**
130
+ * Byte-swaps 64-bit lanes on big-endian runtimes and returns the input unchanged on little-endian.
131
+ * This keeps Falcon's binary64 tables in canonical little-endian order before aliasing them as
132
+ * `Float64Array` lanes on the current host.
133
+ * @param arr - Buffer to pass through or swap in place.
134
+ * @returns The same buffer, normalized for Falcon's little-endian table layout.
135
+ * @example
136
+ * Normalize one host-endian buffer for Falcon's float tables.
137
+ * ```ts
138
+ * baswap64If(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]));
139
+ * ```
140
+ */
105
141
  export const baswap64If = isLE
106
142
  ? (arr) => arr
107
143
  : byteSwap64;
@@ -117,8 +153,9 @@ export const baswap64If = isLE
117
153
  */
118
154
  export function validateOpts(opts) {
119
155
  // Arrays silently passed here before, but these call sites expect named option-bag fields.
120
- if (Object.prototype.toString.call(opts) !== '[object Object]')
121
- throw new TypeError('expected valid options object');
156
+ if (isBytes(opts))
157
+ throw new TypeError('"opts" expected object, got Uint8Array');
158
+ aobject(opts, 'opts');
122
159
  }
123
160
  /**
124
161
  * Validates common verification options.
@@ -170,7 +207,7 @@ export function validateSigOpts(opts) {
170
207
  * ```
171
208
  */
172
209
  export function splitCoder(label, ...lengths) {
173
- const getLength = (c) => (typeof c === 'number' ? c : c.bytesLen);
210
+ const getLength = (c) => typeof c === 'number' ? c : c.bytesLen;
174
211
  const bytesLen = lengths.reduce((sum, a) => sum + getLength(a), 0);
175
212
  return {
176
213
  bytesLen,
@@ -222,15 +259,17 @@ export function splitCoder(label, ...lengths) {
222
259
  * ```
223
260
  */
224
261
  export function vecCoder(c, vecLen) {
225
- const bytesLen = vecLen * c.bytesLen;
262
+ const coder = c;
263
+ const bytesLen = vecLen * coder.bytesLen;
226
264
  return {
227
265
  bytesLen,
228
266
  encode: (u) => {
229
- if (u.length !== vecLen)
230
- throw new RangeError(`vecCoder.encode: wrong length=${u.length}. Expected: ${vecLen}`);
267
+ const uArr = aarray(u, 'u');
268
+ if (uArr.length !== vecLen)
269
+ throw new RangeError(`vecCoder.encode: wrong length=${uArr.length}. Expected: ${vecLen}`);
231
270
  const res = new Uint8Array(bytesLen);
232
- for (let i = 0, pos = 0; i < u.length; i++) {
233
- const b = c.encode(u[i]);
271
+ for (let i = 0, pos = 0; i < uArr.length; i++) {
272
+ const b = coder.encode(uArr[i]);
234
273
  res.set(b, pos);
235
274
  b.fill(0); // clean
236
275
  pos += b.length;
@@ -240,8 +279,8 @@ export function vecCoder(c, vecLen) {
240
279
  decode: (a) => {
241
280
  abytes_(a, bytesLen);
242
281
  const r = [];
243
- for (let i = 0; i < a.length; i += c.bytesLen)
244
- r.push(c.decode(a.subarray(i, i + c.bytesLen)));
282
+ for (let i = 0; i < a.length; i += coder.bytesLen)
283
+ r.push(coder.decode(a.subarray(i, i + coder.bytesLen)));
245
284
  return r;
246
285
  },
247
286
  };
@@ -270,6 +309,8 @@ export function cleanBytes(...list) {
270
309
  * Creates a 32-bit mask with the lowest `bits` bits set.
271
310
  * @param bits - Number of low bits to keep.
272
311
  * @returns Bit mask with `bits` ones.
312
+ * @throws On wrong argument types. {@link TypeError}
313
+ * @throws On wrong argument ranges or values. {@link RangeError}
273
314
  * @example
274
315
  * Create a low-bit mask for packed-field operations.
275
316
  * ```ts
@@ -277,8 +318,9 @@ export function cleanBytes(...list) {
277
318
  * ```
278
319
  */
279
320
  export function getMask(bits) {
280
- if (!Number.isSafeInteger(bits) || bits < 0 || bits > 32)
281
- throw new RangeError(`expected bits in [0..32], got ${bits}`);
321
+ anumber(bits, 'bits');
322
+ if (bits > 32)
323
+ throw new RangeError('"bits" expected <= 32, got ' + bits);
282
324
  // JS shifts are modulo 32, so bit 32 needs an explicit full-width mask.
283
325
  return bits === 32 ? 0xffffffff : ~(-1 << bits) >>> 0;
284
326
  }
@@ -298,8 +340,8 @@ export const EMPTY = /* @__PURE__ */ Uint8Array.of();
298
340
  * ```
299
341
  */
300
342
  export function getMessage(msg, ctx = EMPTY) {
301
- abytes_(msg);
302
- abytes_(ctx);
343
+ abytes_(msg, undefined, 'msg');
344
+ abytes_(ctx, undefined, 'ctx');
303
345
  if (ctx.length > 255)
304
346
  throw new RangeError('context should be 255 bytes or less');
305
347
  return concatBytes(new Uint8Array([0, ctx.length]), ctx, msg);
@@ -327,8 +369,14 @@ const oidNistP = /* @__PURE__ */ Uint8Array.from([6, 9, 0x60, 0x86, 0x48, 1, 0x6
327
369
  * ```
328
370
  */
329
371
  export function checkHash(hash, requiredStrength = 0) {
330
- if (!hash.oid || !equalBytes(hash.oid.subarray(0, 10), oidNistP))
331
- throw new Error('hash.oid is invalid: expected NIST hash');
372
+ if (typeof hash !== 'function' || typeof hash.create !== 'function')
373
+ throw new TypeError('"hash" expected hash function, got type=' + typeof hash);
374
+ ahash_(hash);
375
+ anumber(requiredStrength, 'requiredStrength');
376
+ const oid = hash.oid;
377
+ abytes_(oid, undefined, 'hash.oid');
378
+ if (!equalBytes(oid.subarray(0, 10), oidNistP))
379
+ throw new Error('"hash.oid" is invalid: expected NIST hash');
332
380
  // FIPS 204 / FIPS 205 require both collision and second-preimage strength; for approved NIST
333
381
  // hashes/XOFs under this OID subtree, the collision bound from the configured digest length is
334
382
  // the tighter runtime check, so enforce that lower bound here.
@@ -359,11 +407,31 @@ export function checkHash(hash, requiredStrength = 0) {
359
407
  * ```
360
408
  */
361
409
  export function getMessagePrehash(hash, msg, ctx = EMPTY) {
362
- abytes_(msg);
363
- abytes_(ctx);
410
+ checkHash(hash);
411
+ abytes_(msg, undefined, 'msg');
412
+ abytes_(ctx, undefined, 'ctx');
364
413
  if (ctx.length > 255)
365
414
  throw new RangeError('context should be 255 bytes or less');
366
415
  const hashed = hash(msg);
367
416
  return concatBytes(new Uint8Array([1, ctx.length]), ctx, hash.oid, hashed);
368
417
  }
369
- //# sourceMappingURL=utils.js.map
418
+ /**
419
+ * Asserts something is a string.
420
+ * @param value - Value to validate.
421
+ * @param title - Label included in thrown errors.
422
+ * @returns The validated string.
423
+ * @throws On wrong argument types. {@link TypeError}
424
+ * @example
425
+ * Validate a label string.
426
+ *
427
+ * ```ts
428
+ * astring('example', 'label');
429
+ * ```
430
+ */
431
+ export function astring(value, title = '') {
432
+ if (typeof value !== 'string') {
433
+ const prefix = title && `"${title}" `;
434
+ throw new TypeError(prefix + 'expected string, got type=' + typeof value);
435
+ }
436
+ return value;
437
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"_crystals.d.ts","sourceRoot":"","sources":["src/_crystals.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,aAAa,EAAc,KAAK,KAAK,EAAW,MAAM,YAAY,CAAC;AAEjF,qEAAqE;AACrE,MAAM,MAAM,GAAG,GAAG,CAChB,IAAI,EAAE,UAAU,EAChB,QAAQ,CAAC,EAAE,MAAM,KACd;IACH;;;OAGG;IACH,KAAK,EAAE,MAAM;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C;;;;;;;;;OASG;IACH,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,UAAU,CAAC;IAChD,mEAAmE;IACnE,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,wCAAwC;AACxC,oEAAoE;AACpE,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,UAAU,IAAI;IAC9C;;;;OAIG;IACH,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACtB,wCAAwC;IACxC,CAAC,EAAE,MAAM,CAAC;IACV,yDAAyD;IACzD,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV,wDAAwD;IACxD,aAAa,EAAE,MAAM,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