mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 14:51:05 +01:00
additional validation
This commit is contained in:
parent
a6f0acc030
commit
a3f910acf4
1 changed files with 3 additions and 0 deletions
|
@ -159,6 +159,9 @@ async def api_scan(p, c, request: Request, card_uid: str = None):
|
||||||
try:
|
try:
|
||||||
card = await get_card_by_uid(card_uid)
|
card = await get_card_by_uid(card_uid)
|
||||||
card_uid, counter = decryptSUN(bytes.fromhex(p), bytes.fromhex(card.k1))
|
card_uid, counter = decryptSUN(bytes.fromhex(p), bytes.fromhex(card.k1))
|
||||||
|
|
||||||
|
if card.uid.upper() != card_uid.hex().upper():
|
||||||
|
return {"status": "ERROR", "reason": "Card UID mis-match."}
|
||||||
except:
|
except:
|
||||||
return {"status": "ERROR", "reason": "Error decrypting card."}
|
return {"status": "ERROR", "reason": "Error decrypting card."}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue