aboutsummaryrefslogtreecommitdiff
path: root/client/cmd
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2021-03-23 03:10:24 +0100
committerLinus Nordberg <linus@nordberg.se>2021-03-23 03:10:24 +0100
commit569ef0b9a4b16a1b4c7011653ea4443e41ca74c1 (patch)
treea64a7454fcb6afad030a9181bd398acfc1c60c81 /client/cmd
parent9a6407c0a96ee3b6f2915dab8ea333eb3f6c46f8 (diff)
parametrise namespace
Also streamline the usage a bit: - more easily configured log_url - use a tempdir - log less
Diffstat (limited to 'client/cmd')
-rwxr-xr-xclient/cmd/example.sh36
1 files changed, 24 insertions, 12 deletions
diff --git a/client/cmd/example.sh b/client/cmd/example.sh
index beac26e..73395ad 100755
--- a/client/cmd/example.sh
+++ b/client/cmd/example.sh
@@ -1,33 +1,45 @@
#!/bin/bash
+set -eu
+
+log_url=http://tlog-poc.system-transparency.org:4780/st/v1
+
+ns="$1"; shift
+tmpdir=$(mktemp -dt stfe.XXXXXXXX)
+cd $tmpdir
+
+commonargs="--log_id $ns --log_url $log_url" # --logtostderr -v 3
+pause="sleep 1"
echo "fetching sth..."
-go run get-sth/main.go --logtostderr -v 3 | tee sth1.output
-echo "" && sleep 1
+get-sth $commonargs | tee sth1.output
+echo "" && $pause
echo "adding an entry..."
-go run add-entry/main.go --logtostderr -v 3 \
+add-entry $commonargs \
--identifier "example.sh v0.0.1-$(cat /dev/urandom | base64 | head -c 10)" \
- --checksum $(sha256sum example.sh) | tee add-entry.output
-echo "" && sleep 1
+ --checksum $(sha256sum "$0") | tee add-entry.output
+echo "" && $pause
echo "fetching another sth..."
-go run get-sth/main.go --logtostderr -v 3 | tee sth2.output
-echo "" && sleep 1
+get-sth $commonargs | tee sth2.output
+echo "" && $pause
echo "verifying inclusion..."
-go run get-proof-by-hash/main.go --logtostderr -v 3 \
+get-proof-by-hash $commonargs \
--leaf_hash $(cat add-entry.output | awk '{print $3}') \
--sth $(cat sth2.output | awk '{print $2}')
-echo "" && sleep 1
+echo "" && $pause
echo "verifying consistency..."
-go run get-consistency-proof/main.go --logtostderr -v 3 \
+get-consistency-proof $commonargs \
--first $(cat sth1.output | awk '{print $2}') \
--second $(cat sth2.output | awk '{print $2}')
-echo "" && sleep 1
+echo "" && $pause
echo "fetching the log's first entry..."
-go run get-entries/main.go --logtostderr -v 3 --start 0 --end 0
+get-entries $commonargs --start 0 --end 0
echo ""
rm *.output
+cd
+rmdir $tmpdir