From 702a07f5fd94c0b15a674d2023f455aa885ed9d5 Mon Sep 17 00:00:00 2001 From: queicherius Date: Thu, 5 Dec 2024 20:44:50 +0000 Subject: [PATCH] Fix lint errors --- src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3eee770..ff56e2f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,14 +16,14 @@ export function decrypt(key: string, input: string): string { const keyBuffer = Buffer.from(key) const inputBuffer = Buffer.from(input, 'base64') - const iv = inputBuffer.slice(0, 16) - const tag = inputBuffer.slice(16, 32) - const text = inputBuffer.slice(32) + const iv = inputBuffer.subarray(0, 16) + const tag = inputBuffer.subarray(16, 32) + const text = inputBuffer.subarray(32) const decipher = crypto.createDecipheriv('aes-256-gcm', keyBuffer, iv) decipher.setAuthTag(tag) - const decrypted = decipher.update(text) + decipher.final('utf8') + const decrypted = decipher.update(text).toString() + decipher.final('utf8') return decrypted }