packages feed

password-instances 0.3.0.1 → 1.0.0.0

raw patch · 3 files changed

+16/−9 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Data.Password.Instances: Pass :: Text -> Pass
- Data.Password.Instances: PassCheckSucc :: PassCheck
- Data.Password.Instances: [unPass] :: Pass -> Text
- Data.Password.Instances: newtype Pass
+ Data.Password.Instances: PassCheckSuccess :: PassCheck
+ Data.Password.Instances: data Pass
+ Data.Password.Instances: mkPass :: Text -> Pass
- Data.Password.Instances: hashPassWithSalt :: Pass -> Salt -> PassHash
+ Data.Password.Instances: hashPassWithSalt :: Salt -> Pass -> PassHash
- Data.Password.Instances: newSalt :: IO Salt
+ Data.Password.Instances: newSalt :: MonadIO m => m Salt

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for password-instances +## 1.0.0.0++-   Various changes re-exported from the `password` package.+    [#6](https://github.com/cdepillabout/password/pull/6)+ ## 0.3.0.1  -   Small fix to make sure the doctests build with stack.
password-instances.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12  name:           password-instances-version:        0.3.0.1+version:        1.0.0.0 category:       Data synopsis:       typeclass instances for password package description:    A library providing typeclass instances for common libraries for the types from the password package.
src/Data/Password/Instances.hs view
@@ -23,7 +23,8 @@ module Data.Password.Instances   (     -- * Plaintext Password-    Pass(..)+    Pass+  , mkPass     -- * Hashed Password   , PassHash(..)   , Salt(..)@@ -41,11 +42,11 @@     -- $setup   ) where -import Data.Aeson (FromJSON)+import Data.Aeson (FromJSON(..)) import Data.Password import Database.Persist.Class (PersistField) import Database.Persist.Sql (PersistFieldSql)-import Web.HttpApiData (FromHttpApiData)+import Web.HttpApiData (FromHttpApiData(..))   -- $setup@@ -57,7 +58,6 @@ -- >>> import Database.Persist.Class (PersistField(toPersistValue)) -- >>> import Web.HttpApiData (parseUrlPiece) - -- | This instance allows a 'Pass' to be created from a JSON blob. -- -- >>> let maybePass = decode "\"foobar\"" :: Maybe Pass@@ -70,7 +70,8 @@ -- Similarly, there is no 'ToJSON' and 'FromJSON' instance for 'PassHash' -- because we don't want to accidentally send the password hash to the end -- user.-deriving newtype instance FromJSON Pass+instance FromJSON Pass where+  parseJSON = fmap mkPass . parseJSON  -- | This instance allows a 'Pass' to be created with functions like -- 'Web.HttpApiData.parseUrlPiece' or 'Web.HttpApiData.parseQueryParam'.@@ -78,14 +79,15 @@ -- >>> let eitherPass = parseUrlPiece "foobar" -- >>> fmap unsafeShowPassword eitherPass -- Right "foobar"-deriving newtype instance FromHttpApiData Pass+instance FromHttpApiData Pass where+  parseUrlPiece = fmap mkPass . parseUrlPiece  -- | This instance allows a 'PassHash' to be stored as a field in a database using -- "Database.Persist". -- -- >>> let salt = Salt "abcdefghijklmnopqrstuvwxyz012345"--- >>> let pass = Pass "foobar"--- >>> let hashedPassword = hashPassWithSalt (Pass "foobar") salt+-- >>> let pass = mkPass "foobar"+-- >>> let hashedPassword = hashPassWithSalt salt pass -- >>> toPersistValue hashedPassword -- PersistText "14|8|1|YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU=|nENDaqWBmPKapAqQ3//H0iBImweGjoTqn5SvBS8Mc9FPFbzq6w65maYPZaO+SPamVZRXQjARQ8Y+5rhuDhjIhw==" --