diff options
| author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-05 20:14:20 +0100 | 
|---|---|---|
| committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-05 20:14:20 +0100 | 
| commit | d25bde66ff0a1a05e9576f0211aa4241e7c46cdc (patch) | |
| tree | 43d61e5d1647ba9856391ffb814e067d9528d939 /client | |
| parent | 0fb26b527a9dbf9d90e6df10f025d2a546cde407 (diff) | |
added client-side get-anchors code (2)
Missed one file.
Diffstat (limited to 'client')
| -rw-r--r-- | client/client.go | 12 | 
1 files changed, 10 insertions, 2 deletions
| 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 { | 
