UNPKG

@amirmarmul/waba-common

Version:

![GitHub release](https://img.shields.io/github/v/release/amirmarmul/waba-common?style=flat-square)

24 lines (23 loc) 841 B
export declare enum CryptoAlgorithm { AES256CTR = "aes-256-ctr", AES256GCM = "aes-256-gcm" } export declare class Crypto { static secretKey: string; /** * Make a encrypted text using key process.env.SECRET_KEY with the spesific algorithm. * Please see CryptoAlgorithm enum for supported algorithm * @param plain string * @param algorithm CryptoAlgorithm * @returns string */ static encrypt: (plain: string, algorithm?: string) => string; /** * Decrypt the chipper message using key process.env.SECRET_KEY with the spesific algorithm. * Please see CryptoAlgorithm enum for supported algorithm * @param cryptedMessage string * @param algorithm CryptoAlgorithm * @returns string */ static decrypt: (cryptedMessage: string, algorithm?: string) => string; }