diff --git a/server/src/utils/auth.ts b/server/src/utils/auth.ts index d428d414..b1f6850f 100644 --- a/server/src/utils/auth.ts +++ b/server/src/utils/auth.ts @@ -23,7 +23,7 @@ export const comparePassword = (password: string, hash: string): Promise { +export const encrypt = (text: string): string => { const ivLength = parseInt(getEnvVariable('IV_LENGTH'), 10); const iv = crypto.randomBytes(ivLength); const algorithm = getEnvVariable('ALGORITHM'); @@ -34,7 +34,7 @@ const encrypt = (text: string): string => { return `${iv.toString('hex')}:${encrypted}`; }; -const decrypt = (encryptedText: string): string => { +export const decrypt = (encryptedText: string): string => { const [iv, encrypted] = encryptedText.split(':'); const algorithm = getEnvVariable('ALGORITHM'); const key = Buffer.from(getEnvVariable('ENCRYPTION_KEY'), 'hex');