From 2d6e12fd0260f8bf0f466e47767c5e68330e2bf1 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Tue, 3 Nov 2020 10:52:40 +0100 Subject: added helper to load log operators from file --- client/add-entry/main.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'client') diff --git a/client/add-entry/main.go b/client/add-entry/main.go index 9047529..60fabf8 100644 --- a/client/add-entry/main.go +++ b/client/add-entry/main.go @@ -6,8 +6,6 @@ import ( "fmt" "encoding/base64" - "encoding/json" - "io/ioutil" "net/http" "github.com/golang/glog" @@ -62,21 +60,17 @@ func params() ([]byte, []byte, error) { func setup() (*client.Client, error) { c, err := stfe.LoadChain(*chain) if err != nil { - return nil, fmt.Errorf("failed loading certificate chain: %v", err) + return nil, err } k, err := stfe.LoadEd25519SigningKey(*key) if err != nil { - return nil, fmt.Errorf("failed loading key: %v", err) + return nil, err } - blob, err := ioutil.ReadFile(*operators) + ops, err := descriptor.LoadOperators(*operators) if err != nil { - return nil, fmt.Errorf("failed reading log operators: %v", err) - } - var ops []descriptor.Operator - if err := json.Unmarshal(blob, &ops); err != nil { - return nil, fmt.Errorf("failed decoding log operators: %v", err) + return nil, err } id, err := base64.StdEncoding.DecodeString(*logId) -- cgit v1.2.3