diff options
author | Andrew Cady <d@jerkface.net> | 2019-07-01 14:26:58 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2019-07-01 14:26:58 -0400 |
commit | ae8792ee7c51da15e52f30475c17ce589f940509 (patch) | |
tree | 9bfc899bcbe92e2deaa8023de3453e73cd8f99f2 /lib/GnuPGAgent.hs | |
parent | d35abcac585348a6a20680cdc7915d8d99626b6e (diff) |
add type signatures
Diffstat (limited to 'lib/GnuPGAgent.hs')
-rw-r--r-- | lib/GnuPGAgent.hs | 4 |
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 | ||
122 | clearPassphrase :: GnuPGAgent -> Packet -> IO () | ||
122 | clearPassphrase agent key = do | 123 | clearPassphrase 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 | ||
168 | quit :: GnuPGAgent -> IO () | ||
167 | quit (GnuPGAgent h) = hClose h | 169 | quit (GnuPGAgent h) = hClose h |
168 | 170 | ||
169 | prompts :: Packet -> String -> Maybe Packet -> (String,String,String) | 171 | prompts :: Packet -> String -> Maybe Packet -> (String,String,String) |
@@ -203,6 +205,7 @@ gpgHomeSpec = HomeDir | |||
203 | , appdir = ".gnupg" | 205 | , appdir = ".gnupg" |
204 | } | 206 | } |
205 | 207 | ||
208 | envhomedir :: Maybe [Char] -> HomeDir -> IO (Maybe [Char]) | ||
206 | envhomedir opt home = do | 209 | envhomedir 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 ) | |||
242 | curve_oid_nbits n = trace ("Unknown curve: "++ show n) 0 | 245 | curve_oid_nbits n = trace ("Unknown curve: "++ show n) 0 |
243 | 246 | ||
244 | 247 | ||
248 | mpi_nbits :: Num a => MPI -> a | ||
245 | mpi_nbits (MPI n) = 8 * fromIntegral len | 249 | mpi_nbits (MPI n) = 8 * fromIntegral len |
246 | where | 250 | where |
247 | len = case encode_bigendian n of | 251 | len = case encode_bigendian n of |