aboutsummaryrefslogtreecommitdiff
path: root/pkg/state/state_manager.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/state/state_manager.go')
-rw-r--r--pkg/state/state_manager.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/pkg/state/state_manager.go b/pkg/state/state_manager.go
index 5aa7609..ab0293c 100644
--- a/pkg/state/state_manager.go
+++ b/pkg/state/state_manager.go
@@ -6,11 +6,24 @@ import (
"git.sigsum.org/sigsum-lib-go/pkg/types"
)
-// StateManager coordinates access to a log's tree heads and (co)signatures
+// StateManager coordinates access to a log's tree heads and (co)signatures.
type StateManager interface {
- Latest(context.Context) (*types.SignedTreeHead, error)
- ToSign(context.Context) (*types.SignedTreeHead, error)
- Cosigned(context.Context) (*types.CosignedTreeHead, error)
+ // ToCosignTreeHead returns the log's to-cosign tree head
+ ToCosignTreeHead(context.Context) (*types.SignedTreeHead, error)
+
+ // CosignedTreeHead returns the log's cosigned tree head
+ CosignedTreeHead(context.Context) (*types.CosignedTreeHead, error)
+
+ // AddCosignature verifies that a cosignature is valid for the to-cosign
+ // tree head before adding it
AddCosignature(context.Context, *types.PublicKey, *types.Signature) error
+
+ // Run peridically rotates the log's to-cosign and cosigned tree heads
Run(context.Context)
}
+
+// event is a verified cosignature request
+type event struct {
+ keyHash *types.Hash
+ cosignature *types.Signature
+}