diff options
author | Linus Nordberg <linus@nordberg.se> | 2022-06-14 10:53:52 +0200 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@mullvad.net> | 2022-06-21 19:46:54 +0200 |
commit | e12a479eeeb787786db0acc54150c05cc7034397 (patch) | |
tree | 2fb1d12dbd34a07b3f4990245109ee565fa10460 /pkg/types | |
parent | cb6485bb6075179dc2521b8e82db961deae74faf (diff) |
add unsigned tree head endpoint
Diffstat (limited to 'pkg/types')
-rw-r--r-- | pkg/types/endpoint.go | 2 | ||||
-rw-r--r-- | pkg/types/tree_head.go | 8 |
2 files changed, 10 insertions, 0 deletions
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) } |