pub async fn create_user(
users_db: &Database,
instance: &Instance,
username: impl AsRef<str>,
password: Option<&str>,
) -> Result<(String, UserInfo)>Expand description
Create a new user account
This function:
- Optionally hashes the user’s password (if provided)
- Generates a device keypair for the user
- Creates a user database for storing keys (encrypted or unencrypted)
- Creates UserInfo and stores it in _users database with auto-generated UUID
§Arguments
users_db- The _users system databaseinstance- The Instance handleusername- Unique username for loginpassword- Optional password. If None, creates passwordless user (instant login, no encryption)
§Returns
A tuple of (user_uuid, UserInfo) where user_uuid is the generated primary key