games_app/backend/dist/services/emailService.d.ts
2026-11-04 18:15:04 +02:00

66 lines
3.1 KiB
TypeScript

/**
* Outbound email delivery for verification and transactional messages.
* Supports SMTP (production) and console logging (development).
*/
/** Gmail app passwords are often copied with spaces — strip them. */
export declare function normalizeSmtpPass(pass: string): string;
/**
* Returns true when emails are logged to stdout instead of SMTP (local Docker default).
*/
export declare function usesConsoleEmailTransport(): boolean;
/**
* Returns true when SMTP is fully configured for real email delivery.
*/
export declare function isSmtpConfigured(): boolean;
/** Verifies SMTP credentials (call on deploy or via CLI). */
export declare function verifySmtpConnection(): Promise<void>;
/**
* Visible From header (EMAIL_FROM).
* Tloto production uses Microsoft 365: SMTP_USER=admin@…, EMAIL_FROM=info@… (alias).
*/
export declare function resolveFromAddress(): string;
/** Reply-To: EMAIL_REPLY_TO, else the address inside EMAIL_FROM. */
export declare function resolveReplyToAddress(): string | undefined;
/**
* @param to - Recipient email address
* @param verifyUrl - Full URL opened by the user to confirm ownership
*/
export declare function sendVerificationEmail(to: string, verifyUrl: string): Promise<void>;
/**
* Sends a password reset message with a clickable link.
*/
export declare function sendPasswordResetEmail(to: string, resetUrl: string): Promise<void>;
type SecurityAlertPayload = {
alertId: string;
severity: string;
type: string;
title: string;
details: string;
userId: string | null;
createdAt: Date;
};
/**
* Sends a security alert notification to an administrator email address.
*/
export declare function sendSecurityAlertEmail(to: string, alert: SecurityAlertPayload): Promise<void>;
type SecurityEmailContext = {
ipAddress?: string;
userAgent?: string;
countryCode?: string | null;
};
/** Notifies the user of a sign-in from a new IP or device. */
export declare function sendNewLoginEmail(to: string, ctx: SecurityEmailContext): Promise<void>;
/** Notifies the user of a sign-in from a new country. */
export declare function sendNewCountryLoginEmail(to: string, ctx: SecurityEmailContext): Promise<void>;
/** Notifies the user that their password was changed. */
export declare function sendPasswordChangedEmail(to: string, ctx: SecurityEmailContext): Promise<void>;
/** Notifies the user that two-factor authentication was enabled. */
export declare function sendTotpEnabledEmail(to: string, ctx: SecurityEmailContext): Promise<void>;
/** Notifies the user that two-factor authentication was disabled. */
export declare function sendTotpDisabledEmail(to: string, ctx: SecurityEmailContext): Promise<void>;
/** Notifies the user that their platform roles were updated. */
export declare function sendRolesChangedEmail(to: string, roles: string[], ctx: SecurityEmailContext): Promise<void>;
/** Notifies the user that their effective permissions were updated. */
export declare function sendPermissionsChangedEmail(to: string, permissions: string[], ctx: SecurityEmailContext): Promise<void>;
export {};
//# sourceMappingURL=emailService.d.ts.map