import type { Http01Store, ObtainCertificateOptions, ObtainCertificateResult } from '@stacksjs/tlsx'; import type { OnDemandTlsConfig } from './types'; import type { SniTlsEntry } from './sni'; /** * Bun cannot hot-reload TLS. A local foreground process can recreate its * listener, while a supervised production process should restart after the * certificate is persisted and let its supervisor bring it back with the new * SNI set. This avoids a Bun 1.3.x Linux crash in stop-and-rebind. */ export declare function resolveCertificateReloadStrategy(env?: Record): CertificateReloadStrategy; /** * True if `host` is covered by the `allowedSuffixes` allowlist: it equals a * suffix, or is a subdomain of one (`a.example.com` for suffix `example.com`). */ export declare function matchesAllowedSuffix(host: string, suffixes: string[] | undefined): boolean; /** Strict-ish hostname guard so we never feed junk Host headers into ACME. */ export declare function isLikelyHostname(host: string): boolean; export declare interface OnDemandCertManagerOptions { config: OnDemandTlsConfig certsDir: string initial?: SniTlsEntry[] onCertAdded?: (entries: SniTlsEntry[]) => void | Promise http01Store?: Http01Store issuer?: CertIssuer verbose?: boolean negativeCacheMs?: number } export type CertificateReloadStrategy = 'rebind' | 'restart'; /** * The issuance function the manager calls. Defaults to tlsx's * {@link obtainCertificate}; tests inject a stub so the suite never touches * Let's Encrypt. */ export type CertIssuer = (options: ObtainCertificateOptions) => Promise; /** * Holds the live SNI cert set and lazily issues certs for approved hosts. * * The set is keyed by SNI server name; `ensureCert(host)` is the entry point for * both the reactive `:80` path and programmatic pre-warming. */ export declare class OnDemandCertManager { constructor(opts: OnDemandCertManagerOptions); get challengeStore(): Http01Store; sniEntries(): SniTlsEntry[]; hasCert(host: string): boolean; isApproved(host: string): Promise; ensureCert(host: string): Promise; }