-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | a simple password manager
--
-- Please see the README on GitHub at
-- https://github.com/jlamothe/passman#readme
@package passman
@version 0.1
-- | This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as
-- published by the Free Software Foundation, either version 3 of the
-- License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this program. If not, see
-- https://www.gnu.org/licenses/.
module Password
-- | a mapping of service names to password data
type PWDatabase = Map String PWData
-- | data necessary to construct a password
data PWData
PWData :: PWPolicy -> PWSalt -> PWData
-- | the password policy
[_pwPolicy] :: PWData -> PWPolicy
-- | random data used to generate the password
[_pwSalt] :: PWData -> PWSalt
-- | defines a password policy
data PWPolicy
PWPolicy :: Int -> Int -> Int -> Int -> Maybe Int -> PWPolicy
-- | password length
[_pwLength] :: PWPolicy -> Int
-- | the minimum number of upper case characters
[_pwUpper] :: PWPolicy -> Int
-- | the minimum number of lower case characters
[_pwLower] :: PWPolicy -> Int
-- | the minimum number of digits
[_pwDigits] :: PWPolicy -> Int
-- | the minimum number of non-alphanumeric characters (not allowed if
-- Nothing)
[_pwSpecial] :: PWPolicy -> Maybe Int
-- | the "salt" used to generate a password
type PWSalt = ByteString
pwPolicy :: Lens' PWData PWPolicy
pwSalt :: Lens' PWData PWSalt
pwLength :: Lens' PWPolicy Int
pwUpper :: Lens' PWPolicy Int
pwLower :: Lens' PWPolicy Int
pwDigits :: Lens' PWPolicy Int
pwSpecial :: Lens' PWPolicy (Maybe Int)
-- | default (empty) password database
newPWDatabase :: PWDatabase
-- | builds a new PWData
newPWData :: RandomGen g => g -> (PWData, g)
-- | default password policy
newPWPolicy :: PWPolicy
-- | builds a new salt
newPWSalt :: RandomGen g => g -> (PWSalt, g)
-- | validates a password database
validatePWDatabase :: PWDatabase -> Bool
-- | validates password data
validatePWData :: PWData -> Bool
-- | validates a password policy
validatePWPolicy :: PWPolicy -> Bool
-- | generates a password
pwGenerate :: String -> PWData -> Maybe String
-- | counts upper case characters in a password
pwCountUpper :: String -> Int
-- | counts lower case characters in a password
pwCountLower :: String -> Int
-- | counts digits in a password
pwCountDigits :: String -> Int
-- | counts special characters in a password
pwCountSpecial :: String -> Int
-- | counts characters matching a specific constraint
pwCount :: (Char -> Bool) -> String -> Int
-- | checks to see if a service is in the database
pwHasService :: String -> PWDatabase -> Bool
-- | adds a service to the database, or overwrites an existing one
pwSetService :: String -> PWData -> PWDatabase -> PWDatabase
-- | attempts to get a service from the database
pwGetService :: String -> PWDatabase -> Maybe PWData
-- | removes a service from the database
pwRemoveService :: String -> PWDatabase -> PWDatabase
-- | searches for a service
pwSearch :: String -> PWDatabase -> [String]
instance Data.Aeson.Types.FromJSON.FromJSON Password.PWData
instance Data.Aeson.Types.FromJSON.FromJSON Password.PWPolicy
instance Data.Aeson.Types.FromJSON.FromJSON Data.ByteString.Lazy.Internal.ByteString
instance Data.Aeson.Types.ToJSON.ToJSON Password.PWData
instance Data.Aeson.Types.ToJSON.ToJSON Password.PWPolicy
instance Data.Aeson.Types.ToJSON.ToJSON Data.ByteString.Lazy.Internal.ByteString
instance GHC.Show.Show Password.PWData
instance GHC.Classes.Eq Password.PWData
instance GHC.Show.Show Password.PWPolicy
instance GHC.Classes.Eq Password.PWPolicy