Skip to content

Commit

Permalink
test: api accepted unhexed key
Browse files Browse the repository at this point in the history
  • Loading branch information
MalinAhlberg committed Oct 21, 2024
1 parent 068a9c6 commit b6b5fcd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/integration/tests/sda/20_ingest-verify_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ cd shared || true

token="$(curl http://oidc:8080/tokens | jq -r '.[0]')"
# we need to insert the key hash into the db before ingesting files
# decode from base64, then hex encode the public key
key="$(head -n2 /shared/c4gh.pub.pem | tail -n1 | base64 -d | xxd -p | tr -d '\n')"
response=$(curl -s -w "%{http_code}" -k -L "http://api:8080/c4gh-keys/add" -H "Authorization: Bearer $token" -d "{\"hash\": \"$key\", \"description\": \"first key\"}")
key="$(base64 -w0 /shared/c4gh.pub.pem)"
response=$(curl -s -w "%{http_code}" -k -L "http://api:8080/c4gh-keys/add" -H "Authorization: Bearer $token" -d "{\"pubkey\": \"$key\", \"description\": \"first key\"}")
# fe92e95f37b522d06d68aa00ccd74b930f150dafd23d0f512fdbf43de4eb2c41 by ingest
# Extract the 3 last characters, ie the status code
status=$(printf "%s" "$response" | tail -c 3)
if [ "$status" -ne "200" ] && [ "$status" -ne "409" ]; then
Expand Down

0 comments on commit b6b5fcd

Please sign in to comment.