emma
/
protonkey
Archived
1
0
Fork 0

made better

This commit is contained in:
Emma Tebibyte 2023-01-03 20:07:44 -05:00
parent ca1cdeea5c
commit 914d1e64a2
1 changed files with 4 additions and 10 deletions

View File

@ -28,17 +28,11 @@ fi
ADDR="$1"
URL="https://api.protonmail.ch/pks/lookup?op=get&search=$ADDR"
echo "Resolving $URL..."
RESPONSE="$(curl "$URL")"
RESPONSE="$(curl -s "$URL")"
if [ "$RESPONSE" = "No key found" ]; then
printf "%s\n" "RESPONSE"
if ! printf "%s\n" "$RESPONSE" | gpg --import >/dev/null 2>&1; then
printf "%s\n" "$RESPONSE"
exit 76 # sysexits(3) EX_PROTOCOL
else
TEMPKEY=$(mktemp /tmp/pubkey-dl.XXXXXX)
printf "%s" "$RESPONSE" > "$TEMPKEY"
exit 0
fi
gpg --import "$TEMPKEY"
exit 0