diff options
Diffstat (limited to 'lib/Kiki.hs')
-rw-r--r-- | lib/Kiki.hs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/Kiki.hs b/lib/Kiki.hs index f89aad2..96ad9ff 100644 --- a/lib/Kiki.hs +++ b/lib/Kiki.hs | |||
@@ -49,7 +49,7 @@ import qualified SSHKey as SSH | |||
49 | import CommandLine | 49 | import CommandLine |
50 | import DotLock | 50 | import DotLock |
51 | import GnuPGAgent (Query (..)) | 51 | import GnuPGAgent (Query (..)) |
52 | import qualified IntMapClass as I | 52 | -- import qualified IntMapClass as I |
53 | import KeyRing hiding (pemFromPacket) | 53 | import KeyRing hiding (pemFromPacket) |
54 | import KeyDB | 54 | import KeyDB |
55 | import KeyRing.BuildKeyDB (gpgipv6addr, Hostnames, allNames) | 55 | import KeyRing.BuildKeyDB (gpgipv6addr, Hostnames, allNames) |
@@ -104,7 +104,22 @@ refresh root homepass = do | |||
104 | KikiSuccess rt -> refreshCache rt mroot | 104 | KikiSuccess rt -> refreshCache rt mroot |
105 | _ -> return () -- XXX: silent fail? | 105 | _ -> return () -- XXX: silent fail? |
106 | 106 | ||
107 | data CommonArgsParsed = CommonArgsParsed { cap_homespec :: Maybe String, cap_passfd :: Maybe InputFile } | 107 | data CommonArgsParsed = CommonArgsParsed |
108 | { cap_homespec :: Maybe String | ||
109 | , cap_passfd :: Maybe InputFile | ||
110 | , cap_fpstyle :: FingerprintStyle | ||
111 | } | ||
112 | |||
113 | data FingerprintStyle | ||
114 | = FingerprintAuto | ||
115 | | Fingerprint5 | ||
116 | deriving (Eq,Ord,Show) | ||
117 | |||
118 | instance Read FingerprintStyle where | ||
119 | readsPrec _ s = case break isSpace s of | ||
120 | ("auto",t) -> [(FingerprintAuto, drop 1 t)] | ||
121 | ("5",t) -> [(Fingerprint5, drop 1 t)] | ||
122 | _ -> [] | ||
108 | 123 | ||
109 | streaminfo :: StreamInfo | 124 | streaminfo :: StreamInfo |
110 | streaminfo = StreamInfo | 125 | streaminfo = StreamInfo |
@@ -519,7 +534,8 @@ refreshCache rt rootdir = do | |||
519 | let exportOp = passphrases <> pemSecrets | 534 | let exportOp = passphrases <> pemSecrets |
520 | <> minimalOp False | 535 | <> minimalOp False |
521 | (CommonArgsParsed (Just $ takeDirectory $ rtPubring rt) | 536 | (CommonArgsParsed (Just $ takeDirectory $ rtPubring rt) |
522 | Nothing) | 537 | Nothing |
538 | FingerprintAuto) | ||
523 | where | 539 | where |
524 | passphrases = mempty { opPassphrases = [PassphraseMemoizer (rtPassphrases rt)] } | 540 | passphrases = mempty { opPassphrases = [PassphraseMemoizer (rtPassphrases rt)] } |
525 | pemSecrets = mempty { opFiles = Map.fromList | 541 | pemSecrets = mempty { opFiles = Map.fromList |
@@ -712,6 +728,7 @@ dashdashHomedir :: Args CommonArgsParsed | |||
712 | dashdashHomedir = CommonArgsParsed | 728 | dashdashHomedir = CommonArgsParsed |
713 | <$> optional (arg "--homedir") | 729 | <$> optional (arg "--homedir") |
714 | <*> optional (FileDesc <$> read <$> arg "--passphrase-fd") | 730 | <*> optional (FileDesc <$> read <$> arg "--passphrase-fd") |
731 | <*> (fromMaybe FingerprintAuto <$> optional (read <$> arg "--fingerprint")) | ||
715 | 732 | ||
716 | dashdashCipher :: Args SymmetricAlgorithm | 733 | dashdashCipher :: Args SymmetricAlgorithm |
717 | dashdashCipher = fromMaybe CAST5 <$> optional (cipherFromString <$> arg "--cipher") | 734 | dashdashCipher = fromMaybe CAST5 <$> optional (cipherFromString <$> arg "--cipher") |