Auth extension has been added
This commit is contained in:
parent
27bde6b87d
commit
031cbfd031
|
@ -74,7 +74,7 @@
|
|||
;; specific tools (lein in this case) in your exec-path.
|
||||
|
||||
|
||||
;; IRC Extension configuration
|
||||
;; IRC Extension configuration ------------------------------------------------
|
||||
;; Setup all the servers and channels you need
|
||||
;; (setq irc-servers
|
||||
;; '(("irc.freenode.net"
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
;;; Auth --- Secret management extension for FG42
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/extension)
|
||||
(require 'extensions/auth/init)
|
||||
|
||||
;; Dependencies ----------------------------------
|
||||
(depends-on 'rcauth-notify)
|
||||
|
||||
(defun auth-doc ()
|
||||
"TBD"
|
||||
"TBD")
|
||||
|
||||
;; Extension -------------------------------------
|
||||
(extension auth
|
||||
:version "2.32"
|
||||
:on-initialize extensions/auth-initialize
|
||||
:docs "lib/extensions/auth/readme.org")
|
||||
|
||||
(provide 'extensions/auth)
|
||||
;;; auth.el ends here
|
|
@ -0,0 +1,44 @@
|
|||
;;; Auth --- Secret management extension for FG42
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'auth-source)
|
||||
|
||||
(defvar auht/sources '((:sources "~/.authinfo.gpg")))
|
||||
|
||||
(defun auth/find-credential (host)
|
||||
"Find the credential for the given HOST.
|
||||
Return a list of credential pairs."
|
||||
(let (auth-list '())
|
||||
(dolist (cred (auth-source-search :host host
|
||||
:require '(:user :secret)))
|
||||
(let ((user (plist-get cred :user))
|
||||
(secret (plist-get cred :secret)))
|
||||
(add-to-list 'auth-list
|
||||
(list user
|
||||
(if (functionp secret)
|
||||
(funcall secret)
|
||||
secret)))))
|
||||
auth-list))
|
||||
|
||||
(defun utils/bold (text)
|
||||
"Make the TEXT appears in bold form."
|
||||
(propertize text 'face 'bold))
|
||||
|
||||
|
||||
(defun auth/credential-for (args host)
|
||||
"Return the credential for the given HOST.
|
||||
ARGS should be ignored."
|
||||
(interactive "P\nsHost: ")
|
||||
(dolist (pair (auth/find-credential host))
|
||||
(message (concat "User: " (utils/bold (car pair))
|
||||
" Passowrd: " (utils/bold(car (cdr pair)))))))
|
||||
|
||||
(auth/credential-for nil "freenode")
|
||||
(auth/find-credential "freenode")
|
||||
|
||||
(defun extensions/irc-initialize ()
|
||||
"Initialize the Auth extension."
|
||||
(setq auth-sources auth/sources))
|
||||
|
||||
(provide 'extensions/irc/init)
|
||||
;;; init.el ends here
|
|
@ -64,9 +64,6 @@ It returns nil if no password is available."
|
|||
(rcirc-track-minor-mode 1)
|
||||
(rcirc nil))
|
||||
|
||||
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun extensions/irc-initialize ()
|
||||
"Initialize the irc extention."
|
||||
|
|
Loading…
Reference in New Issue