import type { PreHashAlgorithm } from '../mldsa/hashvariant.js'; import type { PrehashAlgorithm } from './types.js'; /** * Maximum user_ctx length in bytes. Matches the FIPS 204 (Module-Lattice- * Based Digital Signature Standard) §3.6.1 native ctx cap; buildEffectiveCtx * enforces it as the first check. */ export declare const USER_CTX_MAX = 255; /** Maximum ctxDomain length in bytes; enforced by suite factories. */ export declare const CTX_DOMAIN_MAX = 32; /** * Construct effective_ctx from suite domain and user-supplied ctx. * * Format: [domain_len: u8][domain_bytes][user_ctx_len: u8][user_ctx_bytes] * * Two independent length checks gate the construction: * * 1. user_ctx ≤ USER_CTX_MAX (255). Mirrors FIPS 204 §3.6.1's ctx cap on * the user-supplied half before any framing is applied. * 2. Combined effective_ctx ≤ 255. The 1-byte length prefixes plus the * domain and user_ctx bytes must fit FIPS 204 §3.6.1's ctx parameter, * which is what the result is ultimately passed to. The effective * per-suite user_ctx ceiling is `253 - len(domainBytes)`. * * Both throws share the `sig-ctx-too-long` discriminator. The absolute * check fires first, so callers passing user_ctx > 255 always trip the * absolute cap regardless of ctxDomain length. * * @throws SigningError('sig-ctx-too-long') if user_ctx exceeds USER_CTX_MAX * or if the combined effective_ctx exceeds 255 bytes. * @throws Error (not SigningError) if ctxDomain exceeds CTX_DOMAIN_MAX; * that's a developer-time mistake, not a caller mistake. */ export declare function buildEffectiveCtx(ctxDomain: string, userCtx: Uint8Array): Uint8Array; /** * Map the lib's lowercase, hyphenated PrehashAlgorithm to the identifier * MlDsaBase's signHash / verifyHash family accepts (FIPS 204 §5.4.1). * SHAKE entries deliberately use the no-hyphen spelling 'SHAKE128' / * 'SHAKE256' that the mldsa layer expects. */ export declare function prehashAlgoToMldsa(algo: PrehashAlgorithm): PreHashAlgorithm;