chore: rename api-key-macaroon

This commit is contained in:
Eneko Illarramendi
2020-04-16 20:58:16 +02:00
parent a834a64319
commit fd4dddda6e
8 changed files with 33 additions and 33 deletions
+3 -3
View File
@@ -8,14 +8,14 @@ from lnbits.core.crud import get_user, get_wallet_for_key
from .helpers import Status
def api_check_wallet_macaroon(*, key_type: str = "invoice"):
def api_check_wallet_key(key_type: str = "invoice"):
def wrap(view):
@wraps(view)
def wrapped_view(**kwargs):
try:
g.wallet = get_wallet_for_key(request.headers["api_key"], key_type)
g.wallet = get_wallet_for_key(request.headers["X-Api-Key"], key_type)
except KeyError:
return jsonify({"message": "`api_key` header missing."}), Status.BAD_REQUEST
return jsonify({"message": "`X-Api-Key` header missing."}), Status.BAD_REQUEST
if not g.wallet:
return jsonify({"message": "Wrong keys."}), Status.UNAUTHORIZED