chore: v0.0.1

This commit is contained in:
karishmas6
2024-10-30 12:04:38 +05:30
parent 8a21a7ac10
commit 76767f602d
7 changed files with 19 additions and 9 deletions

View File

@@ -24,9 +24,9 @@ export const comparePassword = (password: string, hash: string): Promise<boolean
}
export const encrypt = (text: string): string => {
const ivLength = parseInt(getEnvVariable('IV_LENGTH'), 10);
const ivLength = 16;
const iv = crypto.randomBytes(ivLength);
const algorithm = getEnvVariable('ALGORITHM');
const algorithm = 'aes-256-cbc';
const key = Buffer.from(getEnvVariable('ENCRYPTION_KEY'), 'hex');
const cipher = crypto.createCipheriv(algorithm, key, iv);
let encrypted = cipher.update(text, 'utf8', 'hex');