/** * TLS/mTLS dispatcher utilities for client certificate authentication. * * This module provides utilities for creating undici Agents with custom * TLS options, enabling two-factor authentication via client certificates. * * @module clients/tls-dispatcher */ import { Agent } from 'undici'; /** * TLS options for creating a dispatcher. */ export interface TlsOptions { /** Path to PKCS12 (.p12/.pfx) certificate file */ certificate?: string; /** Passphrase for the certificate */ passphrase?: string; /** Whether to reject unauthorized (invalid/self-signed) certificates */ rejectUnauthorized?: boolean; } /** * Creates an undici Agent with custom TLS options for mTLS/self-signed cert support. * * Returns undefined if no TLS options are needed (default fetch behavior). * * @param options - TLS configuration options * @returns An undici Agent configured for TLS, or undefined if not needed * * @example * // Client certificate authentication * const dispatcher = createTlsDispatcher({ * certificate: './my-cert.p12', * passphrase: 'secret', * }); * * @example * // Self-signed certificate support * const dispatcher = createTlsDispatcher({ * rejectUnauthorized: false, * }); */ export declare function createTlsDispatcher(options: TlsOptions): Agent | undefined;