Last active
February 28, 2024 16:55
-
-
Save mrgrain/9c3519952d9af811bd7bf50bfcfaa16f to your computer and use it in GitHub Desktop.
1Password CLI pinentry for gpg-agent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
COMMAND="op read $OP_PIN_ITEM" | |
echo "OK" | |
while read cmd rest; do | |
echo "cmd=$cmd rest=$rest" >&2 | |
echo "cmd=$cmd rest=$rest" >> $LOG | |
case "$cmd" in | |
\#*) | |
echo "OK" | |
;; | |
GETPIN) | |
PASSPHRASE=${PASSPHRASE-`$COMMAND`} | |
echo "D ${PASSPHRASE}" | |
echo "OK" | |
;; | |
BYE) | |
echo "OK" | |
exit 0 | |
;; | |
*) | |
echo "OK" | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
slightly adjusted fish version: