mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
decode message from client
This commit is contained in:
parent
6d2dcc0f90
commit
0404cbc062
1 changed files with 17 additions and 3 deletions
|
|
@ -3,9 +3,10 @@ package main
|
||||||
//@NOTE SHYFT main func for api, sets up router and spins up a server
|
//@NOTE SHYFT main func for api, sets up router and spins up a server
|
||||||
//to run server 'go run shyftRingWalletConn/*.go'
|
//to run server 'go run shyftRingWalletConn/*.go'
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -44,6 +45,19 @@ func handleRequest(conn net.Conn) {
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
fmt.Println("Message is ", string(buf[:msg]))
|
fmt.Println("Message is ", string(buf[:msg]))
|
||||||
|
var dat map[string]interface{}
|
||||||
|
byt := []byte(string(buf[:msg]))
|
||||||
|
|
||||||
|
if err := json.Unmarshal(byt, &dat); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Println(dat["address"])
|
||||||
|
fmt.Println(dat["msg"])
|
||||||
|
fmt.Println(dat["sig"])
|
||||||
|
//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)
|
fmt.Println("Message is ", msg)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue