import type { PlatformID } from '@digitaldefiance/ecies-lib'; import { SpamClassification } from '../../enumerations/messaging/spamClassification'; import { IMailbox } from './emailAddress'; import { IMessageMetadata } from './messageMetadata'; import { ContentTransferEncoding, type IContentType, type IMimePart } from './mimePart'; export type { IMailbox } from './emailAddress'; export { ContentTransferEncoding, createContentType } from './mimePart'; export type { IContentDisposition, IContentType, IMimePart } from './mimePart'; export type { IAttachmentMetadata } from './attachmentMetadata'; import type { IAttachmentMetadata } from './attachmentMetadata'; export { EmailDeliveryStatus } from './emailDelivery'; export type { IDeliveryReceipt } from './emailDelivery'; export { DeliveryStatus } from '../../enumerations/messaging/deliveryStatus'; import type { IDeliveryReceipt } from './emailDelivery'; /** * Resent header block for forwarded emails per RFC 5322 Section 3.6.6. * * @remarks * When an email is forwarded, a new block of Resent-* headers is prepended. * Multiple forwards result in multiple blocks, most recent first. */ export interface IResentHeaderBlock { /** Resent-From: the forwarder's mailbox */ resentFrom: IMailbox; /** Resent-To: forwarding recipients */ resentTo: IMailbox[]; /** Resent-Cc: optional carbon copy recipients for the forward */ resentCc?: IMailbox[]; /** Resent-Bcc: optional blind carbon copy recipients for the forward */ resentBcc?: IMailbox[]; /** Resent-Date: date of the forward */ resentDate: Date; /** Resent-Message-ID: unique identifier for this forward action */ resentMessageId: string; /** Resent-Sender: optional actual sender if different from Resent-From */ resentSender?: IMailbox; } /** * Email-specific metadata extending the base message metadata. * Provides RFC 5322 compliant email header fields and MIME support. * * @remarks * This interface extends {@link IMessageMetadata} with all fields necessary * to represent a complete RFC 5322 Internet Message Format email, including: * - Originator fields (From, Sender, Reply-To) per Section 3.6.2 * - Destination fields (To, Cc, Bcc) per Section 3.6.3 * - Identification fields (Message-ID, In-Reply-To, References) per Section 3.6.4 * - Informational fields (Subject, Comments, Keywords) per Section 3.6.5 * - Date field per Section 3.6.1 * - MIME headers per RFC 2045 * - Resent headers for forwarding per Section 3.6.6 * - Delivery tracking extensions for BrightChain cross-node delivery * * @template TID - Platform ID type for frontend/backend DTO compatibility. * Defaults to `string` for backward compatibility. * * @see Requirements 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 */ export interface IEmailMetadata extends IMessageMetadata { /** * Required: sender mailbox. * Per RFC 5322, the "From:" field specifies the author(s) of the message. * * @see Requirement 1.1 */ from: IMailbox; /** * Optional: actual sender if different from From. * Per RFC 5322, the "Sender:" field is used when the actual sender * differs from the author specified in "From:". * * @see Requirement 1.1 */ sender?: IMailbox; /** * Optional: reply addresses. * Per RFC 5322, the "Reply-To:" field indicates the address(es) * to which the author suggests replies be sent. * * @see Requirement 1.1 */ replyTo?: IMailbox[]; /** * Primary recipients. * Per RFC 5322, the "To:" field contains the address(es) of the * primary recipient(s) of the message. * * @see Requirement 1.2 */ to: IMailbox[]; /** * Carbon copy recipients. * Per RFC 5322, the "Cc:" field contains the addresses of others * who are to receive the message, though the content is not directed at them. * * @see Requirement 1.2 */ cc?: IMailbox[]; /** * Blind carbon copy recipients. * Per RFC 5322, the "Bcc:" field contains addresses of recipients * who should receive the message but whose addresses should not be * revealed to other recipients. Stored separately for privacy. * * @see Requirement 1.2 */ bcc?: IMailbox[]; /** * Unique message identifier in the format ``. * Per RFC 5322, the "Message-ID:" field provides a unique identifier * for the message. Auto-generated if not provided. * * @see Requirement 1.3 */ messageId: string; /** * Parent message ID for threading. * Per RFC 5322, the "In-Reply-To:" field identifies the message(s) * to which this message is a reply. * * @see Requirement 1.3 */ inReplyTo?: string; /** * Thread reference chain. * Per RFC 5322, the "References:" field identifies other correspondence * that this message references, used for threading. * * @see Requirement 1.3 */ references?: string[]; /** * Email subject line (UTF-8 encoded). * Per RFC 5322, the "Subject:" field is a short string identifying * the topic of the message. * * @see Requirement 1.4 */ subject?: string; /** * Optional comments. * Per RFC 5322, the "Comments:" field provides additional comments * on the text of the body. May appear multiple times. * * @see Requirement 1.4 */ comments?: string[]; /** * Optional keywords. * Per RFC 5322, the "Keywords:" field contains a comma-separated * list of important words and phrases. May appear multiple times. * * @see Requirement 1.4 */ keywords?: string[]; /** * Origination date. * Per RFC 5322, the "Date:" field specifies the date and time at which * the creator of the message indicated that the message was complete * and ready to enter the mail delivery system. Auto-generated if not provided. * * @see Requirement 1.5 */ date: Date; /** * MIME version, always "1.0". * Per RFC 2045, the "MIME-Version:" header field indicates that the * message is MIME compliant. * * @see Requirement 1.8 */ mimeVersion: string; /** * Content-Type header with type/subtype and optional parameters. * Per RFC 2045, the "Content-Type:" header field describes the data * contained in the body. * * @see Requirement 5.1 */ contentType: IContentType; /** * Content-Transfer-Encoding for the top-level message. * Per RFC 2045, specifies the encoding used for the message body. */ contentTransferEncoding?: ContentTransferEncoding; /** * Custom and extension headers (X-* and other non-standard headers). * Per RFC 5322, user-defined header fields may be added to messages. * Keys are header field names, values are arrays to support multiple * occurrences of the same header. * * @see Requirement 1.6 */ customHeaders: Map; /** * MIME parts for multipart messages. * Contains the individual parts of a multipart message, each with * its own Content-Type, encoding, and body. * * @see Requirement 6.1 */ parts?: IMimePart[]; /** * Plain-text body of the email, decoded from MIME parts. * Stored alongside parts for efficient display without re-parsing. * * @see Requirement 6.2 */ textBody?: string; /** * HTML body of the email, decoded from MIME parts. * Stored alongside parts for efficient display without re-parsing. * * @see Requirement 6.3 */ htmlBody?: string; /** * Attachment references with CBL storage metadata. * Each attachment is stored as separate blocks with filename, * MIME type, and integrity information. * * @see Requirement 8.1 */ attachments?: IAttachmentMetadata[]; /** * Digital Burnbag vault container ID for email attachments. * When set, a private vault was created for this email and all * attachments were uploaded into it. UI can construct download links * using this ID together with each attachment's `vaultFileId`. */ vaultContainerId?: string; /** * Delivery receipts per recipient. * Maps recipient identifier to their delivery receipt, * tracking the full delivery lifecycle. * * @see Requirement 12.1 */ deliveryReceipts: Map>; /** * Read receipts per recipient. * Maps recipient identifier to the timestamp when they read the message. * * @see Requirement 12.3 */ readReceipts: Map; /** * Resent header blocks for forwarded emails. * Each forward operation prepends a new block of Resent-* headers. * Most recent forward is first in the array. * * @see Requirement 17.1 */ resentHeaders?: IResentHeaderBlock[]; /** * Per-recipient encrypted symmetric keys. * Maps recipient address to their ECIES-encrypted copy of the symmetric key * used to encrypt the email content. Only present when encryptionScheme * is RECIPIENT_KEYS. * * @see Requirement 16.4 - Separate encrypted copies for each recipient * @see Requirement 16.7 - Store encryption metadata in Email_Metadata */ encryptedKeys?: Map; /** * Initialization vector used for AES-256-GCM content encryption. * Present when the email content is encrypted (RECIPIENT_KEYS or SHARED_KEY). */ encryptionIv?: Uint8Array; /** * Authentication tag from AES-256-GCM content encryption. * Present when the email content is encrypted. */ encryptionAuthTag?: Uint8Array; /** * Encrypted body bytes (AES-256-GCM ciphertext). * Stored when encryptionScheme is RECIPIENT_KEYS, SHARED_KEY, S_MIME, or GPG. * When present, textBody and htmlBody are cleared for security. * * @see Requirement 16.1 - Encrypt email content before storage */ encryptedBody?: Uint8Array; /** * Whether the email content has been digitally signed. * * @see Requirement 16.5 - S/MIME signatures for sender authentication */ isSigned?: boolean; /** * Digital signature bytes for the email content. * Present when isSigned is true. * * @see Requirement 16.5 */ contentSignature?: Uint8Array; /** * Public key of the signer, stored for signature verification. * * @see Requirement 16.8 - Verify sender's signature on decryption */ signerPublicKey?: Uint8Array; /** * Mail folder this email belongs to. * Standard values: 'inbox', 'sent', 'drafts', 'trash', 'spam'. * Defaults to 'inbox' when absent. * * @see Requirement 7.2 */ folder?: string; /** * Spam score assigned by the anti-spam engine (e.g. SpamAssassin). * Typically 0–20+; higher values indicate more likely spam. * * @see Requirement 7.2 */ spamScore?: number; /** * Spam classification derived from score vs. configured thresholds. * * @see Requirement 7.2 */ spamClassification?: SpamClassification; /** * Whether this email has been starred/flagged by the user. */ isStarred?: boolean; } //# sourceMappingURL=emailMetadata.d.ts.map