implemented newPWData

This commit is contained in:
Jonathan Lamothe
2018-12-18 14:04:45 -05:00
parent 72d8609674
commit 098aaeb49f
3 changed files with 59 additions and 1 deletions

View File

@@ -34,7 +34,7 @@ module Password (
-- *** PWPolicy
pwLength, pwUpper, pwLower, pwDigits, pwSpecial,
-- ** Default Instances
newPWPolicy, newSalt,
newPWData, newPWPolicy, newSalt,
-- * Functions
validatePWPolicy
) where
@@ -84,6 +84,17 @@ makeLenses ''PWData
newPWPolicy :: PWPolicy
newPWPolicy = PWPolicy 16 0 0 0 (Just 0)
-- | builds a new @'PWData'@
newPWData
:: RandomGen g
=> g
-- ^ the random generator to use
-> (PWData, g)
-- ^ the result and new random generator
newPWData g = (result, g') where
result = PWData newPWPolicy salt
(salt, g') = newSalt g
-- | builds a new salt
newSalt
:: RandomGen g