Crypto API placeholder

main
Bob Mottram 2020-08-06 17:49:13 +01:00
parent a6e3731fa8
commit a1b09a23bf
1 changed files with 22 additions and 0 deletions

View File

@ -5775,6 +5775,23 @@ class PubServer(BaseHTTPRequestHandler):
postBytes, boundary) postBytes, boundary)
return pageNumber return pageNumber
def _cryptoAPI(self, path: str, authorized: bool) -> None:
# TODO
if path.startswith('/api/v1/crypto/keys/upload'):
self._200()
elif path.startswith('/api/v1/crypto/keys/query'):
self._200()
elif path.startswith('/api/v1/crypto/keys/claim'):
self._200()
elif path.startswith('/api/v1/crypto/delivery'):
self._200()
elif path.startswith('/api/v1/crypto/encrypted_messages/clear'):
self._200()
elif path.startswith('/api/v1/crypto/encrypted_messages'):
self._200()
else:
self._400()
def do_POST(self): def do_POST(self):
POSTstartTime = time.time() POSTstartTime = time.time()
POSTtimings = [] POSTtimings = []
@ -5848,6 +5865,11 @@ class PubServer(BaseHTTPRequestHandler):
print('POST Not authorized') print('POST Not authorized')
print(str(self.headers)) print(str(self.headers))
if self.path.startswith('/api/v1/crypto/'):
self._cryptoAPI(self.path, authorized)
self.server.POSTbusy = False
return
# if this is a POST to the outbox then check authentication # if this is a POST to the outbox then check authentication
self.outboxAuthenticated = False self.outboxAuthenticated = False
self.postToNickname = None self.postToNickname = None