diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-08-15 15:47:27 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-08-15 15:47:27 +0200 |
commit | a0ad1f5e7fac279b33ea09ca0e347cd7d02cd8ec (patch) | |
tree | 15363be13084bd61b386cf817212096089ea508f /src/Controllers | |
parent | c135fcf9041c604b32827a1cb027010bca5915ab (diff) |
keys and sync endpoint setup
Diffstat (limited to 'src/Controllers')
-rw-r--r-- | src/Controllers/KeyController.php | 10 | ||||
-rwxr-xr-x | src/Controllers/SyncController.php | 26 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/Controllers/KeyController.php b/src/Controllers/KeyController.php index 04f2c6d..a999e40 100644 --- a/src/Controllers/KeyController.php +++ b/src/Controllers/KeyController.php @@ -2,6 +2,7 @@ namespace App\Controllers; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\JsonResponse; @@ -17,6 +18,15 @@ class KeyController ]); } + public function upload(): Response + { + $request = Request::createFromGlobals(); + + return new JsonResponse([ + "one_time_key_counts" => [], + ]); + } + public function query(string $serverName): Response {} } diff --git a/src/Controllers/SyncController.php b/src/Controllers/SyncController.php new file mode 100755 index 0000000..19da1b5 --- /dev/null +++ b/src/Controllers/SyncController.php @@ -0,0 +1,26 @@ +<?php + +namespace App\Controllers; + +use App\Errors\UnauthorizedError; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\JsonResponse; + +class SyncController +{ + public function sync(): Response + { + $request = Request::createFromGlobals(); + + if ($request->headers->get("authorization") != "Bearer abc123") { + # TODO: get user based on bearer token + throw new UnauthorizedError(); + } + + return new JsonResponse([ + "account_data" => [], + "next_batch" => "", + ]); + } +} |