import type { IServerAccountStore, IServerAccount } from './server.interfaces.js'; /** * In-memory account storage for the ACME server. */ export class MemoryAccountStore implements IServerAccountStore { private accounts = new Map(); private byThumbprint = new Map(); private byUrl = new Map(); async create(account: IServerAccount): Promise { this.accounts.set(account.id, account); this.byThumbprint.set(account.thumbprint, account.id); this.byUrl.set(account.url, account.id); return account; } async getByThumbprint(thumbprint: string): Promise { const id = this.byThumbprint.get(thumbprint); return id ? this.accounts.get(id) || null : null; } async getByUrl(url: string): Promise { const id = this.byUrl.get(url); return id ? this.accounts.get(id) || null : null; } }