Skip to content

Commit

Permalink
example.sh: Show jwk during example output
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Collins <[email protected]>
  • Loading branch information
benmcollins committed Feb 13, 2025
1 parent 546ce33 commit db9f17c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tools/example.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

if command -v jq > /dev/null; then
JQ="--print=jq -C"
fi

KEY=jwt-test-key.bin
JWK=jwk-test-key.json

Expand All @@ -11,6 +15,11 @@ fi
if [ ! -e "$JWK" ]; then
echo Converting key to JWK
key2jwk -o "${JWK}" "${KEY}"
if [ -n "$JQ" ]; then
cat "${JWK}" | jq -C
else
cat "${JWK}"
fi
fi

TOKEN=jwt-test-token
Expand All @@ -26,9 +35,5 @@ jwt-generate -k "${JWK}" \
-c s:user=bcollins \
-c i:exp=${EXP} > ${TOKEN}

if command -v jq > /dev/null; then
JQ="--print=jq -C"
fi

echo Verifying token
cat ${TOKEN} | jwt-verify -k "${JWK}" "${JQ}" -v -

0 comments on commit db9f17c

Please sign in to comment.