/** * Certificate management module for SmartProxy * Provides certificate provisioning, storage, and management capabilities */ // Certificate types and models export * from './models/certificate-types.js'; // Certificate events export * from './events/certificate-events.js'; // Certificate providers export * from './providers/cert-provisioner.js'; // ACME related exports export * from './acme/acme-factory.js'; export * from './acme/challenge-handler.js'; // Certificate utilities export * from './utils/certificate-helpers.js'; // Certificate storage export * from './storage/file-storage.js'; // Convenience function to create a certificate provisioner with common settings import { CertProvisioner } from './providers/cert-provisioner.js'; import type { TCertProvisionObject } from './providers/cert-provisioner.js'; import { buildPort80Handler } from './acme/acme-factory.js'; import type { IAcmeOptions, IRouteForwardConfig } from './models/certificate-types.js'; import type { IRouteConfig } from '../proxies/smart-proxy/models/route-types.js'; /** * Interface for NetworkProxyBridge used by CertProvisioner */ interface ICertNetworkProxyBridge { applyExternalCertificate(certData: any): void; } /** * Creates a complete certificate provisioning system with default settings * @param routeConfigs Route configurations that may need certificates * @param acmeOptions ACME options for certificate provisioning * @param networkProxyBridge Bridge to apply certificates to network proxy * @param certProvider Optional custom certificate provider * @returns Configured CertProvisioner */ export function createCertificateProvisioner( routeConfigs: IRouteConfig[], acmeOptions: IAcmeOptions, networkProxyBridge: ICertNetworkProxyBridge, certProvider?: (domain: string) => Promise ): CertProvisioner { // Build the Port80Handler for ACME challenges const port80Handler = buildPort80Handler(acmeOptions); // Extract ACME-specific configuration const { renewThresholdDays = 30, renewCheckIntervalHours = 24, autoRenew = true, routeForwards = [] } = acmeOptions; // Create and return the certificate provisioner return new CertProvisioner( routeConfigs, port80Handler, networkProxyBridge, certProvider, renewThresholdDays, renewCheckIntervalHours, autoRenew, routeForwards ); }