From e0796eee7751d95f71c8f9e514d559fef17b1372 Mon Sep 17 00:00:00 2001 From: aftermath2 Date: Sat, 1 Apr 2023 12:00:00 +0000 Subject: [PATCH] Fix misaligned error codes --- robosats/middleware.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/robosats/middleware.py b/robosats/middleware.py index 2e900f4e..8a245beb 100644 --- a/robosats/middleware.py +++ b/robosats/middleware.py @@ -77,7 +77,7 @@ class RobotTokenSHA256AuthenticationMiddleWare: return response if not is_valid_token(token_sha256_b91): - return JsonResponse(new_error(7001), status=status.HTTP_400_BAD_REQUEST) + return JsonResponse(new_error(7000), status=status.HTTP_400_BAD_REQUEST) # Check if it is an existing robot. try: @@ -124,7 +124,7 @@ class RobotTokenSHA256AuthenticationMiddleWare: encrypted_private_key = request.COOKIES.get("encrypted_private_key", "") if not public_key or not encrypted_private_key or not nostr_pubkey: - return JsonResponse(new_error(7002), status=status.HTTP_400_BAD_REQUEST) + return JsonResponse(new_error(7001), status=status.HTTP_400_BAD_REQUEST) ( valid, @@ -133,7 +133,7 @@ class RobotTokenSHA256AuthenticationMiddleWare: encrypted_private_key, ) = validate_pgp_keys(public_key, encrypted_private_key) if not valid: - return JsonResponse(new_error(7003, {"bad_keys_context": bad_keys_context}), status=status.HTTP_400_BAD_REQUEST) + return JsonResponse(new_error(7002, {"bad_keys_context": bad_keys_context}), status=status.HTTP_400_BAD_REQUEST) # Hash the token_sha256, only 1 iteration. # This is the second SHA256 of the user token, aka RoboSats ID