From 7306a52f8ee8de35862473bad4e8a9e6862bbbca Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Wed, 29 Jan 2020 19:09:34 -0400 Subject: [PATCH] unencrypt incoming feed --- services/gunDB/contact-api/streams/index.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/services/gunDB/contact-api/streams/index.js b/services/gunDB/contact-api/streams/index.js index 248da93d..85c7834d 100644 --- a/services/gunDB/contact-api/streams/index.js +++ b/services/gunDB/contact-api/streams/index.js @@ -134,17 +134,15 @@ const onIncoming = cb => { return } - Object.entries(uti).forEach(async ([pub, feed]) => { - if (typeof feed !== 'string') { + Object.entries(uti).forEach(async ([pub, encFeed]) => { + if (typeof encFeed !== 'string') { return } + const ourSecret = await SEA.secret(await Utils.pubToEpub(pub), user._.sea) + + const feed = await SEA.decrypt(encFeed, ourSecret) if (pubFeedPairsWithIncomingListeners.add(pub + '--' + feed)) { - const ourSecret = await SEA.secret( - await Utils.pubToEpub(pub), - user._.sea - ) - require('../../Mediator') .getGun() .user(pub)