Add version 2 (reduce QR-Code Density) #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a draft and open for discussion.
The main goal is to reduce the density of the lndconnect QR-Code, which causes problems on some scanning devices and leads to bad UX in general.
In the proposed solution there are two notable changes:
Until now, no versioning system exists.
That's why for version 2 I changed the Uri from lndconnect:// to lndconn://
By doing this we will not break any existing implementations.
In the new version a query param "v" is added which is used for versioning to allow future updates.
In the current proposal the new version (2) is the default and you have to explicitly use --version=1 to generate an old connect string.
Density optimizations:
The error correction reduction for the QR-Code is also done for version 1 in this PR as it is a non breaking change.
Comparison images:
v1 - old:
v1 - new:
v2:
I successfully tested certificate validation by hash on a custom build of Zap Android to proof that v2 is actually working.
This PR does not include an update for the documentation. I can add that later when we come to an consensus on what to do :)
Alternative solution:
Instead of a version 2 we could also just add a --certificateHash flag and reduce the error correction levels to low. The density reduction from shortening names is marginal and can be omitted.
It is a simple change but that would mean wallets that already support lndconnect would receive certificate hashes instead of full certificates without knowing it and fail although they claim to support it. (As long as they don't support the new specs)
For backwards compatibility wallets would have to implement a check of the certificate length. If it matches 32 byte (sha256 length) it is clear that the certificate is hashed, if not, it should be treated as a full certificate.
Additional note:
It might be possible to further reduce density by encoding with bech32 and use the upper case version, but that seems like it makes implementation of lndconnect unnecessarily complex for little benefit. With the optimizations from above the code is already easy to scan again.