Copyright | (C) 2018 2019 Jonathan Lamothe |
---|---|
License | LGPLv3 (or later) |
Maintainer | jlamothe1980@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
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/.
Synopsis
- type PWDatabase = Map String PWData
- data PWData = PWData {}
- data PWPolicy = PWPolicy {}
- 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)
- newPWDatabase :: PWDatabase
- newPWData :: RandomGen g => g -> (PWData, g)
- newPWPolicy :: PWPolicy
- newPWSalt :: RandomGen g => g -> (PWSalt, g)
- validatePWDatabase :: PWDatabase -> Bool
- validatePWData :: PWData -> Bool
- validatePWPolicy :: PWPolicy -> Bool
- pwGenerate :: String -> PWData -> Maybe String
- pwCountUpper :: String -> Int
- pwCountLower :: String -> Int
- pwCountDigits :: String -> Int
- pwCountSpecial :: String -> Int
- pwCount :: (Char -> Bool) -> String -> Int
- pwHasService :: String -> PWDatabase -> Bool
- pwSetService :: String -> PWData -> PWDatabase -> PWDatabase
- pwGetService :: String -> PWDatabase -> Maybe PWData
- pwRemoveService :: String -> PWDatabase -> PWDatabase
- pwSearch :: String -> PWDatabase -> [String]
Data Types
data necessary to construct a password
defines a password policy
type PWSalt = ByteString Source #
the "salt" used to generate a password
Lenses
The following functions are automatically generated by
makeLenses
. See the
lens package for further
details.
PWPolicy
Default Instances
newPWDatabase :: PWDatabase Source #
default (empty) password database
builds a new PWData
newPWPolicy :: PWPolicy Source #
default password policy
builds a new salt
Validations
:: PWDatabase | the database to be validated |
-> Bool |
validates a password database
validates password data
validates a password policy
Functions
Password Generator
:: String | the master password |
-> PWData | the password parameters |
-> Maybe String | the resulting password, if possible; |
generates a password
Password Checkers
counts characters matching a specific constraint
Database Functions
:: String | the service name |
-> PWDatabase | the database to check |
-> Bool |
checks to see if a service is in the database
:: String | the service name |
-> PWData | the password data for the service |
-> PWDatabase | the database to add to |
-> PWDatabase | the resulting database |
adds a service to the database, or overwrites an existing one
:: String | the service name |
-> PWDatabase | the database to check |
-> Maybe PWData | the service's password data, or |
attempts to get a service from the database
:: String | the service being removed |
-> PWDatabase | the database the service is being removed from |
-> PWDatabase | the resulting database |
removes a service from the database
:: String | the search string |
-> PWDatabase | the database to search |
-> [String] | the matching service names |
searches for a service
Orphan instances
ToJSON ByteString Source # | |
toJSON :: ByteString -> Value # toEncoding :: ByteString -> Encoding # toJSONList :: [ByteString] -> Value # toEncodingList :: [ByteString] -> Encoding # | |
FromJSON ByteString Source # | |
parseJSON :: Value -> Parser ByteString # parseJSONList :: Value -> Parser [ByteString] # |