forked from brown-csci1660/Dropbox-Stencil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.py
98 lines (84 loc) · 3.73 KB
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
##
## client.py - Dropbox client implementation
##
# ** Optional libraries, uncomment if you need them **
# Search "python <name> library" for documentation
#import string # Python library with useful string constants
#import dacite # Helpers for serializing dicts into dataclasses
#import pymerkle # Merkle tree implementation (CS1620/CS2660 only, but still optional)
## ** Support code libraries ****
# The following imports load our support code from the "support"
# directory. See the Dropbox wiki for usage and documentation.
import support.crypto as crypto # Our crypto library
import support.util as util # Various helper functions
# These imports load instances of the dataserver, keyserver, and memloc classes
# to use in your client. See the Dropbox Wiki and setup guide for examples.
from support.dataserver import dataserver, memloc
from support.keyserver import keyserver
# **NOTE**: If you want to use any additional libraries, please ask on Ed
# first. You are NOT permitted to use any additional cryptographic functions
# other than those provided by crypto.py, or any filesystem/networking libraries.
class User:
def __init__(self) -> None:
"""
Class constructor for the `User` class.
You are free to add fields to the User class by changing the definition
of this function.
"""
pass
def upload_file(self, filename: str, data: bytes) -> None:
"""
The specification for this function is at:
https://brown-csci1660.github.io/dropbox-wiki/client-api/storage/upload-file.html
"""
# TODO: Implement
raise util.DropboxError("Not Implemented")
def download_file(self, filename: str) -> bytes:
"""
The specification for this function is at:
https://brown-csci1660.github.io/dropbox-wiki/client-api/storage/download-file.html
"""
# TODO: Implement
raise util.DropboxError("Not Implemented")
def append_file(self, filename: str, data: bytes) -> None:
"""
The specification for this function is at:
https://brown-csci1660.github.io/dropbox-wiki/client-api/storage/append-file.html
"""
# TODO: Implement
raise util.DropboxError("Not Implemented")
def share_file(self, filename: str, recipient: str) -> None:
"""
The specification for this function is at:
https://brown-csci1660.github.io/dropbox-wiki/client-api/sharing/share-file.html
"""
# TODO: Implement
raise util.DropboxError("Not Implemented")
def receive_file(self, filename: str, sender: str) -> None:
"""
The specification for this function is at:
https://brown-csci1660.github.io/dropbox-wiki/client-api/sharing/receive-file.html
"""
# TODO: Implement
raise util.DropboxError("Not Implemented")
def revoke_file(self, filename: str, old_recipient: str) -> None:
"""
The specification for this function is at:
https://brown-csci1660.github.io/dropbox-wiki/client-api/sharing/revoke-file.html
"""
# TODO: Implement
raise util.DropboxError("Not Implemented")
def create_user(username: str, password: str) -> User:
"""
The specification for this function is at:
https://brown-csci1660.github.io/dropbox-wiki/client-api/authentication/create-user.html
"""
# TODO: Implement
raise util.DropboxError("Not Implemented")
def authenticate_user(username: str, password: str) -> User:
"""
The specification for this function is at:
https://brown-csci1660.github.io/dropbox-wiki/client-api/authentication/authenticate-user.html
"""
# TODO: Implement
raise util.DropboxError("Not Implemented")