aboutsummaryrefslogtreecommitdiff
path: root/log_parameters.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-06-06 15:59:35 +0200
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-06-06 15:59:35 +0200
commit47bacfd5c5d22470340e0823c4ad37b45914b68e (patch)
tree0984b55ced1e537e8d1d681c77157f1a47e47cdc /log_parameters.go
parent0285454c34b0b3003bc8ede3e304b843ad949be8 (diff)
started using the refactored packages in siglog server
Diffstat (limited to 'log_parameters.go')
-rw-r--r--log_parameters.go47
1 files changed, 0 insertions, 47 deletions
diff --git a/log_parameters.go b/log_parameters.go
deleted file mode 100644
index aceff3e..0000000
--- a/log_parameters.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package stfe
-
-import (
- "crypto"
- "crypto/ed25519"
- "fmt"
- "time"
-
- "github.com/system-transparency/stfe/types"
-)
-
-// LogParameters is a collection of log parameters
-type LogParameters struct {
- LogId string // serialized log id (hex)
- TreeId int64 // used internally by Trillian
- Prefix string // e.g., "test" for <base>/test
- MaxRange int64 // max entries per get-entries request
- Deadline time.Duration // gRPC deadline
- Interval time.Duration // cosigning sth frequency
- HashType crypto.Hash // hash function used by Trillian
- Signer crypto.Signer // access to Ed25519 private key
-
- // Witnesses map trusted witness identifiers to public verification keys
- Witnesses map[[types.HashSize]byte][types.VerificationKeySize]byte
-}
-
-// Sign signs a tree head
-func (lp *LogParameters) Sign(th *types.TreeHead) (*types.SignedTreeHead, error) {
- sig, err := lp.Signer.Sign(nil, th.Marshal(), crypto.Hash(0))
- if err != nil {
- return nil, fmt.Errorf("Sign failed: %v", err)
- }
- lastSthTimestamp.Set(float64(time.Now().Unix()), lp.LogId)
- lastSthSize.Set(float64(th.TreeSize), lp.LogId)
-
- sigident := types.SigIdent{
- KeyHash: types.Hash(lp.Signer.Public().(ed25519.PublicKey)[:]),
- Signature: &[types.SignatureSize]byte{},
- }
- copy(sigident.Signature[:], sig)
- return &types.SignedTreeHead{
- TreeHead: *th,
- SigIdent: []*types.SigIdent{
- &sigident,
- },
- }, nil
-}