Skip to content

fix: handle non-standard BIP21 URIs in QR scanner - #2300

Merged
i5hi merged 7 commits into
developfrom
2202-qr-scanner-fails-on-non-standard-bip21-donation-uris
Jun 16, 2026
Merged

fix: handle non-standard BIP21 URIs in QR scanner#2300
i5hi merged 7 commits into
developfrom
2202-qr-scanner-fails-on-non-standard-bip21-donation-uris

Conversation

@wired-pasteque

Copy link
Copy Markdown
Collaborator

Fix: #2202

ScreenRecording_06-16-2026.10-16-14_1.MP4

@wired-pasteque wired-pasteque self-assigned this Jun 16, 2026
@wired-pasteque wired-pasteque linked an issue Jun 16, 2026 that may be closed by this pull request
9 tasks
@i5hi

i5hi commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Example test cases that cover the following:

  • LNURL complete string with additional query params
  • Stardard Bolt11 invoice
  • LNAddress format - uses %40 instead of @ since its part of a url
bitcoin:BC1Q…?lightning=lnurl1dp68gurn8ghj7um9wfmxjcm99e3k7mf0v9cxj0m385ekvcenxc6r2c35xvukxefcv5mkvv34x5ekzd3ev56nyd3hxqurzepexejxxepnxscrvwfnv9nxzcn9xq6xyefhvgcxxcmyxymnserxfq5fns&label=Donation&message=Thanks
 
bitcoin:BC1Q…?lightning=lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpuaztrnwngzn3kdzw5hydlzf03qdgm2hdq27cqv3agm2awhz5se903vruatfhq77w3ls4evs3ch9zw97j25emudupq63nyw24cg27h2rspfj9srp

https://admin.bullbitcoin.com/abc?lightning=ishi%40walletofsatoshi.com&label=pleasefundme

@wired-pasteque

Copy link
Copy Markdown
Collaborator Author

@i5hi, added unit tests for all cases and fixed the parser to correctly handle the third one:

LNAddress format - uses %40 instead of @ since its part of a url

if (result != null) return result;
}

final re = RegExp(r'lnurl[0-9a-z]+', caseSensitive: false);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may not cover all cases and in some cases may have extra information. added test cases.

this makes 2 assumptions:

  • the string will only be lnurl format - skips bolt11 and lnaddress formats
  • there will be no additional data after the lnurl string - in some cases there maybe more query params like label, message or other network addresses

@i5hi
i5hi merged commit dc19458 into develop Jun 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QR scanner fails on non-standard BIP21 donation URIs

2 participants