From f534c3e45d83e45b7e9b026b6a9e4caea68e7ab6 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Mon, 6 Sep 2021 15:52:24 -0400 Subject: [PATCH] IIFE was interfering with trace --- services/gunDB/rpc/index.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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)