import { ChecksumString } from '@digitaldefiance/ecies-lib'; import { Checksum } from '../types/checksum'; /** * Service for calculating and managing checksums. * * This service provides methods for calculating SHA3-512 checksums for various * data types including buffers, strings, files, and streams. * * All methods now return the Checksum class for type safety and consistency. * * @see Requirements 1.1, 1.2 */ export declare class ChecksumService { constructor(); /** * Get the length of a checksum buffer in bytes * * @returns The length of SHA3-512 checksums in bytes (64 bytes / 512 bits) * * @remarks * This value is constant for SHA3-512 and is used for validation * throughout the system. */ get checksumBufferLength(): number; /** * Calculate a checksum for a buffer and return as Checksum class. * * @param data - The data to calculate the checksum for * @returns The checksum as a Checksum instance * * @example * ```typescript * const checksum = checksumService.calculateChecksum(data); * console.log(checksum.toHex()); * ``` * * @see Requirements 1.1, 1.2 */ calculateChecksum(data: Uint8Array): Checksum; /** * Calculate a checksum for multiple buffers and return as Checksum class. * * @param buffers - Array of buffers to calculate the checksum for * @returns The checksum as a Checksum instance * * @remarks * This method concatenates all buffers before calculating the checksum, * which is more efficient than calculating individual checksums. * * @example * ```typescript * const buffers = [buffer1, buffer2, buffer3]; * const checksum = checksumService.calculateChecksumForBuffers(buffers); * console.log(checksum.toHex()); * ``` * * @see Requirements 1.1, 1.2 */ calculateChecksumForBuffers(buffers: Uint8Array[]): Checksum; /** * Calculate a checksum for a string and return as Checksum class. * * @param str - The string to calculate the checksum for * @returns The checksum as a Checksum instance * * @remarks * The string is encoded as UTF-8 before calculating the checksum. * * @example * ```typescript * const checksum = checksumService.calculateChecksumForString('Hello, World!'); * console.log(checksum.toHex()); * ``` * * @see Requirements 1.1, 1.2 */ calculateChecksumForString(str: string): Checksum; /** * Calculate a checksum for a file and return as Checksum class. * * @param file - The File object to calculate the checksum for * @returns Promise resolving to the checksum as a Checksum instance * * @remarks * The entire file is loaded into memory before calculating the checksum. * For large files, consider using streaming methods. * * @example * ```typescript * const file = new File(['content'], 'test.txt'); * const checksum = await checksumService.calculateChecksumForFile(file); * console.log(checksum.toHex()); * ``` * * @see Requirements 1.1, 1.2 */ calculateChecksumForFile(file: File): Promise; /** * Calculate a checksum for a stream and return as Checksum class. * * @param stream - The readable stream * @returns The checksum as a Checksum instance * * @see Requirements 1.1, 1.2 */ calculateChecksumForStream(stream: ReadableStream): Promise; /** * Compare two checksums for equality * @param checksum1 - The first checksum * @param checksum2 - The second checksum * @returns True if the checksums are equal, false otherwise */ compareChecksums(checksum1: Checksum, checksum2: Checksum): boolean; /** * Convert a checksum to a hex string * @param checksum - The checksum to convert * @returns The checksum as a hex string */ checksumToHexString(checksum: Checksum): ChecksumString; /** * Convert a hex string to a checksum * @param hexString - The hex string to convert * @returns The checksum as a Checksum instance */ hexStringToChecksum(hexString: string): Checksum; /** * Validate a checksum buffer * @param checksum - The checksum to validate * @returns True if the checksum is valid, false otherwise */ validateChecksum(checksum: Checksum): boolean; } //# sourceMappingURL=checksum.service.d.ts.map