From e12a479eeeb787786db0acc54150c05cc7034397 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 14 Jun 2022 10:53:52 +0200 Subject: add unsigned tree head endpoint --- pkg/types/endpoint.go | 2 ++ pkg/types/tree_head.go | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/pkg/types/endpoint.go b/pkg/types/endpoint.go index 60bb44f..5520d16 100644 --- a/pkg/types/endpoint.go +++ b/pkg/types/endpoint.go @@ -12,6 +12,8 @@ const ( EndpointGetInclusionProof = Endpoint("get-inclusion-proof/") EndpointGetConsistencyProof = Endpoint("get-consistency-proof/") EndpointGetLeaves = Endpoint("get-leaves/") + + EndpointGetTreeHeadUnsigned = Endpoint("get-tree-head-unsigned") ) // Path joins a number of components to form a full endpoint path. For example, diff --git a/pkg/types/tree_head.go b/pkg/types/tree_head.go index baedf08..3b344cc 100644 --- a/pkg/types/tree_head.go +++ b/pkg/types/tree_head.go @@ -64,6 +64,14 @@ func (th *TreeHead) Sign(s crypto.Signer, kh *merkle.Hash) (*SignedTreeHead, err return sth, nil } +func (th *TreeHead) ToASCII(w io.Writer) error { + return ascii.StdEncoding.Serialize(w, th) +} + +func (th *TreeHead) FromASCII(r io.Reader) error { + return ascii.StdEncoding.Deserialize(r, th) +} + func (sth *SignedTreeHead) ToASCII(w io.Writer) error { return ascii.StdEncoding.Serialize(w, sth) } -- cgit v1.2.3