Skip to content

Commit

Permalink
Support OTP in XMonad.Prompt.Pass
Browse files Browse the repository at this point in the history
update CHANGES.md
  • Loading branch information
rhariady committed Apr 5, 2019
1 parent 22e6d4b commit c3cee11
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
using tab to wrap around the completion rows would fail when maxComplRows is
restricting the number of rows of output.

* `XMonad.Prompt.Pass`

Added 'passOTPPrompt' to support getting OTP type password. This require
pass-otp (https://github.com/tadfisher/pass-otp) has been setup in the running
machine.

* `XMonad.Actions.DynamicProjects`

Make the input directory read from the prompt in `DynamicProjects`
Expand Down
11 changes: 11 additions & 0 deletions XMonad/Prompt/Pass.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module XMonad.Prompt.Pass (
-- * Usage
-- $usage
passPrompt
, passOTPPrompt
, passGeneratePrompt
, passRemovePrompt
, passEditPrompt
Expand Down Expand Up @@ -125,6 +126,11 @@ mkPassPrompt promptLabel passwordFunction xpconfig = do
passPrompt :: XPConfig -> X ()
passPrompt = mkPassPrompt "Select password" selectPassword

-- | A prompt to retrieve a OTP from a given entry.
--
passOTPPrompt :: XPConfig -> X ()
passOTPPrompt = mkPassPrompt "Select OTP" selectOTP

-- | A prompt to generate a password for a given entry.
-- This can be used to override an already stored entry.
-- (Beware that no confirmation is asked)
Expand Down Expand Up @@ -155,6 +161,11 @@ passEditPrompt = mkPassPrompt "Edit password" editPassword
selectPassword :: String -> X ()
selectPassword passLabel = spawn $ "pass --clip \"" ++ escapeQuote passLabel ++ "\""

-- | Select a OTP.
--
selectOTP :: String -> X ()
selectOTP passLabel = spawn $ "pass otp --clip \"" ++ escapeQuote passLabel ++ "\""

-- | Generate a 30 characters password for a given entry.
-- If the entry already exists, it is updated with a new password.
--
Expand Down

0 comments on commit c3cee11

Please sign in to comment.