5.1. InitUser: Create a user account.

Implement this function:

InitUser(username string, password string) (userdataptr *User, err error)
  • Creates a User struct, initializes all necessary data within the struct and returns a pointer to it.

  • The User struct should include all data the client needs to operate on behalf of this user.

  • If a user with the same username already exists, return an error.

  • username (string) – Username

  • password (string) – Password

Return type

userdataptr, error


Do not forget that your design must satisfy all requirements, including:

  1. The client application must be stateless (see Stateless).

  2. Users can have multiple active user sessions at once (see User Sessions).