Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext-prelude
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext-prelude
Commits
ccef0790
Commit
ccef0790
authored
Aug 21, 2023
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add createPasswordHashWithSalt
parent
8f97fef4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
Auth.hs
src/Gargantext/Prelude/Crypto/Auth.hs
+14
-2
No files found.
src/Gargantext/Prelude/Crypto/Auth.hs
View file @
ccef0790
...
@@ -11,21 +11,33 @@ Portability : POSIX
...
@@ -11,21 +11,33 @@ Portability : POSIX
module
Gargantext.Prelude.Crypto.Auth
(
createPasswordHash
module
Gargantext.Prelude.Crypto.Auth
(
createPasswordHash
,
createPasswordHashWithSalt
,
checkPassword
,
checkPassword
,
module
Data
.
Password
.
Argon2
,
module
Data
.
Password
.
Argon2
)
)
where
where
import
Prelude
import
Control.Monad.IO.Class
(
MonadIO
)
import
Control.Monad.IO.Class
(
MonadIO
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Data.ByteString
(
ByteString
)
import
Data.Password.Argon2
hiding
(
checkPassword
)
import
Data.Password.Argon2
hiding
(
checkPassword
)
import
qualified
Data.Password.Argon2
as
A
import
qualified
Data.Password.Argon2
as
A
createPasswordHash
::
MonadIO
m
createPasswordHash
::
MonadIO
m
=>
Text
=>
Text
->
m
(
PasswordHash
Argon2
)
->
m
(
PasswordHash
Argon2
)
createPasswordHash
x
=
hashPassword
(
mkPassword
x
)
createPasswordHash
x
=
do
salt
<-
newSalt
pure
$
createPasswordHashWithSalt
(
getSalt
salt
)
x
createPasswordHashWithSalt
::
ByteString
-- ^ The salt to use.
->
Text
->
PasswordHash
Argon2
createPasswordHashWithSalt
salt
x
=
hashPasswordWithSalt
defaultParams
(
Salt
salt
)
(
mkPassword
x
)
checkPassword
::
Password
checkPassword
::
Password
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment