76 lines
2.2 KiB
TypeScript
76 lines
2.2 KiB
TypeScript
/**
|
|
* DNS record validation status for a single email-related record (MX, SPF, DKIM, DMARC).
|
|
*/
|
|
export type TDnsRecordStatus = 'valid' | 'missing' | 'invalid' | 'unchecked';
|
|
|
|
/**
|
|
* An email domain managed by dcrouter.
|
|
*
|
|
* Each email domain is linked to an existing dcrouter DNS domain (dcrouter-hosted
|
|
* or provider-managed). The DNS management path is inherited from the linked domain
|
|
* — no separate DNS mode is needed.
|
|
*/
|
|
export interface IEmailDomain {
|
|
id: string;
|
|
/** Fully qualified email domain name (e.g. 'example.com' or 'mail.example.com'). */
|
|
domain: string;
|
|
/** ID of the linked dcrouter DNS domain — determines how DNS records are managed. */
|
|
linkedDomainId: string;
|
|
/** Optional subdomain prefix (e.g. 'mail' for mail.example.com). Empty/undefined = bare domain. */
|
|
subdomain?: string;
|
|
/** DKIM configuration and key state. */
|
|
dkim: IEmailDomainDkim;
|
|
/** Optional per-domain rate limits. */
|
|
rateLimits?: IEmailDomainRateLimits;
|
|
/** DNS record validation status — populated by validateDns(). */
|
|
dnsStatus: IEmailDomainDnsStatus;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface IEmailDomainDkim {
|
|
/** DKIM selector (default: 'default'). */
|
|
selector: string;
|
|
/** RSA key size in bits (default: 2048). */
|
|
keySize: number;
|
|
/** Base64-encoded public key — populated after key generation. */
|
|
publicKey?: string;
|
|
/** Whether automatic key rotation is enabled. */
|
|
rotateKeys: boolean;
|
|
/** Days between key rotations (default: 90). */
|
|
rotationIntervalDays: number;
|
|
/** ISO date of last key rotation. */
|
|
lastRotatedAt?: string;
|
|
}
|
|
|
|
export interface IEmailDomainRateLimits {
|
|
outbound?: {
|
|
messagesPerMinute?: number;
|
|
messagesPerHour?: number;
|
|
messagesPerDay?: number;
|
|
};
|
|
inbound?: {
|
|
messagesPerMinute?: number;
|
|
connectionsPerIp?: number;
|
|
recipientsPerMessage?: number;
|
|
};
|
|
}
|
|
|
|
export interface IEmailDomainDnsStatus {
|
|
mx: TDnsRecordStatus;
|
|
spf: TDnsRecordStatus;
|
|
dkim: TDnsRecordStatus;
|
|
dmarc: TDnsRecordStatus;
|
|
lastCheckedAt?: string;
|
|
}
|
|
|
|
/**
|
|
* A single required DNS record for an email domain — used for display / copy-paste.
|
|
*/
|
|
export interface IEmailDnsRecord {
|
|
type: 'MX' | 'TXT';
|
|
name: string;
|
|
value: string;
|
|
status: TDnsRecordStatus;
|
|
}
|