34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
|
|
/**
|
||
|
|
* SMTP Client TLS Handler
|
||
|
|
* TLS and STARTTLS client functionality
|
||
|
|
*/
|
||
|
|
import * as tls from 'node:tls';
|
||
|
|
import type { ISmtpConnection, ISmtpClientOptions } from './interfaces.js';
|
||
|
|
import type { CommandHandler } from './command-handler.js';
|
||
|
|
export declare class TlsHandler {
|
||
|
|
private options;
|
||
|
|
private commandHandler;
|
||
|
|
constructor(options: ISmtpClientOptions, commandHandler: CommandHandler);
|
||
|
|
/**
|
||
|
|
* Upgrade connection to TLS using STARTTLS
|
||
|
|
*/
|
||
|
|
upgradeToTLS(connection: ISmtpConnection): Promise<void>;
|
||
|
|
/**
|
||
|
|
* Create a direct TLS connection
|
||
|
|
*/
|
||
|
|
createTLSConnection(host: string, port: number): Promise<tls.TLSSocket>;
|
||
|
|
/**
|
||
|
|
* Validate TLS certificate
|
||
|
|
*/
|
||
|
|
validateCertificate(socket: tls.TLSSocket): boolean;
|
||
|
|
/**
|
||
|
|
* Get TLS connection information
|
||
|
|
*/
|
||
|
|
getTLSInfo(socket: tls.TLSSocket): any;
|
||
|
|
/**
|
||
|
|
* Check if TLS upgrade is required or recommended
|
||
|
|
*/
|
||
|
|
shouldUseTLS(connection: ISmtpConnection): boolean;
|
||
|
|
private performTLSUpgrade;
|
||
|
|
}
|