go-tools/verify.sh

28 lines
538 B
Bash
Raw Normal View History

2024-03-24 15:19:26 -06:00
#!/bin/bash
AUTH=xuu:zero-punish-whenever-swell
SSH_PUB=~/.ssh/id_ed25519.pub
MERCURY_URL=localhost:4088/v1/mercury/config
AUTHFILE=$(mktemp)
CFGFILE=$(mktemp)
SIGFILE=$(mktemp)
(echo -n "user "; cat "$SSH_PUB") > "$AUTHFILE"
http \
--auth "$AUTH" \
GET "$MERCURY_URL" \
space=="$1" |\
tee "$CFGFILE" |\
sed -n '/^----/,$p' > "$SIGFILE"
sed '/^----/,$d' "$CFGFILE" |\
ssh-keygen -Y verify \
-f "$AUTHFILE" \
-I user \
-n file \
-s "$SIGFILE"
rm "$AUTHFILE" "$SIGFILE" "$CFGFILE"