import type { Socket } from 'node:net'; export declare class HpackError extends Error { } export declare function huffmanDecode(bytes: Uint8Array): string; export declare class HpackDecoder { private table; private size; private maxSize; /** the SETTINGS_HEADER_TABLE_SIZE this endpoint advertised (the decoder's ceiling; 4096 is the * protocol default, which this server never changes) */ private readonly limit; constructor(headerTableSize?: number); decode(block: Uint8Array): Array<[string, string]>; private insert; private evict; } /** Every header as a literal without indexing, new name, no huffman (RFC 7541 ยง6.2.2). */ export declare function hpackEncode(headers: Array<[string, string]>): Uint8Array; export type H2Request = { headers: Record; body: Uint8Array; /** aborted when the peer resets the stream or the connection goes away */ signal: AbortSignal; }; export type H2Response = { /** send response headers; `end` closes the stream with them (a trailers-only answer) */ headers(headers: Array<[string, string]>, end?: boolean): void; data(bytes: Uint8Array): void; /** close the stream with trailing headers */ trailers(headers: Array<[string, string]>): void; readonly closed: boolean; }; export type H2Handler = (request: H2Request, response: H2Response) => void; /** An HTTP/1 request arriving on the same port, answered by a fetch handler. */ export type Http1Handler = (request: Request) => Response | Promise; /** Speak HTTP/2 (h2c with prior knowledge) on an accepted socket; an HTTP/1 request line is handed to * `http1` when given. The listener that accepts sockets is the pack's server module's. */ export declare function acceptH2Connection(socket: Socket, handler: H2Handler, http1?: Http1Handler): { teardown(): void; };