import type { MlDsaParams } from './params.js'; import { type PreHashAlgorithm } from './hashvariant.js'; /** * FIPS 204 §5.2 / §5.3 line 1, ctx must be ≤ 255 bytes (the byte that * follows the domain separator in M' is ctx.length, so longer values * cannot be encoded). */ export declare function validateContext(ctx: Uint8Array): void; /** * FIPS 204 §3.6.2, verification key must be exactly pkBytes long for * its parameter set. Throws here; the public verify() method catches * the throw and returns false so wrong-length pk reads as "not a valid * signature" rather than a caller error. */ export declare function validateVerificationKey(vk: Uint8Array, params: MlDsaParams): void; /** * Signing key must be exactly skBytes long for its parameter set. Wrong * length is a caller error (the caller produced this sk via keygen* or * loaded it from storage they own); throw RangeError unconditionally. */ export declare function validateSigningKey(sk: Uint8Array, params: MlDsaParams): void; /** * FIPS 204 §3.6.2, signature must be exactly sigBytes long for its * parameter set. Throws here; the public verify() method catches and * returns false (same protocol shape as wrong-length pk). */ export declare function validateSignature(sig: Uint8Array, params: MlDsaParams): void; /** * FIPS 204 Algorithm 7 line 1, rnd must be 32 bytes. Used by signDerand * (the testing/CAVP API). Hedged sign supplies rnd internally; deterministic * sign uses zeros; only signDerand exposes rnd to the caller. */ export declare function validateRnd(rnd: Uint8Array): void; /** * Confirms M is a Uint8Array. FIPS 204 places no length restriction on * the message, M is absorbed into a SHAKE256 sponge (μ derivation, * §6.2/§6.3) so any byte length is admissible. The bit-vs-byte * distinction visible in §5.2/§5.3 (BytesToBits in M' construction) * collapses at the byte boundary inside our SHAKE wrapper. */ export declare function validateMessage(M: Uint8Array): void; /** * FIPS 204 §5.4.1, the prehash PH_M passed to HashML-DSA Sign_internal / * Verify_internal must be exactly the digest size of `algo`. Used by the * `*Prehashed` family where the caller computes PH externally; the * non-prehashed family produces PH internally so this check is implicit. * * Throws `SigningError('sig-malformed-input')` on mismatch. The verify * surface intercepts this to return false (a wrong-size digest is a * structural mismatch, indistinguishable from a wrong signature), while * the sign surface lets the throw propagate (the caller supplied bad * input, that is a contract violation per the FIPS 204 §5.4 input * contract). */ export declare function validateDigest(digest: Uint8Array, algo: PreHashAlgorithm): void;