From dda238b9fc105219f220f0ec3b341b0c81b71301 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Mon, 20 Dec 2021 19:53:54 +0100 Subject: types: Start using sigsum-lib-go This commit does not change the way in which the log behaves externally. In other words, all changes are internal and involves renaming and code restructuring. Most notably picking up the refactored sigsum-lib-go. --- cmd/sigsum_log_go/main.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'cmd/sigsum_log_go') diff --git a/cmd/sigsum_log_go/main.go b/cmd/sigsum_log_go/main.go index 0c1035b..acda9d6 100644 --- a/cmd/sigsum_log_go/main.go +++ b/cmd/sigsum_log_go/main.go @@ -21,11 +21,11 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" "google.golang.org/grpc" - sigsum "git.sigsum.org/sigsum-log-go/pkg/instance" - "git.sigsum.org/sigsum-log-go/pkg/state" - trillianWrapper "git.sigsum.org/sigsum-log-go/pkg/trillian" - "git.sigsum.org/sigsum-log-go/pkg/types" + "git.sigsum.org/sigsum-lib-go/pkg/types" + "git.sigsum.org/sigsum-log-go/pkg/db" "git.sigsum.org/sigsum-log-go/pkg/dns" + "git.sigsum.org/sigsum-log-go/pkg/instance" + "git.sigsum.org/sigsum-log-go/pkg/state" ) var ( @@ -90,8 +90,8 @@ func main() { } // SetupInstance sets up a new sigsum-log-go instance from flags -func setupInstanceFromFlags() (*sigsum.Instance, error) { - var i sigsum.Instance +func setupInstanceFromFlags() (*instance.Instance, error) { + var i instance.Instance var err error // Setup log configuration @@ -119,7 +119,7 @@ func setupInstanceFromFlags() (*sigsum.Instance, error) { if err != nil { return nil, fmt.Errorf("Dial: %v", err) } - i.Client = &trillianWrapper.TrillianClient{ + i.Client = &db.TrillianClient{ TreeID: i.TreeID, GRPC: trillian.NewTrillianLogClient(conn), } @@ -157,8 +157,8 @@ func newLogIdentity(key string) (crypto.Signer, string, error) { } // newWitnessMap creates a new map of trusted witnesses -func newWitnessMap(witnesses string) (map[[types.HashSize]byte][types.VerificationKeySize]byte, error) { - w := make(map[[types.HashSize]byte][types.VerificationKeySize]byte) +func newWitnessMap(witnesses string) (map[types.Hash]types.PublicKey, error) { + w := make(map[types.Hash]types.PublicKey) if len(witnesses) > 0 { for _, witness := range strings.Split(witnesses, ",") { b, err := hex.DecodeString(witness) @@ -166,11 +166,11 @@ func newWitnessMap(witnesses string) (map[[types.HashSize]byte][types.Verificati return nil, fmt.Errorf("DecodeString: %v", err) } - var vk [types.VerificationKeySize]byte - if n := copy(vk[:], b); n != types.VerificationKeySize { + var vk types.PublicKey + if n := copy(vk[:], b); n != types.PublicKeySize { return nil, fmt.Errorf("Invalid verification key size: %v", n) } - w[*types.Hash(vk[:])] = vk + w[*types.HashFn(vk[:])] = vk } } return w, nil -- cgit v1.2.3