From fc39ac76b6471da4815efcb316bb59c5e28d18a8 Mon Sep 17 00:00:00 2001 From: wukko Date: Tue, 5 Mar 2024 21:18:20 +0600 Subject: [PATCH] crypto: change input var name in stream functions --- src/modules/sub/crypto.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/sub/crypto.js b/src/modules/sub/crypto.js index 6a221e1a..2fba1efc 100644 --- a/src/modules/sub/crypto.js +++ b/src/modules/sub/crypto.js @@ -7,8 +7,8 @@ export function generateHmac(str, salt) { return createHmac("sha256", salt).update(str).digest("base64url"); } -export function encryptStream(str, iv, secret) { - const buff = Buffer.from(JSON.stringify(str), "utf-8"); +export function encryptStream(plaintext, iv, secret) { + const buff = Buffer.from(JSON.stringify(plaintext), "utf-8"); const key = scryptSync(Buffer.from(secret, "base64url"), "salt", keyLength); const cipher = createCipheriv(algorithm, key, Buffer.from(iv, "base64url")); @@ -16,8 +16,8 @@ export function encryptStream(str, iv, secret) { return Buffer.concat([ cipher.update(buff), cipher.final() ]) } -export function decryptStream(buf, iv, secret) { - const buff = Buffer.from(buf, "binary"); +export function decryptStream(ciphertext, iv, secret) { + const buff = Buffer.from(ciphertext, "binary"); const key = scryptSync(Buffer.from(secret, "base64url"), "salt", keyLength); const decipher = createDecipheriv(algorithm, key, Buffer.from(iv, "base64url"));