haveibeenpwned-0.2.0.1: Library for checking for weak/compromised passwords.

Safe HaskellNone
LanguageHaskell2010

HaveIBeenPwned

Description

Query haveibeenpwned database to check basic password strength in a secure way.

By checking new user passwords against a database of leaked passwords you get some means for rejecting very weak or just leaked passwords.

Synopsis

Documentation

data HaveIBeenPwnedResult Source #

Result of a password check.

It is either considered secure, insecure or we can't say because of an error.

Constructors

HaveIBeenPwnedResult_Secure

We could not find the password in any database, thus it is considered "secure" as far as this library is concerned.

HaveIBeenPwnedResult_Pwned Int

How many times the password was found in public places. Usually this will be a value greater than 0, but in any case if you hit this constructor you must assume tha password has been leaked.

HaveIBeenPwnedResult_Error

The check failed for some reason. We can't say anything about the password quality.

class Monad m => MonadPwned m where Source #

Methods

haveIBeenPwned :: Text -> m HaveIBeenPwnedResult Source #

Returns the number of disclosures the supplied password has been seen in.

If this is not zero, do not use the supplied password, it is known to hackers. If it *is* zero, it might still not be safe, only that if it is compromised, that is not yet known.

https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange

Instances
(MonadLogger m, MonadIO m) => MonadPwned (PwnedT m) Source # 
Instance details

Defined in HaveIBeenPwned

newtype PwnedT m a Source #

Constructors

PwnedT 
Instances
MonadTrans PwnedT Source # 
Instance details

Defined in HaveIBeenPwned

Methods

lift :: Monad m => m a -> PwnedT m a #

MonadReader r m => MonadReader r (PwnedT m) Source # 
Instance details

Defined in HaveIBeenPwned

Methods

ask :: PwnedT m r #

local :: (r -> r) -> PwnedT m a -> PwnedT m a #

reader :: (r -> a) -> PwnedT m a #

Monad m => Monad (PwnedT m) Source # 
Instance details

Defined in HaveIBeenPwned

Methods

(>>=) :: PwnedT m a -> (a -> PwnedT m b) -> PwnedT m b #

(>>) :: PwnedT m a -> PwnedT m b -> PwnedT m b #

return :: a -> PwnedT m a #

fail :: String -> PwnedT m a #

Functor m => Functor (PwnedT m) Source # 
Instance details

Defined in HaveIBeenPwned

Methods

fmap :: (a -> b) -> PwnedT m a -> PwnedT m b #

(<$) :: a -> PwnedT m b -> PwnedT m a #

Applicative m => Applicative (PwnedT m) Source # 
Instance details

Defined in HaveIBeenPwned

Methods

pure :: a -> PwnedT m a #

(<*>) :: PwnedT m (a -> b) -> PwnedT m a -> PwnedT m b #

liftA2 :: (a -> b -> c) -> PwnedT m a -> PwnedT m b -> PwnedT m c #

(*>) :: PwnedT m a -> PwnedT m b -> PwnedT m b #

(<*) :: PwnedT m a -> PwnedT m b -> PwnedT m a #

MonadIO m => MonadIO (PwnedT m) Source # 
Instance details

Defined in HaveIBeenPwned

Methods

liftIO :: IO a -> PwnedT m a #

MonadLogger m => MonadLogger (PwnedT m) Source # 
Instance details

Defined in HaveIBeenPwned

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> PwnedT m () #

(MonadLogger m, MonadIO m) => MonadPwned (PwnedT m) Source # 
Instance details

Defined in HaveIBeenPwned

mapPwnedT :: (m a -> n b) -> PwnedT m a -> PwnedT n b Source #

passwdDigest :: Text -> (Text, Text) Source #

Get the sha1 digest for the supplied password, split into two parts, to agree with the hibp api.

parseHIBPResponse :: ByteString -> Text -> HaveIBeenPwnedResult Source #

The hibp response is a line separated list of colon separated hash *suffixes* and a number indicating the number of times that password(hash) has been seen in known publicly disclosed leaks