From d25bde66ff0a1a05e9576f0211aa4241e7c46cdc Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Thu, 5 Nov 2020 20:14:20 +0100 Subject: added client-side get-anchors code (2) Missed one file. --- client/client.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/client.go b/client/client.go index a7f8abb..d070de9 100644 --- a/client/client.go +++ b/client/client.go @@ -237,8 +237,16 @@ func (c *Client) GetEntries(ctx context.Context, start, end uint64) ([]*stfe.Get // GetAnchors fetches the log's trust anchors. Safe to use without a client // chain and corresponding private key. -func (c *Client) GetAnchors(ctx context.Context, start, end uint64) ([]*x509.Certificate, error) { - return nil, fmt.Errorf("TODO: Client.GetAnchors()") +func (c *Client) GetAnchors(ctx context.Context) ([]*x509.Certificate, error) { + req, err := http.NewRequest("GET", c.protocol()+c.Log.BaseUrl+"/get-anchors", nil) + if err != nil { + return nil, fmt.Errorf("failed creating http request: %v", err) + } + var rsp [][]byte + if err := c.doRequest(ctx, req, &rsp); err != nil { + return nil, err + } + return x509util.ParseDerChainToList(rsp) } func (c *Client) chain() [][]byte { -- cgit v1.2.3