mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2024-11-20 02:28:10 +01:00
removed uid for justa card id
This commit is contained in:
parent
59d6b654c5
commit
4e8766ce08
@ -15,7 +15,6 @@ async def create_card(data: CreateCardData, wallet_id: str) -> Card:
|
||||
id,
|
||||
wallet,
|
||||
card_name,
|
||||
uid,
|
||||
counter,
|
||||
withdraw,
|
||||
k0,
|
||||
@ -29,7 +28,6 @@ async def create_card(data: CreateCardData, wallet_id: str) -> Card:
|
||||
card_id,
|
||||
wallet_id,
|
||||
data.card_name,
|
||||
data.uid.upper(),
|
||||
data.counter,
|
||||
data.withdraw,
|
||||
data.k0,
|
||||
|
@ -30,7 +30,7 @@ from .crud import (
|
||||
create_hit,
|
||||
get_card,
|
||||
get_card_by_otp,
|
||||
get_card_by_uid,
|
||||
get_card,
|
||||
get_hit,
|
||||
get_hits_today,
|
||||
update_card,
|
||||
@ -43,18 +43,18 @@ from .nxp424 import decryptSUN, getSunMAC
|
||||
###############LNURLWITHDRAW#################
|
||||
|
||||
# /boltcards/api/v1/scan?p=00000000000000000000000000000000&c=0000000000000000
|
||||
@boltcards_ext.get("/api/v1/scan/{card_uid}")
|
||||
async def api_scan(p, c, request: Request, card_uid: str = None):
|
||||
@boltcards_ext.get("/api/v1/scan/{card_id}")
|
||||
async def api_scan(p, c, request: Request, card_id: str = None):
|
||||
# some wallets send everything as lower case, no bueno
|
||||
p = p.upper()
|
||||
c = c.upper()
|
||||
card = None
|
||||
counter = b""
|
||||
try:
|
||||
card = await get_card_by_uid(card_uid)
|
||||
card_uid, counter = decryptSUN(bytes.fromhex(p), bytes.fromhex(card.k1))
|
||||
card = await get_card(card_id)
|
||||
card_id, counter = decryptSUN(bytes.fromhex(p), bytes.fromhex(card.k1))
|
||||
|
||||
if card.uid.upper() != card_uid.hex().upper():
|
||||
if card.uid.upper() != card_id.hex().upper():
|
||||
return {"status": "ERROR", "reason": "Card UID mis-match."}
|
||||
except:
|
||||
return {"status": "ERROR", "reason": "Error decrypting card."}
|
||||
@ -62,7 +62,7 @@ async def api_scan(p, c, request: Request, card_uid: str = None):
|
||||
if card == None:
|
||||
return {"status": "ERROR", "reason": "Unknown card."}
|
||||
|
||||
if c != getSunMAC(card_uid, counter, bytes.fromhex(card.k2)).hex().upper():
|
||||
if c != getSunMAC(card_id, counter, bytes.fromhex(card.k2)).hex().upper():
|
||||
return {"status": "ERROR", "reason": "CMAC does not check."}
|
||||
|
||||
ctr_int = int.from_bytes(counter, "little")
|
||||
|
@ -150,7 +150,6 @@ new Vue({
|
||||
},
|
||||
getHits: function () {
|
||||
var self = this
|
||||
|
||||
LNbits.api
|
||||
.request(
|
||||
'GET',
|
||||
@ -167,7 +166,6 @@ new Vue({
|
||||
},
|
||||
getRefunds: function () {
|
||||
var self = this
|
||||
|
||||
LNbits.api
|
||||
.request(
|
||||
'GET',
|
||||
@ -184,7 +182,6 @@ new Vue({
|
||||
},
|
||||
openQrCodeDialog(cardId) {
|
||||
var card = _.findWhere(this.cards, {id: cardId})
|
||||
|
||||
this.qrCodeDialog.data = {
|
||||
link: window.location.origin + '/boltcards/api/v1/auth?a=' + card.otp,
|
||||
name: card.card_name,
|
||||
@ -197,11 +194,9 @@ new Vue({
|
||||
},
|
||||
addCardOpen: function () {
|
||||
this.cardDialog.show = true
|
||||
var elem = this.$els.myBtn
|
||||
elem.click()
|
||||
this.generateKeys()
|
||||
},
|
||||
generateKeys: function () {
|
||||
|
||||
const genRanHex = size =>
|
||||
[...Array(size)]
|
||||
.map(() => Math.floor(Math.random() * 16).toString(16))
|
||||
|
@ -5,7 +5,7 @@
|
||||
<div class="col-12 col-md-8 col-lg-7 q-gutter-y-md">
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<q-btn unelevated color="primary" v-on:click="addCardOpen"
|
||||
<q-btn unelevated color="primary" class="addCardBtn" v-on:click="addCardOpen"
|
||||
>Add Card</q-btn
|
||||
>
|
||||
</q-card-section>
|
||||
@ -187,7 +187,6 @@
|
||||
label="Wallet *"
|
||||
>
|
||||
</q-select>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<q-input
|
||||
@ -211,8 +210,6 @@
|
||||
></q-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
@ -221,14 +218,6 @@
|
||||
type="text"
|
||||
label="Card name "
|
||||
></q-input>
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
v-model.trim="cardDialog.data.uid"
|
||||
type="text"
|
||||
label="Card UID"
|
||||
><q-tooltip>From the NFC 424 ntag card that will be loaded</q-tooltip>
|
||||
</q-input>
|
||||
<q-toggle
|
||||
@click="toggleKeys"
|
||||
v-model="toggleAdvanced"
|
||||
|
Loading…
Reference in New Issue
Block a user