Merge branch 'develop' of https://github.com/Ferrox85/Superalgos into develop

This commit is contained in:
Ferrox85 committed 2021-09-22 19:27:23 +02:00
commit 57c4f80eb0
4 files changed
+20457 -146

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -304,12 +304,25 @@ exports.newNetworkModulesWebSocketsInterface = function newNetworkModulesWebSock
caller.socket.send(JSON.stringify(response))
return
}
let signedMessage = JSON.parse(signature.message)
/*
We will verify that the signature belongs to the signature.message.
To do this we will hash the signature.message and see if we get
the same hash of the signature.
*/
let hash = web3.eth.accounts.hashMessage(signature.message)
if (hash !== signature.messageHash) {
let response = {
result: 'Error',
message: 'signature.message Hashed Does Not Match signature.messageHash.'
}
caller.socket.send(JSON.stringify(response))
return
}
/*
The user profile based on the blockchain account, based on the signature,
it is our witness user profile, to validate the caller.
*/
let signedMessage = JSON.parse(signature.message)
if (signedMessage.callerProfileHandle !== witnessUserProfile.userProfileHandle) {
let response = {
result: 'Error',
@@ -124,7 +124,17 @@ exports.newNetworkModulesWebSocketsClient = function newNetworkModulesWebSockets
}
let signedMessage = JSON.parse(signature.message)
/*
We will verify that the signature belongs to the signature.message.
To do this we will hash the signature.message and see if we get
the same hash of the signature.
*/
let hash = web3.eth.accounts.hashMessage(signature.message)
if (hash !== signature.messageHash) {
console.log('[ERROR] Web Sockets Client -> stepOneResponse -> signature.message Hashed Does Not Match signature.messageHash.')
reject()
return
}
/*
We will check that the Network Node that responded has the same User Profile Handle
that we have on record, otherwise something is wrong and we should not proceed.