summaryrefslogtreecommitdiffhomepage
path: root/Gpg
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-29 14:46:45 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-29 14:51:26 -0400
commita61df1522ddf8a36839cf1180d3b16e354459e9a (patch)
tree0e78f72714701b8cd7f32591c921e4826fcf1ddd /Gpg
parent237b94f6c687675215f78fba28d7e003a2b9ab7d (diff)
downloaddebug-me-a61df1522ddf8a36839cf1180d3b16e354459e9a.tar.gz
user gpg key checking and prompting done!
Diffstat (limited to 'Gpg')
-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