import type { IAcmeIdentifier } from '../ts/acme/acme.interfaces.js'; // ============================================================================ // Server configuration // ============================================================================ export interface IAcmeServerOptions { port?: number; hostname?: string; baseUrl?: string; /** When false, challenges auto-approve on trigger (useful for testing) */ challengeVerification?: boolean; caOptions?: { commonName?: string; validityDays?: number; certValidityDays?: number; }; } // ============================================================================ // Pluggable storage interfaces // ============================================================================ export interface IServerAccountStore { create(account: IServerAccount): Promise; getByThumbprint(thumbprint: string): Promise; getByUrl(url: string): Promise; } export interface IServerOrderStore { createOrder(order: IServerOrder): Promise; getOrder(id: string): Promise; updateOrder(id: string, updates: Partial): Promise; createAuthorization(authz: IServerAuthorization): Promise; getAuthorization(id: string): Promise; updateAuthorization(id: string, updates: Partial): Promise; createChallenge(challenge: IServerChallenge): Promise; getChallenge(id: string): Promise; updateChallenge(id: string, updates: Partial): Promise; storeCertPem(orderId: string, pem: string): Promise; getCertPem(orderId: string): Promise; } // ============================================================================ // Internal server models // ============================================================================ export interface IServerAccount { id: string; thumbprint: string; url: string; jwk: Record; status: string; contact: string[]; createdAt: string; } export interface IServerOrder { id: string; accountUrl: string; status: string; identifiers: IAcmeIdentifier[]; authorizationIds: string[]; expires: string; finalize: string; certificate?: string; } export interface IServerAuthorization { id: string; orderId: string; identifier: IAcmeIdentifier; status: string; expires: string; challengeIds: string[]; wildcard?: boolean; } export interface IServerChallenge { id: string; authorizationId: string; type: string; token: string; status: string; validated?: string; error?: { type: string; detail: string }; } // ============================================================================ // Route handler type // ============================================================================ export type TRouteHandler = ( req: import('node:http').IncomingMessage, res: import('node:http').ServerResponse, params: Record, body: any, ) => Promise;