fix(mail/delivery): Centralize runtime/plugin imports and switch modules to use plugins exports; unify EventEmitter usage; update Deno dependencies and small path/server refactors
This commit is contained in:
		| @@ -3,17 +3,16 @@ | ||||
|  * Provides utilities for managing TLS certificates | ||||
|  */ | ||||
|  | ||||
| import * as fs from 'fs'; | ||||
| import * as tls from 'tls'; | ||||
| import * as plugins from '../../../plugins.ts'; | ||||
| import { SmtpLogger } from './utils/logging.ts'; | ||||
|  | ||||
| /** | ||||
|  * Certificate data | ||||
|  */ | ||||
| export interface ICertificateData { | ||||
|   key: Buffer; | ||||
|   cert: Buffer; | ||||
|   ca?: Buffer; | ||||
|   key: plugins.Buffer; | ||||
|   cert: plugins.Buffer; | ||||
|   ca?: plugins.Buffer; | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -155,7 +154,7 @@ export function loadCertificatesFromString(options: { | ||||
|       const caBuffer = caStr ? Buffer.from(caStr, 'utf8') : undefined; | ||||
|        | ||||
|       // Test the certificates first | ||||
|       const secureContext = tls.createSecureContext({ | ||||
|       const secureContext = plugins.tls.createSecureContext({ | ||||
|         key: keyBuffer, | ||||
|         cert: certBuffer, | ||||
|         ca: caBuffer | ||||
| @@ -206,7 +205,7 @@ export function loadCertificatesFromString(options: { | ||||
|        | ||||
|       // Validate the certificates by attempting to create a secure context | ||||
|       try { | ||||
|         const secureContext = tls.createSecureContext({ | ||||
|         const secureContext = plugins.tls.createSecureContext({ | ||||
|           key: keyBuffer, | ||||
|           cert: certBuffer, | ||||
|           ca: caBuffer | ||||
| @@ -253,9 +252,9 @@ export function loadCertificatesFromFiles(options: { | ||||
| }): ICertificateData { | ||||
|   try { | ||||
|     // Read files directly as Buffers | ||||
|     const key = fs.readFileSync(options.keyPath); | ||||
|     const cert = fs.readFileSync(options.certPath); | ||||
|     const ca = options.caPath ? fs.readFileSync(options.caPath) : undefined; | ||||
|     const key = plugins.fs.readFileSync(options.keyPath); | ||||
|     const cert = plugins.fs.readFileSync(options.certPath); | ||||
|     const ca = options.caPath ? plugins.fs.readFileSync(options.caPath) : undefined; | ||||
|      | ||||
|     // Log for debugging | ||||
|     SmtpLogger.debug('Certificate file properties', { | ||||
| @@ -266,7 +265,7 @@ export function loadCertificatesFromFiles(options: { | ||||
|      | ||||
|     // Validate the certificates by attempting to create a secure context | ||||
|     try { | ||||
|       const secureContext = tls.createSecureContext({ | ||||
|       const secureContext = plugins.tls.createSecureContext({ | ||||
|         key, | ||||
|         cert, | ||||
|         ca | ||||
| @@ -364,8 +363,8 @@ ORWZbz+8rBL0JIeA7eFxEA== | ||||
| export function createTlsOptions( | ||||
|   certificates: ICertificateData, | ||||
|   isServer: boolean = true | ||||
| ): tls.TlsOptions { | ||||
|   const options: tls.TlsOptions = { | ||||
| ): plugins.tls.TlsOptions { | ||||
|   const options: plugins.tls.TlsOptions = { | ||||
|     key: certificates.key, | ||||
|     cert: certificates.cert, | ||||
|     ca: certificates.ca, | ||||
|   | ||||
| @@ -4,8 +4,6 @@ | ||||
|  */ | ||||
|  | ||||
| import * as plugins from '../../../plugins.ts'; | ||||
| import * as fs from 'fs'; | ||||
| import * as path from 'path'; | ||||
| import { SmtpState } from './interfaces.ts'; | ||||
| import type { ISmtpSession, ISmtpTransactionResult } from './interfaces.ts'; | ||||
| import type { IDataHandler, ISmtpServer } from './interfaces.ts'; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user