/** * hashcash.ts — Proof-of-Work for VaaS DoS protection * * Red Team Fix #8: Requires unauthenticated API callers to present a * valid PoW token, making volumetric DoS economically infeasible. * * Uses WebCrypto (crypto.subtle) for Cloudflare Workers compatibility. * * Challenge format: `${dateHourUTC}:${clientIdentifier}` * The client must find a nonce such that SHA-256(challenge + ":" + nonce) * has `difficulty` leading zero hex characters. * * Default difficulty: 4 (approx 65,536 attempts, ~100ms on modern hardware). */ /** Default number of leading zero hex chars required. */ export declare const DEFAULT_POW_DIFFICULTY = 4; /** * Generate the current date-hour challenge component. * Format: YYYYMMDDHH (UTC). */ export declare function getDateHourUTC(date?: Date): string; /** * Build a challenge string from the date-hour and client identifier. */ export declare function buildChallenge(clientIdentifier: string, date?: Date): string; /** * Find a nonce such that SHA-256(challenge + ":" + nonce) has `difficulty` * leading zero hex characters. * * @param challenge The challenge string (e.g. "2026021223:192.168.1.1") * @param difficulty Number of leading zero hex chars required (default: 4) * @returns The nonce string that satisfies the PoW */ export declare function generatePoW(challenge: string, difficulty?: number): Promise; /** * Verify that a nonce satisfies the PoW requirement. * * @param challenge The challenge string * @param nonce The claimed nonce * @param difficulty Number of leading zero hex chars required (default: 4) * @returns true if the PoW is valid */ export declare function verifyPoW(challenge: string, nonce: string, difficulty?: number): Promise; //# sourceMappingURL=hashcash.d.ts.map