comments/messages
This commit is contained in:
parent
d12656d154
commit
7ca39103b2
1 changed files with 10 additions and 4 deletions
|
|
@ -51,14 +51,20 @@ const onAcceptedRequests = (user, SEA) => {
|
||||||
' this can be due to nulling out an old request (if null) or something else happened (please look at the output)'
|
' this can be due to nulling out an old request (if null) or something else happened (please look at the output)'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// get the recipient pub from the stored request to avoid an attacker
|
||||||
|
// overwriting the handshake request in the root graph
|
||||||
const recipientPub = await SEA.decrypt(storedReq.recipientPub, mySecret)
|
const recipientPub = await SEA.decrypt(storedReq.recipientPub, mySecret)
|
||||||
|
|
||||||
if (typeof recipientPub !== 'string') {
|
if (typeof recipientPub !== 'string') {
|
||||||
throw new TypeError()
|
throw new TypeError(
|
||||||
|
`Expected storedReq.recipientPub to be an string, instead got: ${recipientPub}`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await Utils.successfulHandshakeAlreadyExists(recipientPub)) {
|
if (await Utils.successfulHandshakeAlreadyExists(recipientPub)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const requestAddress = await SEA.decrypt(
|
const requestAddress = await SEA.decrypt(
|
||||||
storedReq.handshakeAddress,
|
storedReq.handshakeAddress,
|
||||||
mySecret
|
mySecret
|
||||||
|
|
@ -101,9 +107,9 @@ const onAcceptedRequests = (user, SEA) => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// The response can be decrypted with the same secret regardless of who
|
// The response can be decrypted with the same secret regardless
|
||||||
// wrote to it last (see HandshakeRequest definition).
|
// of who wrote to it last (see HandshakeRequest definition). This
|
||||||
// This could be our feed ID for the recipient, or the recipient's feed
|
// could be our feed ID for the recipient, or the recipient's feed
|
||||||
// id if he accepted the request.
|
// id if he accepted the request.
|
||||||
const feedID = await SEA.decrypt(sentReq.response, ourSecret)
|
const feedID = await SEA.decrypt(sentReq.response, ourSecret)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue