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
User
class by changing the definition of the initializer function__init__
.
- create_user(username: str, password: str) User
Returns an instance of an
User
that includes all necessary data the client program needs to operate on behalf of the user identified byusername
andpassword
. However, raises autil.DropboxError
in the following circumstances:If a user with the same
username
already existsIf
username
is 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 uniqueusername
and that usernames are non-empty strings. However, multiple users may choose the samepassword
.You must not restrict users’ choice of
username
andpassword
(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
User
instance corresponding to the user identified byusername
- Return type:
- Raises:
DropboxError – if an error case occurred