2.1.1. CreateUser
Implement this class definition and function:
- class User
Represents a user of the Dropbox system.
You are free to add fields to the
Userclass by changing the definition of the initializer function__init__.
- create_user(username: str, password: str) User
Returns an instance of an
Userthat includes all necessary data the client program needs to operate on behalf of the user identified byusernameandpassword. However, raises autil.DropboxErrorin the following circumstances:If a user with the same
usernamealready existsIf
usernameis the empty string
Notes:
Usernames are case sensitive.
Usernames do not need to remain confidential to the adversary.
Assuming that this operation properly enforces the aforementioned checks on
username, you should assume that each user has a uniqueusernameand that usernames are non-empty strings. However, multiple users may choose the samepassword.You must not restrict users’ choice of
usernameandpassword(i.e. in terms of characters or length).You should assume passwords have a medium amount of entropy (specifically, enough entropy for use with
crypto.PasswordKDF). However, the adversary may possess a rainbow table of common passwords.
- Parameters:
username (str) – The username of the user
password (str) – The password of the user
- Returns:
A
Userinstance corresponding to the user identified byusername- Return type:
- Raises:
DropboxError – if an error case occurred