diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2021-03-16 00:26:07 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2021-03-16 00:26:07 +0100 |
commit | 9f7690327f8d74abdd86232546a154ab8408d174 (patch) | |
tree | 0abeaade1c7673579c1b6a76cd4c6c25395555ee /client/cmd/get-sth | |
parent | e2959d506de6067afe494315c3621b33613b5414 (diff) |
started to re-add basic client commands
Diffstat (limited to 'client/cmd/get-sth')
-rw-r--r-- | client/cmd/get-sth/main.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/client/cmd/get-sth/main.go b/client/cmd/get-sth/main.go new file mode 100644 index 0000000..6b23b06 --- /dev/null +++ b/client/cmd/get-sth/main.go @@ -0,0 +1,35 @@ +package main + +import ( + "context" + "flag" + "fmt" + + "encoding/base64" + + "github.com/golang/glog" + "github.com/system-transparency/stfe/client" + "github.com/system-transparency/stfe/types" +) + +func main() { + flag.Parse() + defer glog.Flush() + + client, err := client.NewClientFromFlags() + if err != nil { + glog.Errorf("NewClientFromFlags: %v", err) + return + } + sth, err := client.GetLatestSth(context.Background()) + if err != nil { + glog.Errorf("GetLatestSth: %v", err) + return + } + serialized, err := types.Marshal(*sth) + if err != nil { + glog.Errorf("Marshal: %v", err) + return + } + fmt.Println("sth:", base64.StdEncoding.EncodeToString(serialized)) +} |