aboutsummaryrefslogtreecommitdiff
path: root/client/get-anchors/main.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-03-16 00:26:07 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-03-16 00:26:07 +0100
commit9f7690327f8d74abdd86232546a154ab8408d174 (patch)
tree0abeaade1c7673579c1b6a76cd4c6c25395555ee /client/get-anchors/main.go
parente2959d506de6067afe494315c3621b33613b5414 (diff)
started to re-add basic client commands
Diffstat (limited to 'client/get-anchors/main.go')
-rw-r--r--client/get-anchors/main.go54
1 files changed, 0 insertions, 54 deletions
diff --git a/client/get-anchors/main.go b/client/get-anchors/main.go
deleted file mode 100644
index 1c10924..0000000
--- a/client/get-anchors/main.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package main
-
-import (
- "context"
- "flag"
- "fmt"
-
- "encoding/base64"
- "net/http"
-
- "github.com/golang/glog"
- "github.com/system-transparency/stfe/client"
- "github.com/system-transparency/stfe/descriptor"
-)
-
-var (
- operators = flag.String("operators", "../../descriptor/stfe.json", "path to json-encoded list of log operators")
- logId = flag.String("log_id", "AAEgFKl1V+J3ib3Aav86UgGD7GRRtcKIdDhgc0G4vVD/TGc=", "base64-encoded log identifier")
-)
-
-func main() {
- flag.Parse()
-
- client, err := client.NewClient(mustLoad(*operators, *logId), &http.Client{}, true, nil)
- if err != nil {
- glog.Fatal(err)
- }
-
- namespaces, err := client.GetNamespaces(context.Background())
- if err != nil {
- glog.Fatal(err)
- }
- for i, namespace := range namespaces {
- fmt.Printf("namespace[%d]: %s\n", i, base64.StdEncoding.EncodeToString(namespace))
- }
-
- glog.Flush()
-}
-
-func mustLoad(operators, logId string) *descriptor.Log {
- ops, err := descriptor.LoadOperators(operators)
- if err != nil {
- glog.Fatalf("failed loading log operators: %v")
- }
- id, err := base64.StdEncoding.DecodeString(logId)
- if err != nil {
- glog.Fatalf("invalid base64 log id: %v", err)
- }
- log, err := descriptor.FindLog(ops, id)
- if err != nil {
- glog.Fatalf("unknown log id: %v", err)
- }
- return log
-}