@mikkelscheike/email-provider-links
Version:
TypeScript library for email provider detection with 93 providers (207 domains), concurrent DNS resolution, optimized performance, 94.65% test coverage, and enterprise security for login and password reset flows
54 lines • 1.88 kB
TypeScript
/**
* Email Provider Loader
*
* Integrates URL validation and hash verification to load and validate
* email provider data with security checks.
*/
import type { EmailProvider } from './index';
export interface LoadResult {
success: boolean;
providers: EmailProvider[];
securityReport: {
hashVerification: boolean;
urlValidation: boolean;
totalProviders: number;
validUrls: number;
invalidUrls: number;
securityLevel: 'SECURE' | 'WARNING' | 'CRITICAL';
issues: string[];
};
}
/**
* Clear the cache (useful for testing or when providers file changes)
*/
export declare function clearCache(): void;
/**
* Loads and validates email provider data with security checks
*
* @param providersPath - Path to the providers JSON file
* @param expectedHash - Optional expected hash for verification
* @returns Load result with validation details
*/
export declare function loadProviders(providersPath?: string, expectedHash?: string): LoadResult;
/**
* Development utility to generate and display current hashes
*/
export declare function initializeSecurity(): Record<string, string>;
/**
* Express middleware for provider loading with security checks (if using in web apps)
*/
interface SecurityMiddlewareOptions {
expectedHash?: string;
allowInvalidUrls?: boolean;
onSecurityIssue?: (report: LoadResult['securityReport']) => void;
getProviders?: () => LoadResult;
}
export declare function createSecurityMiddleware(options?: SecurityMiddlewareOptions): (req: any, res: any, next: any) => any;
declare const _default: {
loadProviders: typeof loadProviders;
initializeSecurity: typeof initializeSecurity;
createSecurityMiddleware: typeof createSecurityMiddleware;
clearCache: typeof clearCache;
};
export default _default;
//# sourceMappingURL=provider-loader.d.ts.map