67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
|
|
/**
|
||
|
|
* SMTP TLS Handler
|
||
|
|
* Responsible for handling TLS-related SMTP functionality
|
||
|
|
*/
|
||
|
|
import * as plugins from '../../../plugins.js';
|
||
|
|
import type { ITlsHandler, ISmtpServer, ISmtpSession } from './interfaces.js';
|
||
|
|
/**
|
||
|
|
* Handles TLS functionality for SMTP server
|
||
|
|
*/
|
||
|
|
export declare class TlsHandler implements ITlsHandler {
|
||
|
|
/**
|
||
|
|
* Reference to the SMTP server instance
|
||
|
|
*/
|
||
|
|
private smtpServer;
|
||
|
|
/**
|
||
|
|
* Certificate data
|
||
|
|
*/
|
||
|
|
private certificates;
|
||
|
|
/**
|
||
|
|
* TLS options
|
||
|
|
*/
|
||
|
|
private options;
|
||
|
|
/**
|
||
|
|
* Creates a new TLS handler
|
||
|
|
* @param smtpServer - SMTP server instance
|
||
|
|
*/
|
||
|
|
constructor(smtpServer: ISmtpServer);
|
||
|
|
/**
|
||
|
|
* Handle STARTTLS command
|
||
|
|
* @param socket - Client socket
|
||
|
|
*/
|
||
|
|
handleStartTls(socket: plugins.net.Socket, session: ISmtpSession): Promise<plugins.tls.TLSSocket | null>;
|
||
|
|
/**
|
||
|
|
* Upgrade a connection to TLS
|
||
|
|
* @param socket - Client socket
|
||
|
|
*/
|
||
|
|
startTLS(socket: plugins.net.Socket): Promise<plugins.tls.TLSSocket>;
|
||
|
|
/**
|
||
|
|
* Create a secure server
|
||
|
|
* @returns TLS server instance or undefined if TLS is not enabled
|
||
|
|
*/
|
||
|
|
createSecureServer(): plugins.tls.Server | undefined;
|
||
|
|
/**
|
||
|
|
* Check if TLS is enabled
|
||
|
|
* @returns Whether TLS is enabled
|
||
|
|
*/
|
||
|
|
isTlsEnabled(): boolean;
|
||
|
|
/**
|
||
|
|
* Send a response to the client
|
||
|
|
* @param socket - Client socket
|
||
|
|
* @param response - Response message
|
||
|
|
*/
|
||
|
|
private sendResponse;
|
||
|
|
/**
|
||
|
|
* Check if TLS is available (interface requirement)
|
||
|
|
*/
|
||
|
|
isTlsAvailable(): boolean;
|
||
|
|
/**
|
||
|
|
* Get TLS options (interface requirement)
|
||
|
|
*/
|
||
|
|
getTlsOptions(): plugins.tls.TlsOptions;
|
||
|
|
/**
|
||
|
|
* Clean up resources
|
||
|
|
*/
|
||
|
|
destroy(): void;
|
||
|
|
}
|