From d870625db5a98f6536089ea7d9f47347ef4ba4b6 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Wed, 25 Nov 2020 12:30:47 -0400 Subject: [PATCH] socket.io encodes undefined as an string --- src/sockets.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sockets.js b/src/sockets.js index bdddc64a..54537af8 100644 --- a/src/sockets.js +++ b/src/sockets.js @@ -319,7 +319,11 @@ module.exports = ( */ const listener = async (data, key) => { try { - if (publicKeyForDecryption) { + if ( + typeof publicKeyForDecryption === 'string' && + publicKeyForDecryption !== 'undefined' && + publicKeyForDecryption.length > 15 + ) { const decData = await deepDecryptIfNeeded( data, publicKeyForDecryption