From 1e70afdd6b2892ce38722dae62aa80d89c6269c5 Mon Sep 17 00:00:00 2001 From: Al Cutter Date: Fri, 19 Jul 2024 13:06:52 +0100 Subject: [PATCH] comments --- ct_only.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ct_only.go b/ct_only.go index 2d383aa4..f4ab3f91 100644 --- a/ct_only.go +++ b/ct_only.go @@ -20,16 +20,31 @@ import ( "github.com/transparency-dev/trillian-tessera/ctonly" ) +// Storage described the expected functions from Tessera storage implementations. type Storage interface { + // Add should duably assign an index to the provided Entry, and return it. + // + // Implementations MUST call the AssignIndex() method on the entry before marshaling and persisting it. Add(context.Context, *Entry) (uint64, error) } +// NewCertificateTransparencySequencedWriter returns a function which knows how to add a CT-specific entry type to the log. +// +// This entry point MUST ONLY be used for CT logs participating in the CT ecosystem. +// It should not be used as the basis for any other/new transparency application as this protocol: +// a) embodies some techniques which are not considered to be best practice (it does this to retain backawards-compatibility with RFC6962) +// b) is not compatible with the https://c2sp.org/tlog-tiles API which we _very strongly_ encourage you to use instead. +// +// Returns the assigned index in the log, or an error. func NewCertificateTransparencySequencedWriter(s Storage) func(context.Context, *ctonly.Entry) (uint64, error) { return func(ctx context.Context, e *ctonly.Entry) (uint64, error) { return s.Add(ctx, convertCTEntry(e)) } } +// convertCTEntry returns an Entry struct which will do the right thing for CT Static API logs. +// +// This MUST NOT be used for any other purpose. func convertCTEntry(e *ctonly.Entry) *Entry { r := &Entry{} r.internal.Identity = e.Identity()