diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-17 15:34:33 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-17 15:34:33 +0100 |
commit | c11006fb89bcac7fdfc2278990b2b1a3a3553ba9 (patch) | |
tree | 7dc1547912ba1a018b56e8e1dc4e3fe27d4cbff9 /handler.go | |
parent | f02d9ad52b4b70fc1af8224201cf993faa82eaee (diff) |
added type tests
As a result these changes were made:
- Simplified a few New* functions
- Allowed empty inclusion and consistency proofs, which is in contrast
to not being able to marshal them due to `tls:"minlen:1"`. For example,
an inclusion proof will be empty for a Merkle tree of size 1.
- Disallowed empty signatures and chains in a leaf's Appendix
- Removed unnecessary examples
Diffstat (limited to 'handler.go')
-rw-r--r-- | handler.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -138,7 +138,7 @@ func getProofByHash(ctx context.Context, i *Instance, w http.ResponseWriter, r * return status, fmt.Errorf("bad GetInclusionProofByHashResponse: %v", errInner) } - rsp, err := NewInclusionProofV1(i.LogParameters.LogId, uint64(req.TreeSize), trsp.Proof[0]).MarshalB64() + rsp, err := NewInclusionProofV1(i.LogParameters.LogId, uint64(req.TreeSize), uint64(trsp.Proof[0].LeafIndex), trsp.Proof[0].Hashes).MarshalB64() if err != nil { return http.StatusInternalServerError, err } @@ -165,7 +165,7 @@ func getConsistencyProof(ctx context.Context, i *Instance, w http.ResponseWriter return status, fmt.Errorf("bad GetConsistencyProofResponse: %v", errInner) } - rsp, err := NewConsistencyProofV1(i.LogParameters.LogId, req.First, req.Second, trsp.Proof).MarshalB64() + rsp, err := NewConsistencyProofV1(i.LogParameters.LogId, uint64(req.First), uint64(req.Second), trsp.Proof.Hashes).MarshalB64() if err != nil { return http.StatusInternalServerError, err } @@ -186,7 +186,7 @@ func getSth(ctx context.Context, i *Instance, w http.ResponseWriter, _ *http.Req return status, fmt.Errorf("bad GetLatestSignedLogRootResponse: %v", errInner) } - sth, err := i.LogParameters.genV1Sth(NewTreeHeadV1(i.LogParameters, &lr)) + sth, err := i.LogParameters.genV1Sth(NewTreeHeadV1(&lr)) if err != nil { return http.StatusInternalServerError, fmt.Errorf("failed creating signed tree head: %v", err) } |