aboutsummaryrefslogtreecommitdiff
path: root/server/testdata/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'server/testdata/cmd')
-rwxr-xr-xserver/testdata/cmd/add-entry13
-rw-r--r--server/testdata/cmd/config11
-rwxr-xr-xserver/testdata/cmd/get-anchors8
-rwxr-xr-xserver/testdata/cmd/get-entries15
-rwxr-xr-xserver/testdata/cmd/get-proof-by-hash15
5 files changed, 55 insertions, 7 deletions
diff --git a/server/testdata/cmd/add-entry b/server/testdata/cmd/add-entry
index d7346bb..9efd3bf 100755
--- a/server/testdata/cmd/add-entry
+++ b/server/testdata/cmd/add-entry
@@ -1,20 +1,20 @@
#!/bin/bash
set -eo pipefail
+source config
algo=ecdsa
key_path="../chain/rgdd-$algo.key"
cert_path="../chain/rgdd-$algo.pem"
-name="foobar-0.0.1"
+name="foobar-1.2.3"
if [[ ! -z $1 ]]; then
name=$1
fi
-echo "[Info] package name: $name" >&2
+info "package name: $name"
-
-echo "[Info] generating StItem and signature..." >&2
pushd ../entry >/dev/null
+ info "generating base64-encoded StItem and signature"
go run . --dir stitem --name $name
openssl dgst -sha256 -sign $key_path -out stitem/$name.sig stitem/$name
openssl base64 -A -in stitem/$name -out stitem/$name.b64
@@ -29,6 +29,5 @@ pushd ../entry >/dev/null
rm -f stitem/$name{,.sig,.b64,.sig.b64}
popd >/dev/null
-echo "[Info] doing add-entry request"
-curl --header "application/json" --request POST --data $json\
- localhost:6965/st/v1/add-entry
+info "sending add-entry request"
+curl --header "application/json" --request POST --data $json $base_url/add-entry
diff --git a/server/testdata/cmd/config b/server/testdata/cmd/config
new file mode 100644
index 0000000..8138319
--- /dev/null
+++ b/server/testdata/cmd/config
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+export base_url='localhost:6965/st/v1'
+
+function info() {
+ echo "[Info] $@" 1>&2
+}
+
+function newline() {
+ echo ""
+}
diff --git a/server/testdata/cmd/get-anchors b/server/testdata/cmd/get-anchors
new file mode 100755
index 0000000..c5000a8
--- /dev/null
+++ b/server/testdata/cmd/get-anchors
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -eo pipefail
+source config
+
+info "downloading trust anchors"
+curl -G $url
+newline
diff --git a/server/testdata/cmd/get-entries b/server/testdata/cmd/get-entries
new file mode 100755
index 0000000..b0075ab
--- /dev/null
+++ b/server/testdata/cmd/get-entries
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -eo pipefail
+source config
+
+first=0
+second=0
+if [[ ! -z $1 ]] && [[ ! -z $2 ]]; then
+ first=$1
+ second=$2
+fi
+
+info "downloading entries [$first, $second]"
+curl -G -d "start=$first" -d "end=$second" $base_url/get-entries
+newline
diff --git a/server/testdata/cmd/get-proof-by-hash b/server/testdata/cmd/get-proof-by-hash
new file mode 100755
index 0000000..9d3221e
--- /dev/null
+++ b/server/testdata/cmd/get-proof-by-hash
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -eo pipefail
+source config
+
+tree_size=2
+hash_b64="Fl5eY9cAOz9A9c9j3Uibia3YfBxeGH5KQJg5BMIqNrA="
+if [[ ! -z $1 ]] && [[ ! -z $2 ]]; then
+ tree_size=$1
+ hash_b64=$2
+fi
+
+info "fetching proof($hash_b64) against size $tree_size"
+curl -G -d "tree_size=$tree_size" -d "hash=$hash_b64" $base_url/get-proof-by-hash
+newline