socket.io encodes undefined as an string

This commit is contained in:
Daniel Lugo 2020-11-25 12:30:47 -04:00
parent b0679dc175
commit d870625db5

View file

@ -319,7 +319,11 @@ module.exports = (
*/ */
const listener = async (data, key) => { const listener = async (data, key) => {
try { try {
if (publicKeyForDecryption) { if (
typeof publicKeyForDecryption === 'string' &&
publicKeyForDecryption !== 'undefined' &&
publicKeyForDecryption.length > 15
) {
const decData = await deepDecryptIfNeeded( const decData = await deepDecryptIfNeeded(
data, data,
publicKeyForDecryption publicKeyForDecryption