1
0
ssh-askpass-pinentry/ssh-askpass

31 lines
505 B
Plaintext
Raw Normal View History

2024-04-17 22:48:21 +00:00
#!/bin/zsh
PINENTRY=@pinentry_mac@/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac
2024-04-17 23:08:33 +00:00
function send() {
print -p "$@"
read -p
}
2024-04-17 22:48:21 +00:00
coproc $PINENTRY
PINENTRY_PID=$!
trap "kill -TERM $PINENTRY_PID" INT TERM
read -p
2024-04-17 23:08:33 +00:00
send SETDESC $@
2024-04-17 22:48:21 +00:00
2024-04-17 23:08:33 +00:00
case "$@" in
"Confirm user presence"*)
send SETOK Hide
send CONFIRM --one-button
;;
*)
send GETPIN
test "${REPLY:0:3}" = ERR && { coproc : ; exit 1 }
echo ${REPLY:2}
;;
esac
2024-04-17 22:48:21 +00:00
# Close the coproc
coproc :