rwx/sh/gpg.sh
2024-12-01 18:04:13 +01:00

19 lines
372 B
Bash

# bind gpg agent to current tty
rwx_gpg_agent_update() {
gpg-connect-agent \
updatestartuptty \
/bye
}
rwx_gpg_ssh_auth_sock() {
local user_id
user_id=$(id --user)
if [ "${user_id}" -ne 0 ]; then
if [ -f "${HOME}/.gnupg/gpg-agent.conf" ]; then
SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
export SSH_AUTH_SOCK
fi
fi
}
rwx_gpg_ssh_auth_sock