From 9f2d6ee3fc9b8f2206fbd7a82126826931a18e78 Mon Sep 17 00:00:00 2001 From: Tim Williams Date: Sat, 30 Jun 2018 15:28:19 -0400 Subject: [PATCH] log error from Ecrecover --- shyftRingWalletConn/app.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/shyftRingWalletConn/app.go b/shyftRingWalletConn/app.go index f238331813..b03f308b1f 100644 --- a/shyftRingWalletConn/app.go +++ b/shyftRingWalletConn/app.go @@ -6,7 +6,8 @@ import ( "net" "fmt" "os" - "encoding/json" + "encoding/json" + "github.com/ethereum/go-ethereum/crypto" ) const ( @@ -56,8 +57,18 @@ func handleRequest(conn net.Conn) { //Ecrecover takes 2 args, bytes[] and bytes[] // we need to pass in the hash of the message as bytes // and the bytes array of the signature - //crypto.Ecrecover() - fmt.Println("Message is ", msg) + var msg = []byte(dat["msg"].(string)) + var sig = []byte(dat["sig"].(string)) + var address, err = crypto.Ecrecover(msg, sig) + if err != nil { + fmt.Println("The error is ") + fmt.Println(err) + } + s := string(address[:]) + fmt.Println("the address is ") + fmt.Println(s) + //fmt.Println(address) + //fmt.Println("Message is ", msg) } if err != nil { fmt.Println("Error reading:", err.Error())