@izzius94/crypter
Version:
The crypter library makes easy to share encrypted data with a Laravel project.
32 lines (31 loc) • 874 B
TypeScript
/// <reference types="node" />
import { algorithm } from './key';
export default class {
protected readonly key: Buffer;
protected readonly algorithm: algorithm;
/**
* Initialize the class
*
* @param key The key used to encrypt/decrypt the strings
* @param algorithm The algorithm used to encrypt/decrypt the strings
*/
constructor(key: Buffer, algorithm?: algorithm);
/**
* Method to decrypt an encrypted string
*
* @param encrypted The string to decrypt
* @returns The string decrypted
*/
decrypt(encrypted: string): string;
/**
* Method to enctypt a string
*
* @param value The value to encrypt
* @returns The string encrypted
*/
encrypt(value: string): string;
/**
* Method to check if the provided key is valid
*/
protected checkKey(): void;
}