AuthenticationSingleton

Singleton class responsible for managing user authentication state.

Properties

Link copied to clipboard

Mutable state representing whether the user is authenticated or not.

Link copied to clipboard
var user: User

Mutable state representing the user information.

Functions

Link copied to clipboard
fun logout()

Logs out the user by setting isUserAuthenticated to false and removing the token from encrypted preferences.

Link copied to clipboard

Validates the user by checking the token stored in the encrypted preferences. If the token is valid, it sets isUserAuthenticated to true and populates the user property. Otherwise, it logs out the user.