summaryrefslogtreecommitdiffhomepage
path: root/Gpg/Wot.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Gpg/Wot.hs')
-rw-r--r--Gpg/Wot.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/Gpg/Wot.hs b/Gpg/Wot.hs
index fc7b8a4..cdf079a 100644
--- a/Gpg/Wot.hs
+++ b/Gpg/Wot.hs
@@ -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