/** * Type definitions for SmartAcme interfaces used by ChallengeResponder * These reflect the actual SmartAcme API based on the documentation */ import * as plugins from '../../plugins.js'; /** * Structure for SmartAcme certificate result */ export interface SmartAcmeCert { id?: string; domainName: string; created?: number | Date | string; privateKey: string; publicKey: string; csr?: string; validUntil: number | Date | string; } /** * Structure for SmartAcme options */ export interface SmartAcmeOptions { accountEmail: string; certManager: ICertManager; environment: 'production' | 'integration'; challengeHandlers: IChallengeHandler[]; challengePriority?: string[]; retryOptions?: { retries?: number; factor?: number; minTimeoutMs?: number; maxTimeoutMs?: number; }; } /** * Interface for certificate manager */ export interface ICertManager { init(): Promise; get(domainName: string): Promise; put(cert: SmartAcmeCert): Promise; delete(domainName: string): Promise; close?(): Promise; } /** * Interface for challenge handler */ export interface IChallengeHandler { getSupportedTypes(): string[]; prepare(ch: T): Promise; verify?(ch: T): Promise; cleanup(ch: T): Promise; checkWetherDomainIsSupported(domain: string): Promise; } /** * HTTP-01 challenge type */ export interface Http01Challenge { type: string; // 'http-01' token: string; keyAuthorization: string; webPath: string; } /** * HTTP-01 Memory Handler Interface */ export interface Http01MemoryHandler extends IChallengeHandler { handleRequest(req: plugins.http.IncomingMessage, res: plugins.http.ServerResponse, next?: () => void): void; } /** * SmartAcme main class interface */ export interface SmartAcme { start(): Promise; stop(): Promise; getCertificateForDomain(domain: string): Promise; on?(event: string, listener: (data: any) => void): void; eventEmitter?: plugins.EventEmitter; }