Hey gang!
So I’ve used gopass for awhile now, and Emacs for longer.
I was wondering if any of you here interact with gopass via Emacs with auth-source
or something similar.
The main reason I ask is because I’m wanting to finally use Emacs for other things, such as an IRC client and making more use of Magit, and even writing with 750words.
A lot of my passwords are stored with gopass, and the structure isn’t always the same for stores. For instance:
| Forums
|-- Gentoo
|-- Some other forum
|
| Email Host
|-- email-address@somewhere.com
|---- password
|---- recovery codes
|
| Employer Name
|-- Some program we use at work
|---- myworkemail@work-site.com
|
| Some app
|-- My User Name
Maybe this structure for a password store is a no-no, though it’s not a big deal to move things around.
Any tips? I’ve seen auth-source-gopass
, but that doesn’t provide any interaction with selection of passwords or creation of passwords, I think.
I’ve look at that mentioned library some and writing an auth-source
backend doesn’t seem too involved, but maybe I don’t necessarily have to with auth-source
.
EDIT:
A potential configuration that others might use:
(require 'consult)
(require 'auth-source-pass)
(use-package pass
:requires password-store
:preface
(defvar consult:pass-source
`(:name "Passwords"
:narrow ?< ;; maybe you want something else for narrow?
:face pass-mode-directory-face ;; maybe you want to use a different face?
:category pass
:enabled
,(lambda ()
(auth-source-pass-file-name-p auth-source-pass-filename))
:items ,#'password-store-list)
"Consult source for passwords with (go)pass.")
(defun consult:pass (arg pass)
"Stolen from Doom Emacs.
https://github.com/doomemacs/doomemacs/blob/master/modules/tools/pass/autoload/consult.el"
(interactive
(list current-prefix-arg
(progn
(require 'consult)
(consult--read consult:pass-source
:prompt "(Go)Pass: "
:sort nil
:require-match t
:category 'pass))))
(funcall (if arg
#'password-store-url
#'password-store-copy)
pass))
:custom
(password-store-executable (executable-find "gopass"))
(auth-source-pass-filename
(or (getenv "PASSWORD_STORE_DIR")
(expand-file-name "~/.local/share/gopass/stores/root")))
:config
(auth-source-pass-enable))
I guess I’m supposed to know what gopass is. Is it this? https://github.com/gopasspw/gopass
Yes, should’ve mentioned that in my post.
I am only a casual user of it but pass.el (also in MELPA) works for me. This is for the original
pass
but sincegopass
is highly compatible it seems to work for that too. It usespassword-store.el
under the hood so you’d do something like(setq password-store-executable "/path/to/gopass")
to point it at the right executable.Interesting. Do you enable the
auth-source
backend for pass as well?Funnily enough, it seems Nicholas Petton (creator of the pass.el library) contributed to this. :)
I don’t use that but looking at the source it looks like it’s accessing the password store directly by reading the gpg files so I’d expect it to work the same regardless of the pass implementation used.