diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-03 10:52:40 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-03 10:52:40 +0100 |
commit | 2d6e12fd0260f8bf0f466e47767c5e68330e2bf1 (patch) | |
tree | 68d79a771e2fce6447acec038adbdd1fd053f1e5 /client | |
parent | e12192cafe7395b621e5224c95a01f27425d2118 (diff) |
added helper to load log operators from file
Diffstat (limited to 'client')
-rw-r--r-- | client/add-entry/main.go | 14 |
1 files changed, 4 insertions, 10 deletions
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) |