Skip to content

Commit eeac8f0

Browse files
committed
fixup!
1 parent 0399f24 commit eeac8f0

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

lnpos/lnpos.ino

+17-10
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,6 @@ void qrShowCodeLNURL(String message)
10111011
{
10121012
tft.fillScreen(qrScreenBgColour);
10131013

1014-
qrData.toUpperCase();
10151014
const char *qrDataChar = qrData.c_str();
10161015
QRCode qrcoded;
10171016
uint8_t qrcodeData[qrcode_getBufferSize(11)];
@@ -1608,26 +1607,29 @@ bool makeLNURL()
16081607
iv[i] = random(0, 255);
16091608
iv_init[i] = iv[i];
16101609
}
1611-
randomPin = String(random(1000, 9999));
16121610

1613-
if (selection == "Offline PoS")
1614-
{
1611+
String secret;
1612+
1613+
if (selection == "Offline PoS") {
16151614
preparedURL = baseURLPoS;
1616-
}
1617-
else // ATM
1618-
{
1615+
secret = secretPoS;
1616+
} else {
1617+
// ATM
16191618
preparedURL = baseURLATM;
1619+
secret = secretATM;
16201620
}
16211621
preparedURL += "?p=";
16221622

1623-
String payload = randomPin + String(":") + String(total);
1623+
randomPin = random(1000, 9999);
1624+
String payload = String(randomPin) + String(":") + String(total);
16241625
Serial.print("payload: ");
16251626
Serial.println(payload);
16261627
size_t payload_len = payload.length();
16271628
int padding = 16 - (payload_len % 16);
16281629
unsigned char encrypted[payload_len + padding] = {0};
16291630
String s = "";
1630-
encrypt(secretATM.c_str(), iv, payload_len + padding, payload.c_str(), encrypted);
1631+
encrypt(secret.c_str(), iv, payload_len + padding, payload.c_str(), encrypted);
1632+
16311633
for (int i = 0; i < sizeof(encrypted); i++) {
16321634
s = String(encrypted[i], HEX);
16331635
if (s.length() == 1) {
@@ -1655,7 +1657,12 @@ bool makeLNURL()
16551657
char *charLnurl = (char *)calloc(strlen(url) * 2, sizeof(byte));
16561658
bech32_encode(charLnurl, "lnurl", data, len);
16571659
to_upper(charLnurl);
1658-
qrData = baseUrlAtmPage + charLnurl;
1660+
if (selection == "Offline PoS") {
1661+
qrData = charLnurl;
1662+
} else {
1663+
// ATM
1664+
qrData = baseUrlAtmPage + charLnurl;
1665+
}
16591666
Serial.println(qrData);
16601667

16611668
return true;

0 commit comments

Comments
 (0)