partial implementation of password adding

This commit is contained in:
Jonathan Lamothe
2018-12-23 16:24:08 -05:00
parent 3893a1c63e
commit 3b93849a0e
2 changed files with 133 additions and 5 deletions

View File

@@ -41,7 +41,9 @@ module Password (
-- ** Password Generator
pwGenerate,
-- ** Password Checkers
pwCountUpper, pwCountLower, pwCountDigits, pwCountSpecial
pwCountUpper, pwCountLower, pwCountDigits, pwCountSpecial,
-- ** Database Functions
pwHasService, pwSetService, pwGetService
) where
import Control.Lens (makeLenses, over, set, (^.))
@@ -203,6 +205,39 @@ pwCountSpecial
-- ^ the count
pwCountSpecial = length . filter isSpecial
-- | checks to see if a service is in the database
pwHasService
:: String
-- ^ the service name
-> PWDatabase
-- ^ the database to check
-> Bool
-- ^ returns @"True"@ if found; @"False"@ otherwise
pwHasService = undefined
-- | adds a service to the database, or overwrites an existing one
pwSetService
:: String
-- ^ the service name
-> PWData
-- ^ the password data for the service
-> PWDatabase
-- ^ the database to add to
-> PWDatabase
-- ^ the resulting database
pwSetService = undefined
-- | attempts to get a service from the database
pwGetService
:: String
-- ^ the service name
-> PWDatabase
-- ^ the database to check
-> Maybe PWData
-- ^ the service's password data, or @"Nothing"@ if the service is
-- not found
pwGetService = undefined
isSpecial :: Char -> Bool
isSpecial x = not $ isUpper x || isLower x || isDigit x