From 06685a7bf0389f60147d22d19e80797b614dfa46 Mon Sep 17 00:00:00 2001 From: Tim Williams Date: Wed, 11 Jul 2018 23:25:30 -0400 Subject: [PATCH] send message back to client --- shyftRingWalletConn/app.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/shyftRingWalletConn/app.go b/shyftRingWalletConn/app.go index 73637903d6..149ba188c0 100644 --- a/shyftRingWalletConn/app.go +++ b/shyftRingWalletConn/app.go @@ -7,8 +7,9 @@ import ( "fmt" "os" "encoding/json" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" ) const ( @@ -101,12 +102,24 @@ func handleRequest(conn net.Conn) { //fmt.Println(recoveredAddr) fmt.Println(recoveredAddr.Hex()) + conn.Write([]byte("Message received.")) + + key, _ := crypto.HexToECDSA(testPrivHex) + addr := common.HexToAddress(testAddrHex) + + new_msg2 := crypto.Keccak256([]byte("Message Received")) + new_sig , err := crypto.Sign(new_msg2, key) + + conn.Write([]byte("Message Received")) + conn.Write(new_msg2) + conn.Write(addr[:]) + conn.Write(new_sig) } if err != nil { fmt.Println("Error reading:", err.Error()) } // Send a response back to person contacting us. - conn.Write([]byte("Message received.")) + // Close the connection when you're done with it. //conn.Close() } \ No newline at end of file