summaryrefslogtreecommitdiff
path: root/lib/GnuPGAgent.hs
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2019-07-01 14:26:58 -0400
committerAndrew Cady <d@jerkface.net>2019-07-01 14:26:58 -0400
commitae8792ee7c51da15e52f30475c17ce589f940509 (patch)
tree9bfc899bcbe92e2deaa8023de3453e73cd8f99f2 /lib/GnuPGAgent.hs
parentd35abcac585348a6a20680cdc7915d8d99626b6e (diff)
add type signatures
Diffstat (limited to 'lib/GnuPGAgent.hs')
-rw-r--r--lib/GnuPGAgent.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/GnuPGAgent.hs b/lib/GnuPGAgent.hs
index 18f1c25..2a68b4e 100644
--- a/lib/GnuPGAgent.hs
+++ b/lib/GnuPGAgent.hs
@@ -119,6 +119,7 @@ percentPlusEscape s = do
119 _ | c < ' ' -> printf "%%%02X" (ord c) 119 _ | c < ' ' -> printf "%%%02X" (ord c)
120 _ -> return c 120 _ -> return c
121 121
122clearPassphrase :: GnuPGAgent -> Packet -> IO ()
122clearPassphrase agent key = do 123clearPassphrase agent key = do
123 let cmd = "clear_passphrase --mode=normal "++fingerprint key 124 let cmd = "clear_passphrase --mode=normal "++fingerprint key
124 hPutStrLn (agentHandle agent) cmd 125 hPutStrLn (agentHandle agent) cmd
@@ -164,6 +165,7 @@ getPassphrase agent ask (Query key uid masterkey) = do
164#endif 165#endif
165 "ERR" -> return Nothing 166 "ERR" -> return Nothing
166 167
168quit :: GnuPGAgent -> IO ()
167quit (GnuPGAgent h) = hClose h 169quit (GnuPGAgent h) = hClose h
168 170
169prompts :: Packet -> String -> Maybe Packet -> (String,String,String) 171prompts :: Packet -> String -> Maybe Packet -> (String,String,String)
@@ -203,6 +205,7 @@ gpgHomeSpec = HomeDir
203 , appdir = ".gnupg" 205 , appdir = ".gnupg"
204 } 206 }
205 207
208envhomedir :: Maybe [Char] -> HomeDir -> IO (Maybe [Char])
206envhomedir opt home = do 209envhomedir opt home = do
207 gnupghome <- fmap (mfilter (/="")) $ lookupEnv (homevar home) 210 gnupghome <- fmap (mfilter (/="")) $ lookupEnv (homevar home)
208 homed <- fmap (mfilter (/="") . Just) getHomeDirectory 211 homed <- fmap (mfilter (/="") . Just) getHomeDirectory
@@ -242,6 +245,7 @@ curve_oid_nbits (MPI 0x2b8104000a ) = 256 -- SEC p256k1 ( bitcoin curve )
242curve_oid_nbits n = trace ("Unknown curve: "++ show n) 0 245curve_oid_nbits n = trace ("Unknown curve: "++ show n) 0
243 246
244 247
248mpi_nbits :: Num a => MPI -> a
245mpi_nbits (MPI n) = 8 * fromIntegral len 249mpi_nbits (MPI n) = 8 * fromIntegral len
246 where 250 where
247 len = case encode_bigendian n of 251 len = case encode_bigendian n of