Fix misaligned error codes

This commit is contained in:
aftermath2
2023-04-01 12:00:00 +00:00
parent e305cf6d08
commit e0796eee77

View File

@ -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