-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add keyring support #82
Comments
Hey I was working on this a few days ago. A more convenient now days is to use an auth-source retriever if the If I understand correctly the way to do this would be to set the default of those to the auth-source wrapper function. I have a prototype version of this based on the existing function of ghub here: (defun circe--ident (username network)
(format "%s^%s" username network))
(defun circe--auth-source-get (keys &rest spec)
(declare (indent 1))
(let ((plist (car (apply #'auth-source-search
(append spec (list :max 1))))))
(mapcar (lambda (k)
(plist-get plist k))
keys)))
(defun circe-pass-get (host user &optional network)
"fooobar
\fn(fn host user &optional network)"
(auth-source-forget (list :host host :user user :max 1))
(when network
(setq user (circe--ident user network)))
(let ((match (car (circe--auth-source-get (list :secret)
:host host :user user))))
(cond ((null match)
(error "Auth source empty for %s %s %s" host user network))
((functionp match)
(funcall match)) (t match)))) Right now this helper can be used as lambda when specifying any pass entry like this: :pass (lambda (host) (circe-pass-get host user "<user>")) Now any auth-source such as secrets can be used to retrieve pass for circe. |
If you need extra context, the function is called with the process buffer current and has access to buffer-local variables such as Generally, I'm against adding keyring support due to the horrible auth-source.el API (your example forgets a cached item for no apparent reason): https://old.reddit.com/r/emacs/comments/8lvda6/is_authsource_from_the_dark_side/ |
If you need extra context, the function is called with the process buffer
current and has access to buffer-local variables such as `circe-network`
(see the section it's defined in for more of those).
Hm that sound and should make everything cleaner.
Generally, I'm against adding keyring support due to the horrible API (your
example forgets a cached item for no apparent reason):
https://old.reddit.com/r/emacs/comments/8lvda6/is_authsource_from_the_dark_
side/
The post is 4 years old is it still as bad? For read-only it works fine from
my side.
|
The first point has been addressed, some new backends and minor improvements have been added, but the API is still the same. secrets.el seems to use a saner approach, but isn't nearly as useful. I just resort to calling |
Emacs have built-in interface for gnome-keyring and kwallet called secrets:
(require 'secrets)
Would be great if circe would support it so credentials could be obtained from secure, portable, DE-agnostic and program-independent storage.
The text was updated successfully, but these errors were encountered: