UNPKG

email-domain-check

Version:

Comprehensive email domain validation library with DNS, MX, SMTP, DKIM, DMARC and MTA-STS support.

96 lines (95 loc) 2.26 kB
export declare enum RecordKind { Custom = 0, SPF1 = 1, DKIM1 = 2, DMARC1 = 3, STSv1 = 4, CustomKV = 5 } export interface CustomRecord { raw: string; errors: string[]; value: string; } export interface SPF1Record { raw: string; errors: string[]; v: string; a?: boolean; mx?: boolean; all?: string; include?: string[]; ip4?: string[]; ip6?: string[]; ptr?: boolean; exists?: string; redirect?: string; exp?: string; 'a:domain'?: string; 'mx:domain'?: string; [key: string]: string | string[] | boolean | number | undefined; } export interface DMARC1Record { raw: string; errors: string[]; v: string; p?: string; sp?: string; rua?: string[]; ruf?: string[]; adkim?: string; aspf?: string; ri?: number; fo?: string[]; pct?: number; rf?: string; [key: string]: string | string[] | number | undefined; } export interface DKIM1Record { raw: string; errors: string[]; v?: string; k?: string; p?: string; h?: string[]; s?: string[]; t?: string[]; n?: string; [key: string]: string | string[] | undefined; } export interface STSv1Record { raw: string; errors: string[]; v: string; id: string; [key: string]: string | string[] | undefined; } export interface CustomKVRecord { raw: string; errors: string[]; key: string; value: string; } export declare class TXTResult { records: TXTRecord[]; getCustomRecords(): CustomRecord[] | null; getSPF(): SPF1Record | null; getDMARC(): DMARC1Record | null; getDKIM(): DKIM1Record | null; getSTS(): STSv1Record | null; getCustomKVRecord(key?: string): CustomKVRecord | null; getAllKVRecord(): CustomKVRecord[] | null; } export declare class TXTRecord { raw: string; kind: RecordKind; parsed: CustomRecord | SPF1Record | DMARC1Record | DKIM1Record | STSv1Record | CustomKVRecord | null; constructor(raw: string); private parse; parseSPF1(raw: string): SPF1Record; parseDMARC1(raw: string): DMARC1Record; parseDKIM1(raw: string): DKIM1Record; parseSTSv1(raw: string): STSv1Record; isValid(): boolean; toString(): string; }