Merge pull request #464 from arcbtc/Stepansfix

Adds stepans fix
This commit is contained in:
Arc 2021-12-16 17:06:36 +00:00 committed by GitHub
commit d0e437d1dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -83,9 +83,12 @@ async def handle_lnurl_firstrequest(
"reason": f"Invalid hex or base64 payload: {payload}",
}
h = hashlib.sha256(nonceb)
h.update(pos.key.encode())
s = h.digest()
if len(payloadb)!=8:
raise RuntimeError("Expected 8 bytes")
expected = hmac.new(pos.key.encode(), payloadb[:-2], digestmod="sha256").digest()
if expected[:2] != payloadb[-2:]:
raise RuntimeError("Invalid HMAC")
s = hmac.new(pos.key.encode(), nonceb, digestmod="sha256").digest()
res = bytearray(payloadb)
for i in range(len(res)):

View File

@ -127,10 +127,14 @@
position="top"
@hide="closeFormDialog"
>
<q-card class="q-pa-lg q-pt-xl lnbits__dialog-card">
<q-card
style="width: 700px; max-width: 80vw"
class="q-pa-lg q-pt-xl lnbits__dialog-card"
>
<div class="text-h6">Copy to LNURLPoS device</div>
<div class="text-subtitle2">
{% raw %} String server = "{{location}}/lnurlpos/api/v2/lnurl/{{settingsDialog.data.id}}";<br />
{% raw %} String server =
"{{location}}/lnurlpos/api/v1/lnurl/{{settingsDialog.data.id}}";<br />
String key = "{{settingsDialog.data.key}}";<br />
String currency = "{{settingsDialog.data.currency}}";{% endraw %}
</div>