/** * Deliverability and compliance helpers. Currently ships primitives for * RFC 2369 / RFC 8058 List-Unsubscribe: signing one-click tokens and a * framework-agnostic HTTP handler that verifies + dispatches to a * suppression store. * * @module */ import type { SuppressionStore } from "../suppression/index.mjs"; /** Opaque, tamper-proof token encoding the unsubscribe subject. */ export interface UnsubscribeTokenPayload { recipient: string; campaign?: string; /** Expiry as epoch seconds. Omit for non-expiring tokens. */ exp?: number; } /** Sign a one-click unsubscribe token with HMAC-SHA256. */ export declare function signUnsubscribeToken(payload: UnsubscribeTokenPayload, secret: string): Promise; /** Verify a token. Returns the payload on success, `null` on tamper / * expiry. Constant-time via Web Crypto `verify`. */ export declare function verifyUnsubscribeToken(token: string, secret: string, now?: () => number): Promise; /** Options for `defineUnsubscribeHandler`. */ export interface UnsubscribeHandlerOptions { secret: string; /** Query-string key that carries the token. Default: `t`. */ tokenParam?: string; /** Suppression store receiving the opt-out. */ store?: SuppressionStore; /** Optional hook fired after a successful unsubscribe. */ onUnsubscribe?: (payload: UnsubscribeTokenPayload) => void | Promise; /** Custom clock for testing. */ now?: () => number; } /** Framework-agnostic handler — give it a `Request`, it returns a * `Response`. RFC 8058 requires 200 OK on POST with no user * confirmation; we honor that. GET also works for mail-client URL * rendering. */ export declare function defineUnsubscribeHandler(opts: UnsubscribeHandlerOptions): (request: Request) => Promise;