Skip to content
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 support for copying otp token #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ The default action is to copy the password to the kill ring.
- add an entry (=a=)
- rename an entry (=r=)
- generate a new entry (=g=)
- copy an entry's otp token (=!=)
11 changes: 10 additions & 1 deletion ivy-pass.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
;; - add an entry (a)
;; - rename an entry (r)
;; - generate a new entry (g)
;; - copy an entry's otp token (!)

;;; Code:
(require 'ivy)
(require 'password-store)
(require 'password-store-otp)

(defvar ivy-pass-map (make-sparse-keymap))

Expand All @@ -48,7 +50,10 @@
"rename")
("g"
ivy-pass--generate-action
"generate")))
"generate")
("!"
ivy-pass--copy-otp-token-action
"copy otp token")))

(defun ivy-pass--add-action (key)
"Ask for a new key based on KEY, then edit it."
Expand Down Expand Up @@ -81,6 +86,10 @@ Default PASSWORD-LENGTH is ‘password-store-password-length’."
"Add password for KEY to kill ring."
(password-store-copy key))

(defun ivy-pass--copy-otp-token-action (key)
"Copy password otp for KEY to kill ring."
(password-store-otp-token-copy key))

;;;###autoload
(defun ivy-pass ()
"Select an entry and copy its password to the kill ring."
Expand Down