import { encrypt, encodeSign } from './encrypt' import { decrypt, verifyMessage, decodeSignMessage, type VerifyMessage, type DecodeSignMessage, } from './decrypt' import { CompressionService, type CompressOpts, type InflateOptions, } from './CompressionService' import { PrivateKey } from './PrivateKey' import { PublicKey } from './PublicKey' export interface CompressionOptions { /** * The directory where cache files are stored. */ cacheDir: string /** * Lists all cache files in the cache directory. * * @returns {string[]} An array of cache file names. */ listCacheFiles: () => string[] /** * Removes a specific cache file from the cache directory. * * @param {string} filename - The name of the cache file to remove. */ removeCacheFile: (filename: string) => void /** * Clears all cache files in the cache directory. */ clearCache: () => void } /** * @class Service * A class that handles encryption, decryption, and message signing/verification and compress/decompress. */ export declare class Service { private readonly privateKeyA private readonly publicKeyA private compression /** * Initializes a new instance of the Service class. * * @constructor * @param {string | Uint8Array} privateKeyA - The private key used for signing and decrypting messages. * @param {string | Uint8Array} publicKeyA - The public key used for encrypting messages. * @param {boolean} [useTemp] - Whether to use a temporary file for caching the root project. */ constructor(privateKeyA: Hex, publicKeyA: Hex, useTemp?: boolean) /** * Encrypts a message using the provided public key, and signs the encrypted data using the private key * if signature signing is enabled. * * @param {Uint8Array} message - The plaintext message to be encrypted. * @returns {Buffer} - A Buffer containing the signed and encrypted message, or just the encrypted message * if signing is disabled. */ encrypt(message: Uint8Array): Buffer /** * Decrypts a signed and encrypted message, and verifies its signature if signing is enabled. * * @param {Uint8Array} messageEncrypt - The signed and encrypted message to be decrypted. * @returns {Buffer} - The decrypted plaintext message if the signature is valid or if signing is disabled. * @throws {Error} - Throws an error if the signature is invalid and `throwOnInvalid` is set to true. */ decrypt(messageEncrypt: Uint8Array): Buffer /** * Compresses a Uint8Array using the provided options. * @param {Uint8Array} message - The Uint8Array to be compressed. * @param {CompressOpts} opts - The options for compressing the Uint8Array, including coverage. * @returns {Uint8Array} - The compressed message. */ encryptAndCompress(message: Uint8Array, opts: CompressOpts): Uint8Array /** * Decompresses and decrypts a Uint8Array using the provided options. * * @param {Uint8Array} messageEncrypt - The encrypted message to be decompressed and decrypted. * @param {InflateOptions} opts - The decompression options to apply. * @returns {Uint8Array} - The decrypted and decompressed message. */ decryptAndDecompress( messageEncrypt: Uint8Array, opts: InflateOptions ): Uint8Array /** * Provides additional methods for managing compression cache and related settings. * * @returns {CompressionOptions} An object containing utility methods for cache management * and access to the cache directory. */ compressionOpts(): CompressionOptions /** * Compares this key with another PrivateKey or PublicKey instance. * Converts the current key to a Uint8Array if it is in hex format. * If the current publicKeyA is compressed, it compares it with the compressed version of the other PublicKey. * Otherwise, it compares with the uncompressed version. * * @method equals * @param {PrivateKey | PublicKey} other - The PrivateKey or PublicKey instance to compare with. * @returns {boolean} - Returns true if the two instances are equal, false otherwise. * @throws {TypeError} - Throws an error if `other` is neither a PrivateKey nor a PublicKey instance. */ equals(other: PrivateKey | PublicKey): boolean } export { encrypt, encodeSign, decrypt, decodeSignMessage, verifyMessage, CompressionService, } export { compressData, decompressData } from '../utils/compression' export type { VerifyMessage, DecodeSignMessage, CompressOpts, InflateOptions } //# sourceMappingURL=Service.d.ts.map