mirror of
https://github.com/arnaucube/blockchainIDsystem.git
synced 2026-02-07 02:56:43 +01:00
Implemented signup and login users with JWT and MongoDB connection. Added runTmuxTextPeers.sh to deploy the different peers and servers in a unique console
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Routes []Route
|
||||
|
||||
var routes = Routes{
|
||||
@@ -27,29 +21,35 @@ var routes = Routes{
|
||||
"/blockchain",
|
||||
GetBlockchain,
|
||||
},
|
||||
}
|
||||
/*
|
||||
POST /signup
|
||||
POST /loginuser
|
||||
POST /blindsign
|
||||
POST /verifysign
|
||||
|
||||
type Address struct {
|
||||
Address string `json:"address"` //the pubK of the user, to perform logins
|
||||
}
|
||||
|
||||
func Index(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, "CA")
|
||||
}
|
||||
func GetPeers(w http.ResponseWriter, r *http.Request) {
|
||||
getPeers()
|
||||
|
||||
jResp, err := json.Marshal(peersList)
|
||||
check(err)
|
||||
fmt.Fprintln(w, string(jResp))
|
||||
}
|
||||
|
||||
func GetBlockchain(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Print("aaaaa: ")
|
||||
fmt.Println(blockchain.Blocks[len(blockchain.Blocks)-1].Hash)
|
||||
reconstructBlockchainFromBlock("http://"+config.IP+":"+config.ServerRESTPort, blockchain.Blocks[len(blockchain.Blocks)-1].Hash)
|
||||
|
||||
jResp, err := json.Marshal(blockchain)
|
||||
check(err)
|
||||
fmt.Fprintln(w, string(jResp))
|
||||
*/
|
||||
Route{
|
||||
"Signup",
|
||||
"POST",
|
||||
"/signup",
|
||||
Signup,
|
||||
},
|
||||
Route{
|
||||
"Login",
|
||||
"POST",
|
||||
"/login",
|
||||
Login,
|
||||
},
|
||||
Route{
|
||||
"BlindSign",
|
||||
"POST",
|
||||
"/blindsign",
|
||||
BlindSign,
|
||||
},
|
||||
Route{
|
||||
"VerifySign",
|
||||
"POST",
|
||||
"/verifysign",
|
||||
VerifySign,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user