2018-04-27 23:56:21 +08:00
|
|
|
export GPG_TTY=$TTY
|
2010-10-15 22:50:39 +08:00
|
|
|
|
2021-10-05 19:54:53 +08:00
|
|
|
# Fix for passphrase prompt on the correct tty
|
|
|
|
# See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport
|
|
|
|
function _gpg-agent_update-tty_preexec {
|
|
|
|
gpg-connect-agent updatestartuptty /bye &>/dev/null
|
|
|
|
}
|
|
|
|
autoload -U add-zsh-hook
|
|
|
|
add-zsh-hook preexec _gpg-agent_update-tty_preexec
|
|
|
|
|
|
|
|
# If enable-ssh-support is set, fix ssh agent integration
|
|
|
|
if [[ $(gpgconf --list-options gpg-agent | awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then
|
2017-11-08 00:04:38 +08:00
|
|
|
unset SSH_AGENT_PID
|
2021-10-05 19:54:53 +08:00
|
|
|
if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then
|
|
|
|
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
|
|
|
fi
|
2013-02-21 09:46:20 +08:00
|
|
|
fi
|