UNPKG

@fbl-plugins/crypto

Version:
44 lines (43 loc) 1.25 kB
/// <reference types="node" /> export declare class CryptoService { private static encryptionAlgorithm; private static hashAlgorithm; private static hashIterations; private static keySize; private static ivSize; private static saltSize; private static version; private constructor(); private static pInstance; static get instance(): CryptoService; static reset(): void; /** * Create pbkdf2 hash with 100k iterations with provided password and optionally salt * If salt is not provided - it will be generated and returned back * @param password * @param salt */ getPasswordHash(password: string, salt?: Buffer): Promise<{ hash: Buffer; salt: Buffer; }>; /** * Encrypt file with provided password * @param source * @param destination * @param password */ encrypt(source: string, destination: string, password: string): Promise<void>; /** * Decrypt file * @param source * @param destination * @param password */ decrypt(source: string, destination: string, password: string): Promise<void>; /** * Read stream into buffer * @param stream */ private streamToBuffer; }