diff --git a/.vscode/settings.json b/.vscode/settings.json index f7a45822..0d137178 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,13 @@ "debug.node.autoAttach": "on", "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode", - "cSpell.words": ["Epub", "GUNRPC", "ISEA", "PUBKEY", "Reqs", "uuidv"] + "cSpell.words": [ + "Epub", + "falsey", + "GUNRPC", + "ISEA", + "PUBKEY", + "Reqs", + "uuidv" + ] } diff --git a/services/gunDB/rpc/index.js b/services/gunDB/rpc/index.js index f4ea4e0f..76f58163 100644 --- a/services/gunDB/rpc/index.js +++ b/services/gunDB/rpc/index.js @@ -53,15 +53,13 @@ const deepDecryptIfNeeded = async (value, publicKey, epubForDecryption) => { if (user.is.pub === publicKey || 'me' === publicKey) { sec = getMySecret() } else { - sec = await SEA.secret( - await (() => { - if (epubForDecryption) { - return epubForDecryption - } - return pubToEpub(publicKey) - })(), - user._.sea - ) + let epub = epubForDecryption + + if (!epub) { + epub = await pubToEpub(publicKey) + } + + sec = await SEA.secret(epub, user._.sea) } const decrypted = SEA.decrypt(value, sec) diff --git a/src/routes.js b/src/routes.js index b719478d..0d11de70 100644 --- a/src/routes.js +++ b/src/routes.js @@ -2380,7 +2380,7 @@ module.exports = async ( return new Promise((res, rej) => { const listener = data => { logger.info(`got res for: ${keys}`) - logger.info(data) + logger.info(data || 'falsey data (does not get logged)') if (publicKeyForDecryption) { GunWriteRPC.deepDecryptIfNeeded( data, diff --git a/src/sockets.js b/src/sockets.js index 159c8358..2e908de4 100644 --- a/src/sockets.js +++ b/src/sockets.js @@ -47,6 +47,10 @@ module.exports = ( */ try { + logger.info( + 'Connect event for socket with handshake: ', + socket.handshake.auth + ) if (!isAuthenticated()) { socket.emit(Common.Constants.ErrorCode.NOT_AUTH) return