ADD pinentry-rofi skeleton

This commit is contained in:
Nathan Dwarshuis 2021-06-25 23:42:29 -04:00
parent 53e2def637
commit d66f9ffaa8
2 changed files with 69 additions and 0 deletions

60
app/pinentry-rofi.hs Normal file
View File

@ -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"

View File

@ -51,6 +51,15 @@ library:
- Rofi.Command
executables:
pinentry-rofi:
main: pinentry-rofi.hs
source-dirs: app
ghc-options:
- -Wall
- -Werror
- -threaded
dependencies:
- rofi-extras
rofi-autorandr:
main: rofi-autorandr.hs
source-dirs: app