From 7f5135a43464efcb14e151f516cd782727873674 Mon Sep 17 00:00:00 2001 From: Martin M Date: Wed, 27 Dec 2023 13:44:18 +0100 Subject: [PATCH] revert changes to callback code (#3137) --- lib/tools.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/tools.js b/lib/tools.js index 600bf7a0f..6f1959963 100644 --- a/lib/tools.js +++ b/lib/tools.js @@ -46,8 +46,10 @@ function encryptPhrase(password, phrase, callback) { encrypted += data.toString('hex'); } }); - cipher.on('end', () => callback(encrypted)); - + cipher.on('end', () => { + callback(encrypted); + }); + cipher.write(phrase); cipher.end(); } @@ -68,7 +70,9 @@ function decryptPhrase(password, data, callback) { console.error(`Cannot decode secret: ${error}`); callback(null); }); - decipher.on('end', function () callback(decrypted)); + decipher.on('end', function () { + callback(decrypted); + }); decipher.write(data, 'hex'); decipher.end();