blob: 7c37ff5629f3483f978003b643b1146b5f0bc63e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/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 "arguments used:"
echo $commonargs
echo ""
echo "fetching sth..."
get-sth $commonargs | tee sth1.output
echo "" && $pause
echo "adding an entry..."
add-entry $commonargs \
--identifier "example.sh v0.0.1-$(cat /dev/urandom | base64 | head -c 10)" \
--checksum $(sha256sum "$0") | tee add-entry.output
echo "" && $pause
echo "fetching another sth..."
get-sth $commonargs | tee sth2.output
echo "" && $pause
echo "verifying inclusion..."
get-proof-by-hash $commonargs \
--leaf_hash $(cat add-entry.output | awk '{print $3}') \
--sth $(cat sth2.output | awk '{print $2}')
echo "" && $pause
echo "verifying consistency..."
get-consistency-proof $commonargs \
--first $(cat sth1.output | awk '{print $2}') \
--second $(cat sth2.output | awk '{print $2}')
echo "" && $pause
echo "fetching the log's first entry..."
get-entries $commonargs --start 0 --end 0
echo ""
rm *.output
cd
rmdir $tmpdir
|