/** * Minimum length required of a cookie-signing secret. * * Cookie signatures use HMAC-SHA256; a weak or empty secret makes the signature trivially * forgeable. 32 characters (~256 bits when random) is the floor for a usable secret. A shorter * or empty secret is rejected loudly rather than silently producing a forgeable signature. */ export declare const MIN_COOKIE_SECRET_LENGTH = 32; /** * Whether a secret is strong enough to sign/verify cookies. * * @param secret - The candidate secret. * @returns True when the secret is a string of at least {@link MIN_COOKIE_SECRET_LENGTH} chars. */ export declare const isSignableCookieSecret: (secret: unknown) => secret is string; /** * Check if the value is serialized. * @param value - The value to check. */ export declare const isCookieValueSerialized: (value: unknown) => value is string; /** * Check if the value is signed. * @param value - The value to check. */ export declare const isCookieValueSigned: (value: unknown) => boolean; /** * Sign the cookie value. * * @param value - The value to sign. * @param secret - Secret for signing (must be strong, see {@link isSignableCookieSecret}). * @throws {CookieError} If the value is not a string, is already signed, or the secret is weak/empty. */ export declare const signCookieValue: (value: unknown, secret: string) => string; /** * Unsign the cookie value. * * @param value - The signed value. * @param secret - Secret for unsigning (must be strong, see {@link isSignableCookieSecret}). * @throws {CookieError} If the value is not a signed string or the secret is weak/empty. */ export declare const unsignCookieValue: (value: unknown, secret: string) => string | false;