unused code
This commit is contained in:
parent
5762a2aaf8
commit
6263b15314
1 changed files with 0 additions and 47 deletions
|
|
@ -151,52 +151,6 @@ const recipientToOutgoingID = async recipientPub => {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} reqResponse
|
|
||||||
* @param {string} recipientPub
|
|
||||||
* @param {UserGUNNode} user
|
|
||||||
* @param {ISEA} SEA
|
|
||||||
* @returns {Promise<boolean>}
|
|
||||||
*/
|
|
||||||
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
|
* @param {string} userPub
|
||||||
|
|
@ -301,7 +255,6 @@ module.exports = {
|
||||||
recipientPubToLastReqSentID,
|
recipientPubToLastReqSentID,
|
||||||
successfulHandshakeAlreadyExists,
|
successfulHandshakeAlreadyExists,
|
||||||
recipientToOutgoingID,
|
recipientToOutgoingID,
|
||||||
reqWasAccepted,
|
|
||||||
currHandshakeAddress,
|
currHandshakeAddress,
|
||||||
tryAndWait,
|
tryAndWait,
|
||||||
mySecret,
|
mySecret,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue