Get keys from auth source
This commit is contained in:
parent
7b8f5b054a
commit
4cb806633a
1 changed files with 16 additions and 0 deletions
|
@ -208,3 +208,19 @@
|
|||
(interactive "sEnter the URL to mirror: ")
|
||||
(let ((cmd (format "wget --mirror --convert-links --adjust-extension --page-requisites --no-parent %s" url)))
|
||||
(async-shell-command cmd)))
|
||||
|
||||
(defun mk/get-auth-source-key (host key)
|
||||
"Retrieve the API key using 'auth-source'."
|
||||
(require 'auth-source)
|
||||
(let* ((auth-source-creation-prompts
|
||||
'((secret . (format "API key for %s@%s: " key host))))
|
||||
(found (nth 0 (auth-source-search
|
||||
:max 1
|
||||
:host host
|
||||
:user key
|
||||
:require '(:secret)
|
||||
:create t)))
|
||||
(secret (plist-get found :secret)))
|
||||
(if (functionp secret)
|
||||
(funcall secret)
|
||||
secret)))
|
||||
|
|
Loading…
Add table
Reference in a new issue