Expand description
§Authentication Module
The Authentication module provides user and group management functionality for the Xila operating system. It handles user authentication, password hashing, and secure storage of user/group information.
§Features
- User Management: Create, authenticate, and manage user accounts
- Group Management: Create and manage user groups
- Password Security: Secure password hashing using SHA-512 with salt
- File-based Storage: Persistent storage of user and group data in JSON format
- Async Operations: All operations are asynchronous for better performance
§Usage
The module provides functionality to:
- Load existing users and groups from the filesystem
- Authenticate users with username/password
- Create new users and groups
- Change user passwords and usernames
- Hash passwords securely with salt generation
§File Structure
- Users are stored in
/System/Users/
directory - Groups are stored in
/System/Groups/
directory - Each user/group has their own JSON file containing their data
- Random salt generation uses
/devices/random
device
Structs§
- Group
- Represents a user group with associated metadata and member list.
- User
- Represents a user account with all associated metadata.
Enums§
- Error
- Comprehensive error enumeration for authentication operations.
Functions§
- authenticate_
user - Authenticates a user with their username and password.
- change_
user_ name - Changes a user’s username by updating their user file.
- change_
user_ password - Changes a user’s password by generating a new salt and hash.
- create_
group - Creates a new group with the specified parameters.
- create_
user - Creates a new user account with the specified parameters.
- get_
group_ file_ path - Constructs the file system path for a group’s data file.
- get_
user_ file_ path - Constructs the file system path for a user’s data file.
- load_
all_ users_ and_ groups - Loads all users and groups from the filesystem into memory.
- read_
group_ file - Reads and parses a group file from the filesystem.
- read_
user_ file - Reads and parses a user file from the filesystem.
Type Aliases§
- Result
- Result type alias for authentication operations.