Skip to content

Commit d483800

Browse files
committed
sunlight: add Client.Issuer method
1 parent 20d133c commit d483800

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

client.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,14 @@ func (c *Client) Checkpoint(ctx context.Context) (torchwood.Checkpoint, *note.No
235235

236236
return checkpoint, n, nil
237237
}
238+
239+
// Issuer returns the issuer matching the fingerprint from
240+
// [LogEntry.ChainFingerprints].
241+
func (c *Client) Issuer(ctx context.Context, fp [32]byte) (*x509.Certificate, error) {
242+
endpoint := fmt.Sprintf("issuer/%x", fp)
243+
cert, err := c.f.ReadEndpoint(ctx, endpoint)
244+
if err != nil {
245+
return nil, fmt.Errorf("sunlight: failed to fetch issuer certificate for %x: %w", fp, err)
246+
}
247+
return x509.ParseCertificate(cert)
248+
}

0 commit comments

Comments
 (0)