Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support decoding uppercase bolt11 values #9

Closed
wants to merge 2 commits into from

Conversation

frnandu
Copy link

@frnandu frnandu commented Dec 24, 2023

According to https://docs.lightning.engineering/the-lightning-network/payment-lifecycle/understanding-lightning-invoices:

"Lightning Network invoices, like other bech32 encoded strings, are typically entirely lowercase. However, there are significant space improvements when encoding uppercase characters only in QR codes, which is why you might encounter uppercase Lightning invoices more frequently. This is also why a Lightning invoice QR code might decode as uppercase only."

So I think this should support decoding also uppercase invoices.
For example Zeus generates invoices in uppercase for QR codes, and when I pay directly with my LND it lands on my list of payments as uppercase.
Then when using for example nostr-wallet-connect for listing transactions (new extensions), it uses this lib for bolt11 decoding and it can't decode.
I think instead of forcing each dependency to remember to lowercase the bolt11 before decoding it, we could just lowercase it here.

@fiatjaf fiatjaf closed this in a1a4565 Dec 25, 2023
@fiatjaf
Copy link
Collaborator

fiatjaf commented Dec 25, 2023

Thank you, this was a bug indeed, but force-lowercasing the invoice is a bad solution because then it would work with mixed-case invoices, which is forbidden by the spec as it allows for phishing (yeah, very theoretical).

@fiatjaf
Copy link
Collaborator

fiatjaf commented Dec 25, 2023

Fix released in v1.6.1.

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.

2 participants