LoginSignup
4
4

More than 5 years have passed since last update.

emacs lisp で keychain から password とりだす

Last updated at Posted at 2018-10-31

auth-source.el をつかいます。(標準 elisp)

たとえば

security add-generic-password -a hogetarou -w PASSWORD -s myservice

で保存したものは

(let ((auth-sources '(macos-keychain-generic))
      (cred (auth-source-search :max 1 :user "hogetarou" :require '(:secret))))
  (unless (null cred)
    (setq my-secret (funcall (plist-get (nth 0 cred) :secret)))))

で。

auth-sources に設定できる keychain の種類には macos-keychain-internet ってのもあるので、web のログイン情報とかもとれる

tramp は auth-source つかってくれるので、auth-sources に設定してアレばそっちをみにいってくれれ幸せになる人もいる

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4