/** * Email Message Service * * Main service for email operations in the BrightChain messaging system. * Coordinates parsing, validation, storage, and delivery of RFC 5322 * compliant email messages. * * This service depends on: * - MessageCBLService: For storing email content as CBL blocks * - IGossipService: For delivering messages via gossip protocol * - IEmailMetadataStore: For persisting email metadata * - EmailParser, EmailSerializer, EmailValidator: For email processing * * @see RFC 5322 - Internet Message Format * @see RFC 2045/2046 - MIME * * @remarks * Requirements: 1.1-1.10 */ import { MessageEncryptionScheme } from '../../enumerations/messaging/messageEncryptionScheme'; import { SpamClassification } from '../../enumerations/messaging/spamClassification'; import type { IGossipService } from '../../interfaces/availability/gossipService'; import type { IAttachmentMetadata } from '../../interfaces/messaging/attachmentMetadata'; import type { IMailbox } from '../../interfaces/messaging/emailAddress'; import { type IDeliveryReceipt } from '../../interfaces/messaging/emailDelivery'; import type { IEmailMetadata } from '../../interfaces/messaging/emailMetadata'; import { type IContentType, type IMimePart } from '../../interfaces/messaging/mimePart'; import type { MessageCBLService } from './messageCBLService'; /** * Configuration for the EmailMessageService. * * Provides configurable limits and defaults for email processing, * storage, and delivery. * * @see Requirement 8.5 - Configurable maximum attachment size limit * @see Requirement 8.6 - Configurable maximum total message size limit */ export interface IEmailServiceConfig { /** * The canonical email domain for this BrightChain network instance. * Recipients whose domain does not match are considered external and * will be routed to the Email Gateway via a gateway-outbound gossip * announcement. * * @see Requirement 1.1 — detect external recipients * @see Requirement 8.1 — read canonical domain from CoreConstants */ canonicalDomain: string; /** * Maximum size of a single attachment in bytes. * @default 25 * 1024 * 1024 (25MB) * @see Requirement 8.5 */ maxAttachmentSize: number; /** * Maximum total message size in bytes (body + all attachments). * @default 50 * 1024 * 1024 (50MB) * @see Requirement 8.6 */ maxMessageSize: number; /** * Parts smaller than this threshold are stored inline in metadata. * Larger parts are stored as separate CBL blocks. * @default 64 * 1024 (64KB) */ inlinePartThreshold: number; /** * Maximum total size of all inline parts combined. * @default 256 * 1024 (256KB) */ maxInlinePartsTotal: number; /** * Default page size for inbox queries. * @default 50 * @see Requirement 13.6 */ defaultPageSize: number; /** * Maximum number of Message-IDs in the References header. * @default 20 * @see Requirement 10.3 */ maxReferencesCount: number; /** * Maximum number of delivery retry attempts. * @default 3 * @see Requirement 11.5 */ maxRetryAttempts: number; /** * Delivery timeout duration in milliseconds. * @default 24 * 60 * 60 * 1000 (24 hours) * @see Requirement 11.9 */ deliveryTimeoutMs: number; /** * The node ID or domain used for generating Message-IDs. * Used as the id-right portion of Message-ID: * @see Requirement 3.2 */ nodeId: string; /** * When `true`, all recipients (including those whose domain matches * `canonicalDomain`) are treated as external and routed through the * registered `ExternalEmailDispatcher` (e.g. SES / Postfix). * * Use this when the canonical domain is served by a real SMTP provider * (such as AWS SES) rather than by BrightChain gossip delivery, so that * same-domain users actually receive their email. * * @default false */ relayAllRecipientsExternally: boolean; } /** * Default configuration values for EmailMessageService. */ export declare const DEFAULT_EMAIL_SERVICE_CONFIG: IEmailServiceConfig; /** * Input for creating/sending an email message. * * Contains all fields needed to compose an email. Required headers * (From, Date, Message-ID) are auto-generated if not provided. * * @see Requirement 15.1 - Validate at least one recipient * @see Requirement 15.4 - Auto-generate required headers */ export interface IEmailInput { /** Sender mailbox (From header). Required. */ from: IMailbox; /** Optional: actual sender if different from From */ sender?: IMailbox; /** Optional: reply-to addresses */ replyTo?: IMailbox[]; /** Primary recipients (To header) */ to?: IMailbox[]; /** CC recipients */ cc?: IMailbox[]; /** BCC recipients */ bcc?: IMailbox[]; /** Email subject line (UTF-8) */ subject?: string; /** Origination date. Auto-generated if not provided. */ date?: Date; /** Message-ID. Auto-generated if not provided. */ messageId?: string; /** In-Reply-To Message-ID for threading */ inReplyTo?: string; /** References chain for threading */ references?: string[]; /** Content-Type of the message body */ contentType?: IContentType; /** MIME parts for multipart messages */ parts?: IMimePart[]; /** Attachments to include */ attachments?: IAttachmentInput[]; /** Plain text body content */ textBody?: string; /** HTML body content */ htmlBody?: string; /** Custom headers (X-* and other extension headers) */ customHeaders?: Map; /** * Digital Burnbag vault container ID for email attachments. * Pre-populated by InboundProcessor after creating a private vault. * Stored in IEmailMetadata so the UI can construct per-attachment download links. */ vaultContainerId?: string; /** Mail folder for this email (e.g. 'inbox', 'spam'). Defaults to 'inbox'. */ folder?: string; /** Spam score from anti-spam engine (e.g. SpamAssassin). */ spamScore?: number; /** Spam classification derived from score vs. configured thresholds. */ spamClassification?: SpamClassification; /** * Encryption scheme to use for this email. * - NONE: No encryption (default) * - RECIPIENT_KEYS: ECIES per-recipient encryption * - SHARED_KEY: Symmetric encryption with a shared key * * @see Requirement 16.1 */ encryptionScheme?: MessageEncryptionScheme; /** * Per-recipient public keys for ECIES encryption. * Maps recipient address to their ECIES public key. * Required when encryptionScheme is RECIPIENT_KEYS. * * @see Requirement 16.3, 16.4 */ recipientPublicKeys?: Map; /** * Shared symmetric key for SHARED_KEY encryption. * Must be exactly 32 bytes (AES-256). * Required when encryptionScheme is SHARED_KEY. */ sharedKey?: Uint8Array; /** * Sender's private key for signing the email. * When provided along with senderPublicKey, the email will be signed. * * @see Requirement 16.5 */ senderPrivateKey?: Uint8Array; /** * Sender's public key, stored with the signature for verification. * Required when senderPrivateKey is provided. * * @see Requirement 16.5 */ senderPublicKey?: Uint8Array; /** * GPG public keys for recipients (armored). * Maps recipient address to their ASCII-armored GPG public key. * Required when encryptionScheme is GPG. * * @see Requirement 3.3 */ recipientGpgKeys?: Map; /** * S/MIME certificates for recipients (PEM). * Maps recipient address to their PEM-encoded S/MIME certificate. * Required when encryptionScheme is S_MIME. * * @see Requirement 7.3 */ recipientSmimeCerts?: Map; /** * Sender's GPG private key (armored) for signing. * * @see Requirement 4.4 */ senderGpgPrivateKey?: string; /** * Passphrase for the sender's GPG private key. * * @see Requirement 4.4 */ senderGpgPassphrase?: string; /** * Sender's S/MIME certificate (PEM) for signing. * * @see Requirement 8.4 */ senderSmimeCert?: string; /** * Sender's S/MIME private key (PEM) for signing. * * @see Requirement 8.4 */ senderSmimePrivateKey?: string; /** * Whether to sign the message (GPG or S/MIME depending on scheme). * * @see Requirement 4.4, 8.4 */ signMessage?: boolean; } /** * Input for an attachment to be included in an email. */ export interface IAttachmentInput { /** Original filename of the attachment */ filename: string; /** MIME type of the attachment */ mimeType: string; /** Attachment content as binary data */ content: Uint8Array; /** Optional Content-ID for inline attachments */ contentId?: string; /** Whether this is an inline attachment (e.g., embedded image) */ inline?: boolean; /** * Digital Burnbag vault file ID for this attachment. * Pre-populated by InboundProcessor after uploading to a private vault. * Stored in the resulting IAttachmentMetadata for UI download links. */ vaultFileId?: string; } /** * Result of sending an email. * * Contains the generated message ID and initial delivery status * for all recipients. */ export interface ISendEmailResult { /** The generated or provided Message-ID */ messageId: string; /** The internal BrightChain message/block ID */ brightchainMessageId: string; /** Initial delivery status per recipient */ deliveryStatus: Map; /** Whether the send operation was successful */ success: boolean; /** Error message if send failed */ error?: string; } /** * Email content retrieved from storage. * * Contains the full email metadata along with decoded body content * and reconstructed attachments. */ export interface IEmailContent { /** Full email metadata */ metadata: IEmailMetadata; /** Decoded plain text body (if available) */ textBody?: string; /** Decoded HTML body (if available) */ htmlBody?: string; /** Reconstructed MIME parts with decoded content */ parts: IMimePart[]; /** Reconstructed attachments with content */ attachments: IRetrievedAttachment[]; } /** * A retrieved attachment with its binary content. */ export interface IRetrievedAttachment { /** Attachment metadata */ metadata: IAttachmentMetadata; /** Decoded attachment content */ content: Uint8Array; } /** * Query parameters for inbox operations. * * @see Requirement 13.2 - Sort by Date header (newest first by default) * @see Requirement 13.3 - Filter by read/unread, sender, date range, etc. * @see Requirement 13.4 - Full-text search across subject and body * @see Requirement 13.6 - Pagination with configurable page size * @see Requirement 13.7 - Sort by date, sender, subject, size */ export interface IInboxQuery { /** Filter by read/unread status */ readStatus?: 'read' | 'unread' | 'all'; /** Filter by sender address */ senderAddress?: string; /** Filter by date range - start */ dateFrom?: Date; /** Filter by date range - end */ dateTo?: Date; /** Filter by whether email has attachments */ hasAttachments?: boolean; /** Filter by subject containing text */ subjectContains?: string; /** Full-text search across subject and body */ searchText?: string; /** Filter by folder (e.g. 'inbox', 'spam', 'sent'). */ folder?: string; /** Filter by label/keyword tags. */ labels?: string[]; /** Filter by starred status. */ isStarred?: boolean; /** Sort field */ sortBy?: 'date' | 'sender' | 'subject' | 'size'; /** Sort direction */ sortDirection?: 'asc' | 'desc'; /** Page number (1-based) */ page?: number; /** Number of results per page */ pageSize?: number; } /** * Result of an inbox query. * * @see Requirement 13.6 - Pagination support * @see Requirement 13.8 - Track and return unread count */ export interface IInboxResult { /** Email metadata for the current page */ emails: IEmailMetadata[]; /** Total number of matching emails */ totalCount: number; /** Number of unread emails matching the query */ unreadCount: number; /** Current page number (1-based) */ page: number; /** Number of results per page */ pageSize: number; /** Whether there are more pages */ hasMore: boolean; } /** * Input for creating a reply to an email. */ export interface IReplyInput { /** Sender mailbox for the reply */ from: IMailbox; /** Whether to reply to all recipients (Reply-All) */ replyAll?: boolean; /** Additional recipients to add */ additionalTo?: IMailbox[]; /** Additional CC recipients */ additionalCc?: IMailbox[]; /** Reply subject (defaults to "Re: ") */ subject?: string; /** Plain text reply body */ textBody?: string; /** HTML reply body */ htmlBody?: string; /** Attachments to include in the reply */ attachments?: IAttachmentInput[]; } /** * Interface for email metadata persistence. * * Provides CRUD operations for email metadata storage and * query capabilities for inbox operations. * * This is an abstraction over the underlying storage mechanism, * allowing different implementations (in-memory, database, etc.). */ export interface IEmailMetadataStore { /** Store email metadata */ store(metadata: IEmailMetadata): Promise; /** Retrieve email metadata by Message-ID */ get(messageId: string): Promise; /** Delete email metadata by Message-ID */ delete(messageId: string): Promise; /** Update email metadata */ update(messageId: string, updates: Partial): Promise; /** Query emails for a user's inbox */ queryInbox(userId: string, query: IInboxQuery): Promise; /** Get unread count for a user */ getUnreadCount(userId: string): Promise; /** Mark an email as read for a user */ markAsRead(messageId: string, userId: string): Promise; /** Get all emails in a thread by following References chain */ getThread(messageId: string): Promise; /** Get the root message of a thread */ getRootMessage(messageId: string): Promise; /** * Store attachment content by a unique key (e.g. SHA-256 checksum). * Used by EmailMessageService to persist attachment binary data * alongside metadata. * * @param key - Unique identifier for the attachment content (checksum) * @param content - The binary attachment data * @see Requirement 8.1 - Store attachments as ExtendedCBL blocks */ storeAttachmentContent?(key: string, content: Uint8Array): Promise; /** * Retrieve attachment content by key. * * @param key - The unique identifier used when storing * @returns The binary content, or null if not found * @see Requirement 8.7 - Retrieve attachments with original content */ getAttachmentContent?(key: string): Promise; } /** * Main service for email operations in the BrightChain messaging system. * * Coordinates parsing, validation, storage, and delivery of RFC 5322 * compliant email messages. This service acts as the primary entry point * for all email-related operations. * * @see Design Document: EmailMessageService Class * @see Requirements 1.1-1.10 * * @example * ```typescript * const emailService = new EmailMessageService( * messageCBLService, * metadataStore, * gossipService, * config, * ); * * const result = await emailService.sendEmail({ * from: createMailbox('sender', 'example.com'), * to: [createMailbox('recipient', 'example.com')], * subject: 'Hello', * textBody: 'Hello, World!', * }); * ``` */ /** * Callback invoked once per `sendEmail` when external recipients are present. * Implementations are responsible for relaying the message to a real * outbound email transport (e.g. SES, Postfix). Local recipients (matching * `canonicalDomain`) are filtered out by `EmailMessageService` before this * callback fires. * * Recipients are exposed split by header field so the dispatcher can preserve * RFC 5322 envelope semantics (To/CC are visible to all recipients; BCC is * not). When no external recipients exist for a given field, that array is * empty. */ export type ExternalEmailDispatcher = (input: { messageId: string; from: IMailbox; externalTo: IMailbox[]; externalCc: IMailbox[]; externalBcc: IMailbox[]; subject: string; textBody?: string; htmlBody?: string; }) => Promise | void; export declare class EmailMessageService { private readonly messageCBLService; private readonly metadataStore; private readonly gossipService; private readonly config; private externalDispatcher?; constructor(messageCBLService: MessageCBLService, metadataStore: IEmailMetadataStore, gossipService: IGossipService, config?: Partial); /** * Register a dispatcher that delivers messages destined for recipients * outside the canonical domain to a real outbound email transport * (e.g. SES, Postfix). The dispatcher is invoked once per `sendEmail` * when at least one external recipient exists, with local recipients * already filtered out. */ setExternalDispatcher(dispatcher: ExternalEmailDispatcher | undefined): void; /** * Sends an email message. * * Validates the email, auto-generates required headers (Message-ID, Date), * stores the email content as CBL blocks, and initiates delivery to * all recipients. * * @param email - The email input to send * @returns The send result with message ID and delivery status * @throws {EmailError} If validation fails or storage/delivery errors occur * * @see Requirement 15.1 - Validate at least one recipient * @see Requirement 15.4 - Auto-generate required headers */ /** * Sends an email message. * * Validates the email, auto-generates required headers (Message-ID, Date), * stores the email content as CBL blocks, and initiates delivery to * all recipients. * * @param email - The email input to send * @returns The send result with message ID and delivery status * @throws {EmailError} If validation fails or storage/delivery errors occur * * @see Requirement 15.1 - Validate at least one recipient * @see Requirement 15.4 - Auto-generate required headers */ sendEmail(email: IEmailInput): Promise; /** * Store an inbound email received from an external source. * * Identical to `sendEmail` up through metadata construction and storage, * but deliberately skips the external-dispatch step so that inbound * messages are never relayed back out through SES / Postfix. * * Use this from the InboundProcessor instead of `sendEmail()` to avoid * creating a relay loop. * * @param email - Parsed inbound email input * @returns Send result with messageId and brightchainMessageId */ receiveEmail(email: IEmailInput): Promise; /** * Retrieves email metadata by Message-ID. * * @param messageId - The Message-ID to look up * @returns The email metadata, or null if not found */ getEmail(messageId: string): Promise; /** * Retrieves the full email content including decoded body and attachments. * * Reconstructs the complete message from CBL blocks, decoding all * MIME parts and attachments. * * @param messageId - The Message-ID to retrieve content for * @returns The full email content * @throws {EmailError} If the message is not found * * @see Requirement 13.5 - Reconstruct complete message including all MIME parts */ getEmailContent(messageId: string): Promise; /** * Deletes an email message and its associated blocks. * * @param messageId - The Message-ID to delete * @throws {EmailError} If the message is not found */ deleteEmail(messageId: string): Promise; /** * Queries a user's inbox with filtering, sorting, and pagination. * * @param userId - The user ID to query inbox for * @param query - Query parameters for filtering and sorting * @returns Paginated inbox results with unread count * * @see Requirement 13.1 - Inbox query for To, Cc, or Bcc recipients * @see Requirement 13.2 - Sort by Date header (newest first by default) * @see Requirement 13.6 - Pagination with configurable page size */ queryInbox(userId: string, query: IInboxQuery): Promise; /** * Marks an email as read for a specific user. * * @param messageId - The Message-ID to mark as read * @param userId - The user who read the email * * @see Requirement 13.8 - Track unread count */ markAsRead(messageId: string, userId: string): Promise; /** * Gets the unread email count for a user. * * @param userId - The user ID to get unread count for * @returns The number of unread emails * * @see Requirement 13.8 - Return unread count for inbox queries */ getUnreadCount(userId: string): Promise; /** * Retrieves all emails in a thread by following the References chain. * * Messages are ordered chronologically by Date header. * Handles broken threads where intermediate messages are missing. * * @param messageId - Any Message-ID in the thread * @returns Array of email metadata in the thread, ordered chronologically * * @see Requirement 10.4 - Retrieve all emails in a thread * @see Requirement 10.5 - Order messages chronologically * @see Requirement 10.7 - Handle broken threads */ getThread(messageId: string): Promise; /** * Retrieves the root message of a thread. * * Follows the References chain to find the first Message-ID. * * @param messageId - Any Message-ID in the thread * @returns The root email metadata, or null if not found * * @see Requirement 10.6 - Retrieve root message by following References */ getRootMessage(messageId: string): Promise; /** * Creates a reply to an existing email. * * Sets In-Reply-To to the parent's Message-ID and constructs the * References header by appending the parent's Message-ID to the * parent's References list (limited to maxReferencesCount). * * @param originalId - The Message-ID of the email being replied to * @param replyContent - The reply content and options * @returns The send result for the reply * @throws {EmailError} If the original message is not found * * @see Requirement 10.1 - Set In-Reply-To to parent Message-ID * @see Requirement 10.2 - Construct References header * @see Requirement 10.3 - Limit References to 20 Message-IDs */ createReply(originalId: string, replyContent: IReplyInput): Promise; /** * Forwards an email to new recipients. * * Adds Resent-From, Resent-To, Resent-Date, and Resent-Message-ID * headers per RFC 5322 Section 3.6.6. Preserves all original headers. * * @param originalId - The Message-ID of the email being forwarded * @param forwardTo - The recipients to forward to * @returns The send result for the forwarded email * @throws {EmailError} If the original message is not found * * @see Requirement 17.1 - Add Resent-* headers per RFC 5322 * @see Requirement 17.2 - Preserve all original headers */ forwardEmail(originalId: string, forwardTo: IMailbox[]): Promise; /** * Gets the delivery status for all recipients of an email. * * @param messageId - The Message-ID to get delivery status for * @returns Map of recipient ID to delivery receipt * * @see Requirement 12.1 - Track delivery status per recipient */ getDeliveryStatus(messageId: string): Promise>; /** * Verifies the digital signature on a stored email. * * Retrieves the email metadata, reconstructs the signed content, * and verifies the signature using the signer's private key. * * @param messageId - The Message-ID of the email to verify * @param signerPrivateKey - The signer's private key for HMAC verification * @returns Object with verification result and metadata * @throws {EmailError} If the message is not found * * @see Requirement 16.5 - S/MIME signatures for sender authentication * @see Requirement 16.8 - Verify sender's signature on decryption */ verifyEmailSignature(messageId: string, signerPrivateKey: Uint8Array): Promise<{ verified: boolean; isSigned: boolean; }>; /** // ─── External Recipient Routing ────────────────────────────────────── /** * Determine whether a mailbox belongs to an external domain * (i.e. its domain does not match the configured canonical domain). * * @param mailbox - The mailbox to check * @returns `true` when the mailbox domain differs from the canonical domain * * @see Requirement 1.1 — detect external recipients */ private isExternalMailbox; /** * Collect all external recipients (To + CC + BCC) and hand them to the * configured outbound dispatcher. Local recipients (matching * `canonicalDomain`) are filtered out. Errors from the dispatcher are * caught and logged so they cannot fail the BrightMail send pipeline. */ private dispatchExternalRecipients; /** * Partition an array of mailboxes into internal (canonical domain) and * external (non-canonical domain) groups. * * @param mailboxes - The mailboxes to partition * @returns Object with `internal` and `external` arrays * * @see Requirement 1.1 — detect external recipients * @see Requirement 1.4 — mixed internal/external recipient handling */ partitionRecipients(mailboxes: IMailbox[]): { internal: IMailbox[]; external: IMailbox[]; }; /** * Creates a copy of the email metadata with BCC information stripped. * This copy is delivered to To and CC recipients. * * The copy has: * - No `bcc` field (undefined) * - No BCC recipients in the `recipients` array * - No BCC delivery tracking in `deliveryReceipts` * - A unique block ID for separate storage * * @param original - The original email metadata (sender's copy with full BCC info) * @returns A new IEmailMetadata with BCC info removed * * @see Requirement 9.2 - BCC recipients excluded from all recipient copies * @see Requirement 9.3 - Separate encrypted copies for BCC recipients */ createBccStrippedCopy(original: IEmailMetadata): IEmailMetadata; /** * Creates a private copy of the email for a single BCC recipient. * * The copy has: * - No `bcc` field (no BCC header visible) * - Only the specific BCC recipient in delivery tracking * - A unique block ID for separate encrypted storage * - Encryption scheme set to ECIES for per-recipient encryption * * This ensures that: * - The BCC recipient cannot see other BCC recipients * - To/CC recipients cannot see BCC recipients * - Each BCC copy can be encrypted with the individual recipient's key * * @param original - The original email metadata * @param bccRecipient - The specific BCC recipient this copy is for * @returns A new IEmailMetadata for the BCC recipient * * @see Requirement 9.2 - BCC recipients excluded from all recipient copies * @see Requirement 9.3 - Separate encrypted copies for BCC recipients * @see Requirement 16.2 - BCC addresses cryptographically separated */ createBccRecipientCopy(original: IEmailMetadata, bccRecipient: IMailbox): IEmailMetadata; /** * Ensures CC recipients are included in the Cc header for all recipient copies. * * This is already handled by the metadata construction in sendEmail() which * preserves the `cc` field in all copies (both To/CC and BCC copies). * The CC header is visible to all recipients per RFC 5322. * * @see Requirement 9.1 - CC recipients visible to all recipients */ /** * Checks if the email has only BCC recipients (undisclosed recipients). * * When an email has only BCC recipients and no To or CC recipients, * the To field is empty, which is valid per RFC 5322 for undisclosed * recipients scenarios. * * @param email - The email input to check * @returns true if the email has only BCC recipients * * @see Requirement 9.6 - Support empty To field when only Bcc recipients specified */ isUndisclosedRecipients(email: IEmailInput): boolean; /** * Stores an attachment and produces its metadata. * * Calculates SHA-256 and MD5 checksums for integrity verification, * generates a CBL magnet URL, and persists the attachment content * via the metadata store's attachment content storage. * * @param input - The attachment input containing filename, mimeType, content, and optional contentId * @returns The attachment metadata with checksums and storage references * * @see Requirement 8.1 - Store attachments as ExtendedCBL blocks * @see Requirement 8.2 - Support multiple attachments per email * @see Requirement 8.3 - Preserve filename, MIME type, and file size * @see Requirement 8.9 - Support inline attachments with Content-ID * @see Requirement 8.10 - Calculate and store MD5 Content-MD5 header per RFC 1864 */ private storeAttachment; /** * Generates a globally unique Message-ID in RFC 5322 format. * * The generated Message-ID has the format: `` where: * - **id-left**: A combination of timestamp (milliseconds since epoch) and * a cryptographically random hex string, separated by a dot. * - **id-right**: The configured `nodeId` from the service configuration, * representing the sender's node ID or domain. * * This ensures global uniqueness by incorporating: * 1. A high-resolution timestamp component * 2. A cryptographically secure random component (16 bytes / 32 hex chars) * 3. The node identifier * * @returns A unique Message-ID string in the format `` * * @see Requirement 3.1 - Message-ID format per RFC 5322 Section 3.6.4 * @see Requirement 3.2 - Use sender's node ID as id-right portion * @see Requirement 3.3 - Ensure global uniqueness with timestamp, random, and node ID */ generateMessageId(): string; /** * Wraps message content and a detached signature into a multipart/signed * MIME structure per RFC 3156 (GPG) or RFC 5751 (S/MIME). * * The resulting IMimePart has: * - Content-Type: multipart/signed with protocol, micalg, and boundary params * - Two child parts: the original body part and the signature part * * @param bodyPart - The original message body MIME part * @param signature - The detached signature (ASCII-armored string for GPG, Uint8Array for S/MIME) * @param scheme - GPG or S_MIME to determine protocol and micalg values * @returns An IMimePart representing the multipart/signed structure * * @see RFC 3156 - MIME Security with OpenPGP (GPG) * @see RFC 5751 - S/MIME 3.2 Message Specification * @see Requirements 4.4, 8.4 */ private assembleMultipartSigned; /** * Returns the current service configuration. * * Useful for checking configured limits and defaults. */ getConfig(): Readonly; } //# sourceMappingURL=emailMessageService.d.ts.map