Browse Source

CensusService: add `method` field required for signature

Signed-off-by: p4u <p4u@dabax.net>
testnet
p4u 5 years ago
parent
commit
f40dfc6ae0
2 changed files with 4 additions and 4 deletions
  1. +1
    -1
      cmd/censushttp/README.md
  2. +3
    -3
      service/census/censusmanager.go

+ 1
- 1
cmd/censushttp/README.md

@ -43,7 +43,7 @@ The next table shows the available methods and its relation with the fields.
## Signature
The signature provides authentication by signing a concatenation of the following strings (even if empty) without spaces: `censusId rootHash claimData timeStamp`.
The signature provides authentication by signing a concatenation of the following strings (even if empty) without spaces: `method censusId rootHash claimData timeStamp`.
The `timeStamp` when received on the server side must not differ more than 10 seconds from the current UNIX time.

+ 3
- 3
service/census/censusmanager.go

@ -118,9 +118,9 @@ func opHandler(c *Claim) *Result {
var err error
// Process data
log.Printf("censusId:{%s} rootHash:{%s} claimData:{%s} proofData:{%s} timeStamp:{%s} signature:{%s}\n",
c.CensusID, c.RootHash, c.ClaimData, c.ProofData, c.TimeStamp, c.Signature)
authString := fmt.Sprintf("%s%s%s%s", c.CensusID, c.RootHash, c.ClaimData, c.TimeStamp)
log.Printf("censusId:{%s} method:{%s} rootHash:{%s} claimData:{%s} proofData:{%s} timeStamp:{%s} signature:{%s}\n",
c.CensusID, c.Method, c.RootHash, c.ClaimData, c.ProofData, c.TimeStamp, c.Signature)
authString := fmt.Sprintf("%s%s%s%s%s", c.Method, c.CensusID, c.RootHash, c.ClaimData, c.TimeStamp)
resp.Error = false
resp.Response = ""
censusFound := false

Loading…
Cancel
Save