Enabling pinentry in Doom Emacs

I sometimes use emacs remotely via mosh, and in those situations I cannot depend on the graphical pinentry. Fortunately, the pinentry package (available at GNU ELPA) enables emacs to talk the pinentry protocol, and interface with the gpg-agent directly.

I found useful instructions to set it up under Doom Emacs on its GitHub issue #4647, with minor adjustments:

Code Snippet 1: ~/.gnupg/gpg-agent.conf

(package! pinentry)
Code Snippet 2: ~/.config/doom/packages.el

(use-package! pinentry
    :init (setq epg-pinentry-mode `loopback)
Code Snippet 3: ~/.config/doom/config.el
Tags doom emacs gnupg
pancho horrillo
I do things with computers.