import * as fs from 'fs'; import * as path from 'path'; import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); export interface ICertificates { privateKey: string; publicKey: string; } export function loadDefaultCertificates(): ICertificates { try { const certPath = path.join(__dirname, '..', 'assets', 'certs'); const privateKey = fs.readFileSync(path.join(certPath, 'key.pem'), 'utf8'); const publicKey = fs.readFileSync(path.join(certPath, 'cert.pem'), 'utf8'); if (!privateKey || !publicKey) { throw new Error('Failed to load default certificates'); } return { privateKey, publicKey }; } catch (error) { console.error('Error loading default certificates:', error); throw error; } }