/** Protects (encrypts + authenticates) small cookie payloads. Replace to key cookies from your own KMS * (a hosted-seam extension point). */ export interface ICookieProtector { protect(plaintext: string, purpose: string): Promise; /** Returns null (not throw) on any tamper/decrypt failure. */ unprotect(protectedText: string, purpose: string): Promise; } /** Default cookie protector: AES-256-GCM (JWE `dir`/`A256GCM`) with a per-purpose key derived from a * secret via SHA-256. Uses Web Crypto, so it also runs at the edge. */ export declare class JoseCookieProtector implements ICookieProtector { private readonly secret; constructor(secret: string); protect(plaintext: string, purpose: string): Promise; unprotect(protectedText: string, purpose: string): Promise; /** * Derives the per-purpose AES key with HKDF-SHA256 rather than a bare digest. * * This was `SHA-256(secret | purpose)` — one unsalted round over the raw secret. SHA-256 is fast * by design, so if the secret is anything short of high-entropy random (an operator-chosen * passphrase, a value copied from a wiki) it is directly guessable offline from one captured * cookie: recovering it yields the key for every purpose, which decrypts and FORGES the correlation * and session cookies. HKDF is the right primitive for turning key material into per-context keys, * and it carries the purpose as `info` instead of splicing it into the hash input. */ private deriveKey; }