implemented postgres support in repositories
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
"""Definition of hash_password function."""
|
||||
|
||||
import bcrypt
|
||||
|
||||
|
||||
def hash_password(password: str) -> str:
|
||||
"""Hash a password using bcrypt.
|
||||
|
||||
Args:
|
||||
password: Plain text password to hash
|
||||
|
||||
Returns:
|
||||
Hashed password as a string
|
||||
"""
|
||||
salt = bcrypt.gensalt()
|
||||
hashed: bytes = bcrypt.hashpw(password.encode("utf-8"), salt)
|
||||
return hashed.decode("utf-8")
|
||||
Reference in New Issue
Block a user