pub struct User { /* private fields */ }
Expand description
Represents a user account with all associated metadata.
This structure contains all the information needed to represent a user in the system, including their unique identifier, name, primary group, and hashed password with salt for security.
Implementations§
Source§impl User
impl User
Sourcepub fn new(
identifier: UserIdentifierInner,
name: String,
primary_group: GroupIdentifierInner,
hash: String,
salt: String,
) -> Self
pub fn new( identifier: UserIdentifierInner, name: String, primary_group: GroupIdentifierInner, hash: String, salt: String, ) -> Self
Creates a new user instance with the provided information.
§Arguments
Identifier
- Unique numerical identifier for the userName
- Human-readable usernamePrimary_group
- Identifier of the user’s primary groupHash
- Pre-computed SHA-512 hash of password+saltSalt
- Random salt used for password hashing
§Returns
A new User_type
instance with the provided data.
Sourcepub fn get_identifier(&self) -> UserIdentifier
pub fn get_identifier(&self) -> UserIdentifier
Returns the user’s unique identifier.
§Returns
A User_identifier_type
containing the user’s unique ID.
Sourcepub fn get_primary_group(&self) -> GroupIdentifier
pub fn get_primary_group(&self) -> GroupIdentifier
Returns the user’s primary group identifier.
§Returns
A Group_identifier_type
containing the user’s primary group ID.
Sourcepub fn get_hash(&self) -> &str
pub fn get_hash(&self) -> &str
Returns the user’s password hash as a string slice.
§Returns
A string slice containing the SHA-512 hash of password+salt.
Sourcepub fn get_salt(&self) -> &str
pub fn get_salt(&self) -> &str
Returns the user’s salt as a string slice.
§Returns
A string slice containing the random salt used for password hashing.