Browse Source

Merge pull request #4 from vocdoni/f/treeIdNameChange

ProcessID => CensusID
feature_chain_module
Pau 5 years ago
committed by GitHub
parent
commit
7025725fb2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions
  1. +5
    -5
      service/README.md
  2. +5
    -5
      service/processHttp.go

+ 5
- 5
service/README.md

@ -10,30 +10,30 @@ processHttp.Listen(1500, "http")
#### add claims #### add claims
``` ```
curl -d '{"processID":"GoT_Favorite","claimData":"Jon Snow"}' http://localhost:1500/addClaim
curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow"}' http://localhost:1500/addClaim
{"error":false,"response":""} {"error":false,"response":""}
``` ```
``` ```
curl -d '{"processID":"GoT_Favorite","claimData":"Tyrion"}' http://localhost:1500/addClaim
curl -d '{"censusID":"GoT_Favorite","claimData":"Tyrion"}' http://localhost:1500/addClaim
{"error":false,"response":""} {"error":false,"response":""}
``` ```
#### generate proof #### generate proof
``` ```
curl -d '{"processID":"GoT_Favorite","claimData":"Jon Snow"}' http://localhost:1500/genProof
curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow"}' http://localhost:1500/genProof
{"error":false,"response":"0x000000000000000000000000000000000000000000000000000000000000000352f3ca2aaf635ec2ae4452f6a65be7bca72678287a8bb08ad4babfcccd76c2fef1aac7675261bf6d12c746fb7907beea6d1f1635af93ba931eec0c6a747ecc37"} {"error":false,"response":"0x000000000000000000000000000000000000000000000000000000000000000352f3ca2aaf635ec2ae4452f6a65be7bca72678287a8bb08ad4babfcccd76c2fef1aac7675261bf6d12c746fb7907beea6d1f1635af93ba931eec0c6a747ecc37"}
``` ```
#### check proof #### check proof
``` ```
curl -d '{"processID":"GoT_Favorite","claimData":"Jon Snow", "proofData": "0x0000000000000000000000000000000000000000000000000000000000000000000123"}' http://localhost:1500/checkProof
curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow", "proofData": "0x0000000000000000000000000000000000000000000000000000000000000000000123"}' http://localhost:1500/checkProof
{"error":false,"response":"invalid"} {"error":false,"response":"invalid"}
``` ```
``` ```
curl -d '{"processID":"GoT_Favorite","claimData":"Jon Snow", "proofData": "0x000000000000000000000000000000000000000000000000000000000000000352f3ca2aaf635ec2ae4452f6a65be7bca72678287a8bb08ad4babfcccd76c2fef1aac7675261bf6d12c746fb7907beea6d1f1635af93ba931eec0c6a747ecc37"}' http://localhost:1500/checkProof
curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow", "proofData": "0x000000000000000000000000000000000000000000000000000000000000000352f3ca2aaf635ec2ae4452f6a65be7bca72678287a8bb08ad4babfcccd76c2fef1aac7675261bf6d12c746fb7907beea6d1f1635af93ba931eec0c6a747ecc37"}' http://localhost:1500/checkProof
{"error":false,"response":"valid"} {"error":false,"response":"valid"}
``` ```

+ 5
- 5
service/processHttp.go

@ -12,7 +12,7 @@ import (
var T tree.Tree var T tree.Tree
type Claim struct { type Claim struct {
ProcessID string `json:"processID"`
CensusID string `json:"censusID"`
ClaimData string `json:"claimData"` ClaimData string `json:"claimData"`
ProofData string `json:"proofData"` ProofData string `json:"proofData"`
} }
@ -51,15 +51,15 @@ func claimHandler(w http.ResponseWriter, req *http.Request, op string) {
} }
// Process data // Process data
log.Printf("Received: %s,%s,%s ", c.ProcessID, c.ClaimData, c.ProofData)
log.Printf("Received: %s,%s,%s ", c.CensusID, c.ClaimData, c.ProofData)
resp.Error = false resp.Error = false
resp.Response = "" resp.Response = ""
if len(c.ProcessID) > 0 {
T.Namespace = c.ProcessID
if len(c.CensusID) > 0 {
T.Namespace = c.CensusID
} else { } else {
resp.Error = true resp.Error = true
resp.Response = "processID is not valid"
resp.Response = "CensusID is not valid"
reply(&resp, w) reply(&resp, w)
return return
} }

Loading…
Cancel
Save