diff options
Diffstat (limited to 'internal/state/state_manager.go')
-rw-r--r-- | internal/state/state_manager.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/internal/state/state_manager.go b/internal/state/state_manager.go new file mode 100644 index 0000000..60d2af1 --- /dev/null +++ b/internal/state/state_manager.go @@ -0,0 +1,30 @@ +package state + +import ( + "context" + + "git.sigsum.org/sigsum-go/pkg/merkle" + "git.sigsum.org/sigsum-go/pkg/types" +) + +// StateManager coordinates access to a nodes tree heads and (co)signatures. +type StateManager interface { + // ToCosignTreeHead returns the node's to-cosign tree head + ToCosignTreeHead() *types.SignedTreeHead + + // CosignedTreeHead returns the node'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 node's to-cosign and cosigned tree heads + Run(context.Context) +} + +// event is a verified cosignature request +type event struct { + keyHash *merkle.Hash + cosignature *types.Signature +} |