Task Description: Implement User Authentication Functionality
You are required to implement a user authentication system in the /app/ directory that meets the following specifications:
User Registration:
Create a function register_user(username: str, password: str) -> bool that:
Validates the username to ensure it is unique and follows the constraints (e.g., length between 3-15 characters, alphanumeric only).
Hashes the password using a secure hashing algorithm (e.g., bcrypt) and stores the username and hashed password in a user database (you can use an in-memory dictionary for simplicity).
User Login:
Create a function login_user(username: str, password: str) -> bool that:
Validates the provided username and checks if it exists in the user database.
Validates the password by comparing the provided password (hashed) with the stored hashed password.
Error Handling:
Ensure that appropriate error messages are returned for various scenarios, such as duplicate usernames during registration, incorrect passwords during login, and attempts to login with a non-existent username.
Session Management:
Create a simple mechanism to manage user sessions. Implement a function get_current_user() -> str that returns the username of the currently logged-in user or None if no user is logged in.
Unit Tests:
Write unit tests to validate the functionality of the above functions, ensuring that they correctly cover all edge cases, such as invalid inputs and error scenarios.
Implement the above functionality in the /app/ directory, and ensure that the unit tests pass successfully after implementation.