/** * Thrown when every candidate drawn from the fixed 16,320-byte derivation * stream is rejected (spec §6.11). `candidatesDrawn` is the number of * whole `L`-byte chunks the stream actually contains for this modulus -- * `floor(16320 / L)` -- counted from the loop rather than computed from the * constant, so a mutation that shrank the stream (or widened the chunking * rule to admit the trailing partial chunk) would change this observable * value rather than passing silently. * * Failure is deterministic in `(ikm, n)`: the stream is a pure function of * its inputs, so retrying with the same `ikm` reproduces the same failure * forever. Per §6.11 the caller MUST advance to a fresh coin index and * derive a new `ikm` -- never retry the same index, and never substitute a * random `r` (that would forfeit seed-only recovery, §6.10). */ export declare class BlindingExhaustedError extends Error { readonly candidatesDrawn: number; constructor(candidatesDrawn: number); } /** * Deterministically select `r` with `1 < r < n` and `gcd(r, n) = 1`. * * Rejection sampling, never modular reduction: reducing a wide draw mod `n` * would bias the distribution and, more importantly, would not match the * Rust and Solidity-adjacent implementations. * * Two properties a port has to reproduce exactly (spec §6.11), both of * which are pinned by `selectSeeded.test.ts` rather than left as * assumptions: * * 1. Expand exactly `MAX_HKDF_OUT` (16,320) bytes, ONCE -- not "enough for * the draws attempted". Re-expanding per candidate, or scaling the * expansion length with the number of draws, changes the candidate * sequence and breaks byte-exact agreement with the Rust issuer. * 2. Consume only whole `L`-byte chunks. `16320 = 63*256 + 192` at 2048 * bits, so a trailing 192-byte chunk exists; treating it as a candidate * admits an `r` with 64 leading zero bytes -- wildly non-uniform, and a * value no conforming implementation would ever produce. * * `L` is computed locally (`byteWidth`), not via any RSA-modulus-domain * helper: this function is defined over an arbitrary modulus -- the shared * vectors exercise `n = 2` and `n = 7` -- and a helper that additionally * enforced the RSA minimum-modulus-size / byte-alignment rules (a Task 5/6 * concern) would reject those fixtures. */ export declare function selectSeeded(ikm: Uint8Array, n: bigint): bigint;