Skip to content

Commit ef3873d

Browse files
authored
Add access and documentation for three password checking functions
Add access and documentation for three password checking functions
2 parents f031059 + 19af972 commit ef3873d

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,29 @@ import easy_mongodb_auth_handler as emdb
503503
- **Returns:**
504504
- `bool`: `True` if the email format is valid, `False` otherwise.
505505

506+
- **emdb.hash_password(password)**
507+
- Hashes a password.
508+
- **Parameters:**
509+
- `password` (`str`): The password to hash.
510+
- **Returns:**
511+
- `str`: The hashed password.
512+
513+
- **emdb.check_password(user, password)**
514+
- Checks a un-hashed password against the hashed password stored in the user document.
515+
- **Parameters:**
516+
- `user` (`dict`): The user document to authenticate.
517+
- `password` (`str`): The un-hashed password to check against the user document.
518+
- **Returns:**
519+
- `bool`: `True` if the passwords match and `False` otherwise.
520+
521+
- **emdb.verify_password(password, hashed)**
522+
- Checks a un-hashed password against the hashed password passed as a parameter.
523+
- **Parameters:**
524+
- `password` (`dict`): The un-hashed password to check.
525+
- `hashed` (`str`): The hashed password to check.
526+
- **Returns:**
527+
- `bool`: `True` if the passwords match and `False` otherwise.
528+
506529
## Requirements
507530

508531
- Python >= 3.9

src/easy_mongodb_auth_handler/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
from .utils import Utils
88
from .core_db import CoreDB
99
from .package_functions.message import get_messages
10-
from .package_functions.func import generate_secure_code, get_version, validate_email
10+
from .package_functions.func import (generate_secure_code, get_version, validate_email,
11+
check_password, hash_password, verify_password)

0 commit comments

Comments
 (0)