Browse Source

Support OTP in XMonad.Prompt.Pass

update CHANGES.md
master
Ricky Hariady 2 months ago
parent
commit
c3cee11ad6
2 changed files with 17 additions and 0 deletions
  1. 6
    0
      CHANGES.md
  2. 11
    0
      XMonad/Prompt/Pass.hs

+ 6
- 0
CHANGES.md View File

@@ -50,6 +50,12 @@
50 50
     using tab to wrap around the completion rows would fail when maxComplRows is
51 51
     restricting the number of rows of output.
52 52
 
53
+  * `XMonad.Prompt.Pass`
54
+
55
+    Added 'passOTPPrompt' to support getting OTP type password. This require
56
+    pass-otp (https://github.com/tadfisher/pass-otp) has been setup in the running
57
+    machine.
58
+
53 59
   * `XMonad.Actions.DynamicProjects`
54 60
 
55 61
     Make the input directory read from the prompt in `DynamicProjects`

+ 11
- 0
XMonad/Prompt/Pass.hs View File

@@ -44,6 +44,7 @@ module XMonad.Prompt.Pass (
44 44
                             -- * Usage
45 45
                             -- $usage
46 46
                               passPrompt
47
+                            , passOTPPrompt
47 48
                             , passGeneratePrompt
48 49
                             , passRemovePrompt
49 50
                             , passEditPrompt
@@ -125,6 +126,11 @@ mkPassPrompt promptLabel passwordFunction xpconfig = do
125 126
 passPrompt :: XPConfig -> X ()
126 127
 passPrompt = mkPassPrompt "Select password" selectPassword
127 128
 
129
+-- | A prompt to retrieve a OTP from a given entry.
130
+--
131
+passOTPPrompt :: XPConfig -> X ()
132
+passOTPPrompt = mkPassPrompt "Select OTP" selectOTP
133
+
128 134
 -- | A prompt to generate a password for a given entry.
129 135
 -- This can be used to override an already stored entry.
130 136
 -- (Beware that no confirmation is asked)
@@ -155,6 +161,11 @@ passEditPrompt = mkPassPrompt "Edit password" editPassword
155 161
 selectPassword :: String -> X ()
156 162
 selectPassword passLabel = spawn $ "pass --clip \"" ++ escapeQuote passLabel ++ "\""
157 163
 
164
+-- | Select a OTP.
165
+--
166
+selectOTP :: String -> X ()
167
+selectOTP passLabel = spawn $ "pass otp --clip \"" ++ escapeQuote passLabel ++ "\""
168
+
158 169
 -- | Generate a 30 characters password for a given entry.
159 170
 -- If the entry already exists, it is updated with a new password.
160 171
 --

Loading…
Cancel
Save