diff --git a/Environment.js b/Environment.js index 6909eb088..92fd77434 100644 --- a/Environment.js +++ b/Environment.js @@ -38,8 +38,8 @@ exports.newEnvironment = function () { PLATFORM_APP_SIGNING_ACCOUNT: 'Algo-Traders-Platform-1', P2P_NETWORK_NODE_SIGNING_ACCOUNT: 'P2P-Network-Node-1', P2P_NETWORK_NODE_MAX_INCOMING_CLIENTS: 1, - P2P_NETWORK_NODE_MAX_INCOMING_PEERS: 2, - P2P_NETWORK_NODE_MAX_OUTGOING_PEERS: 2 + P2P_NETWORK_NODE_MAX_INCOMING_PEERS: 0, + P2P_NETWORK_NODE_MAX_OUTGOING_PEERS: 0 } if (process.env.DATA_PATH) { diff --git a/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json b/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json index b14b89501..fb47dc646 100644 --- a/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json +++ b/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json @@ -3707,7 +3707,7 @@ { "type": "P2P Network Node", "name": "P2P Network Node #2", - "config": "{\n \"codeName\": \"P2P-Network-Node-2\",\n \"host\": \"localhost\",\n \"webPort\": \"31248\",\n \"webSocketsPort\": \"18042\"\n}", + "config": "{\n \"codeName\": \"P2P-Network-Node-2\",\n \"host\": \"localhost\",\n \"webPort\": \"31249\",\n \"webSocketsPort\": \"18043\"\n}", "project": "Governance", "signingAccount": { "type": "Signing Account", @@ -3774,7 +3774,7 @@ "floatingObject": { "isPinned": false, "isFrozen": false, - "isCollapsed": true, + "isCollapsed": false, "angleToParent": 1, "distanceToParent": 3, "arrangementStyle": 0 diff --git a/Projects/Governance/UI/Function-Libraries/ProfileConstructor.js b/Projects/Governance/UI/Function-Libraries/ProfileConstructor.js index 106575b8e..6b7786d6c 100644 --- a/Projects/Governance/UI/Function-Libraries/ProfileConstructor.js +++ b/Projects/Governance/UI/Function-Libraries/ProfileConstructor.js @@ -273,10 +273,10 @@ function newGovernanceFunctionLibraryProfileConstructor() { console.log('Call to WEB3 Server failed. ' + response.error) return } - signSigningAccountData(response.privateKey) + signSigningAccountData(response.address, response.privateKey) } - function signSigningAccountData(privateKey) { + function signSigningAccountData(blockchainAccount, privateKey) { let request = { url: 'WEB3', @@ -349,6 +349,7 @@ function newGovernanceFunctionLibraryProfileConstructor() { nodeType: targetNodeType, nodeCodeName: codeName, signingAccountNodeId: signingAccount.id, + blockchainAccount: blockchainAccount, privateKey: privateKey, userProfileHandle: userProfileHandle, userProfileId: userProfile.id diff --git a/Projects/Network/SA/Modules/WebSocketsNetworkClient.js b/Projects/Network/SA/Modules/WebSocketsNetworkClient.js index cab9306bf..ff84ecefd 100644 --- a/Projects/Network/SA/Modules/WebSocketsNetworkClient.js +++ b/Projects/Network/SA/Modules/WebSocketsNetworkClient.js @@ -8,7 +8,8 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb port: undefined, callerRole: undefined, p2pNetworkNode: undefined, - p2pNetworkIdentity: undefined, + p2pNetworkClientIdentity: undefined, + p2pNetworkClientCodeName: undefined, onConnectionClosedCallBack: undefined, sendMessage: sendMessage, initialize: initialize, @@ -30,7 +31,7 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb thisObject.port = undefined thisObject.callerRole = undefined thisObject.p2pNetworkNode = undefined - thisObject.p2pNetworkIdentity = undefined + thisObject.p2pNetworkClientIdentity = undefined thisObject.onConnectionClosedCallBack = undefined web3 = undefined @@ -38,10 +39,11 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb onMessageFunctionsMap = undefined } - async function initialize(callerRole, p2pNetworkIdentity, p2pNetworkNode, onConnectionClosedCallBack) { + async function initialize(callerRole, p2pNetworkClientIdentity, p2pNetworkNode, onConnectionClosedCallBack) { thisObject.callerRole = callerRole - thisObject.p2pNetworkIdentity = p2pNetworkIdentity + thisObject.p2pNetworkClientIdentity = p2pNetworkClientIdentity + thisObject.p2pNetworkClientCodeName = JSON.parse(thisObject.p2pNetworkClientIdentity.node.config).codeName thisObject.p2pNetworkNode = p2pNetworkNode thisObject.onConnectionClosedCallBack = onConnectionClosedCallBack @@ -100,9 +102,9 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb let message = { messageType: 'Handshake', callerRole: thisObject.callerRole, - callerProfileHandle: SA.secrets.map.get(global.env.DESKTOP_APP_SIGNING_ACCOUNT).userProfileHandle, + callerProfileHandle: SA.secrets.map.get(thisObject.p2pNetworkClientCodeName).userProfileHandle, callerTimestamp: callerTimestamp, - callerNode: JSON.stringify(thisObject.p2pNetworkIdentity.node), + callerNode: JSON.stringify(thisObject.p2pNetworkClientIdentity.node), step: 'One' } thisObject.socket.send(JSON.stringify(message)) @@ -162,7 +164,7 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb We will check that the profile handle we sent to the Network Node, is returned at the signed message, to avoid man in the middle attacks. */ - if (signedMessage.callerProfileHandle !== SA.secrets.map.get(global.env.DESKTOP_APP_SIGNING_ACCOUNT).userProfileHandle) { + if (signedMessage.callerProfileHandle !== SA.secrets.map.get(thisObject.p2pNetworkClientCodeName).userProfileHandle) { console.log('[ERROR] Web Sockets Network Client -> stepOneResponse -> The Network Node callerProfileHandle does not match my own userProfileHandle.') reject() return @@ -192,7 +194,7 @@ exports.newNetworkModulesWebSocketsNetworkClient = function newNetworkModulesWeb */ thisObject.socket.onmessage = socketMessage => { stepTwoResponse(socketMessage) } - let signature = web3.eth.accounts.sign(JSON.stringify(signedMessage), SA.secrets.map.get(global.env.DESKTOP_APP_SIGNING_ACCOUNT).privateKey) + let signature = web3.eth.accounts.sign(JSON.stringify(signedMessage), SA.secrets.map.get(thisObject.p2pNetworkClientCodeName).privateKey) let message = { messageType: 'Handshake',