diff options
| -rw-r--r-- | README.org | 12 | ||||
| -rw-r--r-- | kasi.el | 4 |
2 files changed, 16 insertions, 0 deletions
| @@ -33,6 +33,18 @@ the following format: | |||
| 33 | (extra-notes "other stuff to encrypt")) | 33 | (extra-notes "other stuff to encrypt")) |
| 34 | #+end_src | 34 | #+end_src |
| 35 | 35 | ||
| 36 | ** Accessing From Other Programs | ||
| 37 | To parse and read the values of the secret files (like ='password= or | ||
| 38 | ='username=), you can run something similar to the following command: | ||
| 39 | #+begin_src shell | ||
| 40 | emacsclient -e "(kasi-get \"category/file\" 'password)" | sed 's/^"//; s/"$//' | ||
| 41 | #+end_src | ||
| 42 | Unfortunately, I was not able to find a way to make =emacsclient= | ||
| 43 | print without the return value's type (i.e. without double quotes), | ||
| 44 | which does make this more clunky for outside Emacs. +Obviously the | ||
| 45 | solution to this is to just remove them and rewrite those programs in | ||
| 46 | Emacs Lisp.+ | ||
| 47 | |||
| 36 | ** Never Asked Questions (NAQ) | 48 | ** Never Asked Questions (NAQ) |
| 37 | *** Why should I use this over any other password manager? | 49 | *** Why should I use this over any other password manager? |
| 38 | Don't. For a serious answer, it's because this uses S-expressions for | 50 | Don't. For a serious answer, it's because this uses S-expressions for |
| @@ -77,6 +77,10 @@ Two %s are needed for password and username for now.") | |||
| 77 | (insert-file-contents file) | 77 | (insert-file-contents file) |
| 78 | (alist-get elem (read (current-buffer)))))) | 78 | (alist-get elem (read (current-buffer)))))) |
| 79 | 79 | ||
| 80 | (defun kasi-get (file elem) | ||
| 81 | "Prints decrypted element. Wrapper around kasi--get for non-Emacs use." | ||
| 82 | (kasi--get (format "%s/%s%s" kasi-dir file kasi-extension) elem)) | ||
| 83 | |||
| 80 | (defun kasi--totp (file) | 84 | (defun kasi--totp (file) |
| 81 | "Returns current TOTP code from secret file." | 85 | "Returns current TOTP code from secret file." |
| 82 | (let* ((totp-secret (kasi--get file 'totp)) | 86 | (let* ((totp-secret (kasi--get file 'totp)) |
