Task Description: Implement a User Authentication System
You need to create a user authentication system that will allow users to register, log in, and log out using a username and password. The system should follow these specific requirements to ensure all provided tests pass:
User Registration:
Create a method named register_user(username: str, password: str) -> bool.
The method should check if a username is already taken. If it is, return False. If not, store the username and its hashed password in a secure way and return True.
User Login:
Implement a method named login_user(username: str, password: str) -> bool.
This method should verify the username exists and check if the provided password matches the stored hashed password. Return True for successful login and False for failure.
User Logout:
Create a method named logout_user() -> bool.
This method should effectively log the user out, allowing the system to recognize when a user is no longer logged in.
In-Memory User Store:
Use an appropriate data structure (like a dictionary) to temporarily store user credentials, where the key is the username and the value is the hashed password.
Password Hashing:
Implement password hashing using a secure hashing algorithm (e.g., bcrypt). Ensure that passwords are never stored in plain text.
Testing:
Ensure all implemented methods are tested as indicated in the provided test code, focusing on registration, login/logout workflows, and handling edge cases (like duplicate usernames and incorrect passwords).
Place all implementations within the /app/ directory.