ADD pinentry-rofi skeleton
This commit is contained in:
parent
53e2def637
commit
d66f9ffaa8
|
@ -0,0 +1,60 @@
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- | rofi-pinentry - a simply pinentry proxy for bitwarden
|
||||||
|
--
|
||||||
|
-- Rather than prompt the user like all the other pinentry programs, call the
|
||||||
|
-- bitwarden deamon and prompt for a password there
|
||||||
|
|
||||||
|
module Main where
|
||||||
|
|
||||||
|
import System.Exit
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
putStrLn "Hello loser"
|
||||||
|
pinentryLoop
|
||||||
|
|
||||||
|
pinentryLoop :: IO ()
|
||||||
|
pinentryLoop = do
|
||||||
|
c <- getLine
|
||||||
|
processLine $ words c
|
||||||
|
pinentryLoop
|
||||||
|
|
||||||
|
processLine :: [String] -> IO ()
|
||||||
|
processLine [] = noop
|
||||||
|
processLine ["BYE"] = exitSuccess
|
||||||
|
processLine ["GETPIN"] = getPin
|
||||||
|
|
||||||
|
-- TODO this might be important
|
||||||
|
processLine ["OPTION", o] = processOption o
|
||||||
|
|
||||||
|
-- TODO this might be important
|
||||||
|
processLine ["GETINFO", _] = noop
|
||||||
|
|
||||||
|
-- these all take one arg and should do nothing here
|
||||||
|
processLine ["SETDESC", _] = noop
|
||||||
|
processLine ["SETOK", _] = noop
|
||||||
|
processLine ["SETNOTOK", _] = noop
|
||||||
|
processLine ["SETCANCEL", _] = noop
|
||||||
|
processLine ["SETPROMPT", _] = noop
|
||||||
|
processLine ["SETERROR", _] = noop
|
||||||
|
|
||||||
|
-- CONFIRM can take a flag
|
||||||
|
processLine ["CONFIRM"] = noop
|
||||||
|
processLine ["CONFIRM", "--one-button", _] = noop
|
||||||
|
|
||||||
|
processLine ss = unknownCommand $ unwords ss
|
||||||
|
|
||||||
|
unknownCommand :: String -> IO ()
|
||||||
|
unknownCommand c = putStrLn $ "ERR 275 Unknown command " ++ c
|
||||||
|
|
||||||
|
getPin :: IO ()
|
||||||
|
getPin = undefined
|
||||||
|
|
||||||
|
processOption :: String -> IO ()
|
||||||
|
processOption = undefined
|
||||||
|
|
||||||
|
noop :: IO ()
|
||||||
|
noop = ok
|
||||||
|
|
||||||
|
ok :: IO ()
|
||||||
|
ok = putStrLn "OK"
|
|
@ -51,6 +51,15 @@ library:
|
||||||
- Rofi.Command
|
- Rofi.Command
|
||||||
|
|
||||||
executables:
|
executables:
|
||||||
|
pinentry-rofi:
|
||||||
|
main: pinentry-rofi.hs
|
||||||
|
source-dirs: app
|
||||||
|
ghc-options:
|
||||||
|
- -Wall
|
||||||
|
- -Werror
|
||||||
|
- -threaded
|
||||||
|
dependencies:
|
||||||
|
- rofi-extras
|
||||||
rofi-autorandr:
|
rofi-autorandr:
|
||||||
main: rofi-autorandr.hs
|
main: rofi-autorandr.hs
|
||||||
source-dirs: app
|
source-dirs: app
|
||||||
|
|
Loading…
Reference in New Issue