fix(dcrouter): persist proxy certificate validity dates and improve certificate status initialization

This commit is contained in:
2026-02-16 02:50:25 +00:00
parent 4e32745a8f
commit de0b7d1fe0
7 changed files with 78 additions and 29 deletions

View File

@@ -167,8 +167,16 @@ export class CertificateHandler {
issuedAt = new Date(certData.created).toISOString();
}
issuer = 'smartacme-dns-01';
} else if (certData?.publicKey) {
// certStore has the cert — parse PEM for expiry
try {
const x509 = new plugins.crypto.X509Certificate(certData.publicKey);
expiryDate = new Date(x509.validTo).toISOString();
issuedAt = new Date(x509.validFrom).toISOString();
} catch { /* PEM parsing failed */ }
status = 'valid';
issuer = 'cert-store';
} else if (certData) {
// certStore has the cert (no expiry metadata) — it's loaded and serving
status = 'valid';
issuer = 'cert-store';
}