CensusService: add method field required for signature

Signed-off-by: p4u <p4u@dabax.net>
This commit is contained in:
p4u
2019-02-18 10:48:58 +01:00
parent a4d8b87d93
commit f40dfc6ae0
2 changed files with 4 additions and 4 deletions

View File

@@ -43,7 +43,7 @@ The next table shows the available methods and its relation with the fields.
## Signature ## 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. The `timeStamp` when received on the server side must not differ more than 10 seconds from the current UNIX time.

View File

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