import type { IServerOrderStore, IServerOrder, IServerAuthorization, IServerChallenge, } from './server.interfaces.js'; /** * In-memory order/authorization/challenge/certificate storage for the ACME server. */ export class MemoryOrderStore implements IServerOrderStore { private orders = new Map(); private authorizations = new Map(); private challenges = new Map(); private certPems = new Map(); async createOrder(order: IServerOrder): Promise { this.orders.set(order.id, order); return order; } async getOrder(id: string): Promise { return this.orders.get(id) || null; } async updateOrder(id: string, updates: Partial): Promise { const order = this.orders.get(id); if (order) { Object.assign(order, updates); } } async createAuthorization(authz: IServerAuthorization): Promise { this.authorizations.set(authz.id, authz); return authz; } async getAuthorization(id: string): Promise { return this.authorizations.get(id) || null; } async updateAuthorization(id: string, updates: Partial): Promise { const authz = this.authorizations.get(id); if (authz) { Object.assign(authz, updates); } } async createChallenge(challenge: IServerChallenge): Promise { this.challenges.set(challenge.id, challenge); return challenge; } async getChallenge(id: string): Promise { return this.challenges.get(id) || null; } async updateChallenge(id: string, updates: Partial): Promise { const challenge = this.challenges.get(id); if (challenge) { Object.assign(challenge, updates); } } async storeCertPem(orderId: string, pem: string): Promise { this.certPems.set(orderId, pem); } async getCertPem(orderId: string): Promise { return this.certPems.get(orderId) || null; } }