aboutsummaryrefslogtreecommitdiff
path: root/pkg/client/client_test.go
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2022-06-14 10:56:26 +0200
committerRasmus Dahlberg <rasmus@mullvad.net>2022-06-21 19:46:54 +0200
commitf28d4c28fc553506e01bee3488eaa772e683194b (patch)
tree4885592e8fde581457f89510a29a595a145cf676 /pkg/client/client_test.go
parente12a479eeeb787786db0acc54150c05cc7034397 (diff)
add start of a client package
To be improved and populated further. It is good enough to help us forward while prototyping primary-secondary log-go setup.
Diffstat (limited to 'pkg/client/client_test.go')
-rw-r--r--pkg/client/client_test.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go
new file mode 100644
index 0000000..98c29c9
--- /dev/null
+++ b/pkg/client/client_test.go
@@ -0,0 +1,53 @@
+package client
+
+//import (
+// "context"
+// "time"
+//
+// "git.sigsum.org/sigsum-go/internal/fmtio"
+// "git.sigsum.org/sigsum-go/pkg/log"
+// "git.sigsum.org/sigsum-go/pkg/requests"
+//)
+//
+//const (
+// //logURL = "https://poc.sigsum.org/crocodile-icefish/sigsum/v0"
+// logURL = "http://localhost:4711/crocodile-icefish/sigsum/v0"
+// logPublicKey = "4791eff3bfc17f352bcc76d4752b38c07882093a5935a84577c63de224b0f6b3"
+// userAgent = "example agent"
+//)
+//
+//func Example() {
+// log.SetLevel(log.DebugLevel)
+// ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+// defer cancel()
+//
+// logPub, err := fmtio.PublicKeyFromHex(logPublicKey)
+// if err != nil {
+// log.Fatal("%s", err.Error())
+// }
+// cli := New(Config{
+// UserAgent: userAgent,
+// LogURL: logURL,
+// LogPub: logPub,
+// })
+//
+// cth, err := cli.GetCosignedTreeHead(ctx)
+// if err != nil {
+// log.Fatal("%s", err.Error())
+// }
+//
+// log.Debug("tree size is %d", cth.TreeSize)
+//
+// leaves, err := cli.GetLeaves(ctx, requests.Leaves{0, cth.TreeSize})
+// if err != nil {
+// log.Fatal("%s", err.Error())
+// }
+//
+// for i, leaf := range leaves {
+// log.Debug("leaf %d has key hash %x", i, leaf.KeyHash[:])
+// }
+//
+// log.Debug("repeat get-leaves call from index %d to get more leaves", len(leaves))
+//
+// // Output:
+//}