2026-02-10 15:54:09 +00:00
|
|
|
import type { Email } from '../core/classes.email.js';
|
|
|
|
|
/**
|
|
|
|
|
* SPF result qualifiers
|
|
|
|
|
*/
|
|
|
|
|
export declare enum SpfQualifier {
|
|
|
|
|
PASS = "+",
|
|
|
|
|
NEUTRAL = "?",
|
|
|
|
|
SOFTFAIL = "~",
|
|
|
|
|
FAIL = "-"
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* SPF mechanism types
|
|
|
|
|
*/
|
|
|
|
|
export declare enum SpfMechanismType {
|
|
|
|
|
ALL = "all",
|
|
|
|
|
INCLUDE = "include",
|
|
|
|
|
A = "a",
|
|
|
|
|
MX = "mx",
|
|
|
|
|
IP4 = "ip4",
|
|
|
|
|
IP6 = "ip6",
|
|
|
|
|
EXISTS = "exists",
|
|
|
|
|
REDIRECT = "redirect",
|
|
|
|
|
EXP = "exp"
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* SPF mechanism definition
|
|
|
|
|
*/
|
|
|
|
|
export interface SpfMechanism {
|
|
|
|
|
qualifier: SpfQualifier;
|
|
|
|
|
type: SpfMechanismType;
|
|
|
|
|
value?: string;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* SPF record parsed data
|
|
|
|
|
*/
|
|
|
|
|
export interface SpfRecord {
|
|
|
|
|
version: string;
|
|
|
|
|
mechanisms: SpfMechanism[];
|
|
|
|
|
modifiers: Record<string, string>;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* SPF verification result
|
|
|
|
|
*/
|
|
|
|
|
export interface SpfResult {
|
|
|
|
|
result: 'pass' | 'neutral' | 'softfail' | 'fail' | 'temperror' | 'permerror' | 'none';
|
|
|
|
|
explanation?: string;
|
|
|
|
|
domain: string;
|
|
|
|
|
ip: string;
|
|
|
|
|
record?: string;
|
|
|
|
|
error?: string;
|
|
|
|
|
}
|
|
|
|
|
/**
|
2026-02-10 20:30:43 +00:00
|
|
|
* Class for verifying SPF records.
|
|
|
|
|
* Delegates actual SPF evaluation to the Rust security bridge.
|
|
|
|
|
* Retains parseSpfRecord() for lightweight local parsing.
|
2026-02-10 15:54:09 +00:00
|
|
|
*/
|
|
|
|
|
export declare class SpfVerifier {
|
2026-02-10 20:30:43 +00:00
|
|
|
constructor(_dnsManager?: any);
|
2026-02-10 15:54:09 +00:00
|
|
|
/**
|
2026-02-10 20:30:43 +00:00
|
|
|
* Parse SPF record from TXT record (pure string parsing, no DNS)
|
2026-02-10 15:54:09 +00:00
|
|
|
*/
|
|
|
|
|
parseSpfRecord(record: string): SpfRecord | null;
|
|
|
|
|
/**
|
2026-02-10 20:30:43 +00:00
|
|
|
* Verify SPF for a given email — delegates to Rust bridge
|
2026-02-10 15:54:09 +00:00
|
|
|
*/
|
|
|
|
|
verify(email: Email, ip: string, heloDomain: string): Promise<SpfResult>;
|
|
|
|
|
/**
|
2026-02-10 20:30:43 +00:00
|
|
|
* Check if email passes SPF verification and apply headers
|
2026-02-10 15:54:09 +00:00
|
|
|
*/
|
|
|
|
|
verifyAndApply(email: Email, ip: string, heloDomain: string): Promise<boolean>;
|
|
|
|
|
}
|