From 6263b153148ee999963dfa1ab9d046df01ab2127 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Tue, 4 Feb 2020 10:15:47 -0400 Subject: [PATCH] unused code --- services/gunDB/contact-api/utils/index.js | 47 ----------------------- 1 file changed, 47 deletions(-) diff --git a/services/gunDB/contact-api/utils/index.js b/services/gunDB/contact-api/utils/index.js index 092b7742..1fc6d00d 100644 --- a/services/gunDB/contact-api/utils/index.js +++ b/services/gunDB/contact-api/utils/index.js @@ -151,52 +151,6 @@ const recipientToOutgoingID = async recipientPub => { return null } -/** - * @param {string} reqResponse - * @param {string} recipientPub - * @param {UserGUNNode} user - * @param {ISEA} SEA - * @returns {Promise} - */ -const reqWasAccepted = async (reqResponse, recipientPub, user, SEA) => { - try { - const recipientEpub = await pubToEpub(recipientPub) - const ourSecret = await SEA.secret(recipientEpub, user._.sea) - if (typeof ourSecret !== 'string') { - throw new TypeError('typeof ourSecret !== "string"') - } - - const decryptedResponse = await SEA.decrypt(reqResponse, ourSecret) - - if (typeof decryptedResponse !== 'string') { - throw new TypeError('typeof decryptedResponse !== "string"') - } - - const myFeedID = await recipientToOutgoingID(recipientPub) - - if (typeof myFeedID === 'string' && decryptedResponse === myFeedID) { - return false - } - - const recipientFeedID = decryptedResponse - - const maybeFeed = await tryAndWait(gun => - gun - .user(recipientPub) - .get(Key.OUTGOINGS) - .get(recipientFeedID) - .then() - ) - - const feedExistsOnRecipient = - typeof maybeFeed === 'object' && maybeFeed !== null - - return feedExistsOnRecipient - } catch (err) { - throw new Error(`reqWasAccepted() -> ${err.message}`) - } -} - /** * * @param {string} userPub @@ -301,7 +255,6 @@ module.exports = { recipientPubToLastReqSentID, successfulHandshakeAlreadyExists, recipientToOutgoingID, - reqWasAccepted, currHandshakeAddress, tryAndWait, mySecret,