import * as plugins from '../plugins.js'; import * as authInterfaces from '../data/auth.js'; export type TCertificateStatus = 'valid' | 'expiring' | 'expired' | 'provisioning' | 'failed' | 'unknown'; export type TCertificateSource = 'acme' | 'provision-function' | 'static' | 'none'; /** * What the running proxy is actually presenting on the wire for a domain, as * reported by the Rust engine. * * This is deliberately separate from the issued/stored view: a certificate can be * valid in storage while the engine still serves an older, expired one, and * reporting only the stored view is how a 21-day outage went unnoticed. Absent * when the engine cannot be queried — absence means "unknown", never "fine". */ export interface ICertificateServedState { expiryDate?: string; isValid: boolean; source?: string; } export interface ICertificateInfo { domain: string; routeNames: string[]; /** Combined verdict. Downgraded to 'failed' whenever `servedMismatch` is true. */ status: TCertificateStatus; source: TCertificateSource; tlsMode: 'terminate' | 'terminate-and-reencrypt' | 'passthrough'; /** Expiry of the issued/stored certificate. */ expiryDate?: string; issuer?: string; issuedAt?: string; error?: string; canReprovision: boolean; /** What the running proxy serves, when determinable. */ served?: ICertificateServedState; /** * True when a valid certificate is issued/stored but the proxy is still serving * an invalid or expired one. An issuance success must never mask this. */ servedMismatch?: boolean; backoffInfo?: { failures: number; retryAfter?: string; lastError?: string; }; } export interface IReq_GetCertificateOverview extends plugins.typedrequestInterfaces.implementsTR { method: 'getCertificateOverview'; request: { identity?: authInterfaces.IIdentity; apiToken?: string; }; response: { certificates: ICertificateInfo[]; summary: { total: number; valid: number; expiring: number; expired: number; failed: number; unknown: number; }; }; } export interface IReq_ReprovisionCertificateDomain extends plugins.typedrequestInterfaces.implementsTR { method: 'reprovisionCertificateDomain'; request: { identity?: authInterfaces.IIdentity; apiToken?: string; domain: string; forceRenew?: boolean; }; response: { success: boolean; message?: string; }; } export interface IReq_DeleteCertificate extends plugins.typedrequestInterfaces.implementsTR { method: 'deleteCertificate'; request: { identity?: authInterfaces.IIdentity; apiToken?: string; domain: string; }; response: { success: boolean; message?: string; }; }