diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-29 14:46:45 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-29 14:51:26 -0400 |
commit | a61df1522ddf8a36839cf1180d3b16e354459e9a (patch) | |
tree | 0e78f72714701b8cd7f32591c921e4826fcf1ddd /Gpg/Wot.hs | |
parent | 237b94f6c687675215f78fba28d7e003a2b9ab7d (diff) | |
download | debug-me-a61df1522ddf8a36839cf1180d3b16e354459e9a.tar.gz |
user gpg key checking and prompting done!
Diffstat (limited to 'Gpg/Wot.hs')
-rw-r--r-- | Gpg/Wot.hs | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -84,26 +84,31 @@ knownKeyInStrongSet :: GpgKeyId knownKeyInStrongSet = GpgKeyId "E85A5F63B31D24C1EBF0D81CC910D9222512E3C7" newtype StrongSetAnalysis = StrongSetAnalysis Bool + deriving (Show) isInStrongSet :: GpgKeyId -> IO StrongSetAnalysis isInStrongSet k = maybe (StrongSetAnalysis False) (const $ StrongSetAnalysis True) <$> downloadWotPath k knownKeyInStrongSet -describeWot :: WotStats -> StrongSetAnalysis -> String -describeWot ws (StrongSetAnalysis ss) +describeWot :: Maybe WotStats -> StrongSetAnalysis -> String +describeWot (Just ws) (StrongSetAnalysis ss) | ss == False = theirname ++ "'s identity cannot be verified!" | otherwise = unlines $ [ theirname ++ "'s identity has been verified by as many as " ++ show (length sigs) ++ " people, including:" - , intercalate ", " $ take 10 $ map (stripEmail . uid) bestconnectedsigs + , intercalate ", " $ take 10 $ nub $ + map (stripEmail . uid) bestconnectedsigs , "" , theirname ++ " is probably a real person." ] where theirname = stripEmail (uid (key ws)) sigs = cross_sigs ws ++ other_sigs ws - nsigs = length sigs bestconnectedsigs = sortOn rank sigs +describeWot Nothing _ = unlines + [ "" + , "Their identity cannot be verified!" + ] stripEmail :: String -> String stripEmail = unwords . takeWhile (not . ("<" `isPrefixOf`)) . words |