import type * as http from 'node:http'; import type { IAcmeDirectory } from '../ts/acme/acme.interfaces.js'; /** * GET /directory — Returns the ACME directory object with all endpoint URLs. */ export function createDirectoryHandler(baseUrl: string) { return async ( _req: http.IncomingMessage, res: http.ServerResponse, _params: Record, _body: any, ): Promise => { const directory: IAcmeDirectory = { newNonce: `${baseUrl}/new-nonce`, newAccount: `${baseUrl}/new-account`, newOrder: `${baseUrl}/new-order`, revokeCert: `${baseUrl}/revoke-cert`, keyChange: `${baseUrl}/key-change`, meta: { termsOfService: `${baseUrl}/terms`, website: `${baseUrl}`, caaIdentities: [], externalAccountRequired: false, }, }; res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify(directory)); }; }