From a1b09a23bfa11351a303591da1709a7af6cb81b9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 6 Aug 2020 17:49:13 +0100 Subject: [PATCH] Crypto API placeholder --- daemon.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/daemon.py b/daemon.py index 92fb2b4d..3477029e 100644 --- a/daemon.py +++ b/daemon.py @@ -5775,6 +5775,23 @@ class PubServer(BaseHTTPRequestHandler): postBytes, boundary) 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): POSTstartTime = time.time() POSTtimings = [] @@ -5848,6 +5865,11 @@ class PubServer(BaseHTTPRequestHandler): print('POST Not authorized') 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 self.outboxAuthenticated = False self.postToNickname = None