import * as plugins from './plugins.js'; import type { ICertManager } from './interfaces/certmanager.js'; import { SmartacmeCert } from './smartacme.classes.cert.js'; /** * the options for the class @see SmartAcme */ export interface ISmartAcmeOptions { accountEmail: string; accountPrivateKey?: string; /** * Certificate storage manager (e.g., Mongo or in-memory). */ certManager: ICertManager; environment: 'production' | 'integration'; /** * Optional retry/backoff configuration for transient failures */ retryOptions?: { /** number of retry attempts */ retries?: number; /** backoff multiplier */ factor?: number; /** initial delay in milliseconds */ minTimeoutMs?: number; /** maximum delay cap in milliseconds */ maxTimeoutMs?: number; }; /** * Pluggable ACME challenge handlers (DNS-01, HTTP-01, TLS-ALPN-01, etc.) */ challengeHandlers?: plugins.handlers.IChallengeHandler[]; /** * Order of challenge types to try (e.g. ['http-01','dns-01']). * Defaults to ['dns-01'] or first supported type from handlers. */ challengePriority?: string[]; /** * Maximum number of concurrent ACME issuances across all domains. * Defaults to 5. */ maxConcurrentIssuances?: number; /** * Maximum ACME orders allowed within the sliding window. * Defaults to 250 (conservative limit under Let's Encrypt's 300/3h). */ maxOrdersPerWindow?: number; /** * Sliding window duration in milliseconds for rate limiting. * Defaults to 3 hours (10_800_000 ms). */ orderWindowMs?: number; } /** * class SmartAcme * can be used for setting up communication with an ACME authority * * ```ts * const mySmartAcmeInstance = new SmartAcme({ * // see ISmartAcmeOptions for options * }) * ``` */ export declare class SmartAcme { private options; private client; private smartdns; logger: plugins.smartlog.Smartlog; private privateKey; certmanager: ICertManager; challengeHandlers: plugins.handlers.IChallengeHandler[]; private certmatcher; private retryOptions; private pendingChallenges; private challengePriority; private taskManager; private certIssuanceTask; private boundSigintHandler; private boundSigtermHandler; /** * Exposes the aggregated task event stream for observing certificate issuance progress. */ get certIssuanceEvents(): plugins.taskbuffer.TaskManager['taskSubject']; constructor(optionsArg: ISmartAcmeOptions); /** * starts the instance * ```ts * await myCloudlyInstance.start() // does not support options * ``` */ start(): Promise; /** * Stops the SmartAcme instance and closes certificate store connections. */ stop(): Promise; /** Retry helper with exponential backoff and AcmeError awareness */ private retry; /** Clean up pending challenges and shut down */ private handleShutdown; /** Handle process signals for graceful shutdown */ private handleSignal; /** * gets a certificate * it runs through the following steps * * * look in the database * * if in the database and still valid return it * * if not in the database announce it * * then get it from letsencrypt * * store it * * retrieve it from the database and return it * * @param domainArg * @param options Optional configuration for certificate generation */ getCertificateForDomain(domainArg: string, options?: { includeWildcard?: boolean; forceRenew?: boolean; }): Promise; /** * Performs the actual ACME certificate issuance flow. * Called by the certIssuanceTask's taskFunction. */ private performCertificateIssuance; }