-
Notifications
You must be signed in to change notification settings - Fork 5.7k
BIP77: Propose to encode +
as %2B
in pj param of Bitcoin URIs
#1885
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
base: master
Are you sure you want to change the base?
Conversation
@DanGould @nothingmuch Happy to hear your thoughts and discuss. Also sharing this stackoverflow from @ethicnology which shows the problem with the current unencoded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking over the commits separately, and it appears that all of these commits amend the same two sections. Please squash your commits into a single commit to reduce confusion.
NACK, this change is unnecessary.
It's safe (by design in the context of BIP77) to convert The reason this is safe is that the spec avoids The problem originates not with the spec but the specific golang & dart URI libraries, which afaict automatically and destructively modify the Note that all of the fields are included in print(uri.queryParameters['pj']);
// HTTPS://PAYJO.IN/Z55YEYZ3N0RFJ#RK1QVWFRUJ48GT052V0VRJF9RR7R8LXYSLWJEGK0JZZ5YYP8WJ87SKH6 OH1QYP87E2AVMDKXDTU6R25WCPQ5ZUF02XHNPA65JMD8ZA2W4YRQN6UUWG EX1Z3EKY6Q Also note that it's already valid to encode this as So based on all of these arguments, I think it would be better to not change the spec in this way. Requiring that all implementations always escape in this way would impose exactly the same kind of burden of having to work around generic URI libraries that don't implement escaping of + (i suspect most would not), necessitating the transformation of the encoded strings. This seems worse than only requiring implementations that rely on libraries that unconditionally do this mangling to work around that behavior, or switch to a library that more closely follows the spec. An alternative might be to select a different character that is still in the QR alphanumeric set, perhaps In the particular example of bb mobile, is there anything that prevents using the |
Thanks for the thorough explanation. And after going through the RFC3986 specs again, I think I do understand now that |
Yeah it's not ideal, and I mainly chose We had a similar question with regards to the ordering of these parameters not realizing they should probably have a defined order, and ended up just specifying the order that we implemented without much thought (which turned out to be reverse lexicographical, which is also a bit of a gotcha). Taken together maybe these two gotchas motivate a change even though the spec has been merged? The Core implementation is not yet at the stage of dealing with these things so the consequences should be minimal. @DanGould, what do you think? |
If those production implementors are comfortable with another breaking change, especially since we're able to offer a transition period with PDK, I'm ok with making one. It sounds like both Bull and Cake are ok with this path forward. I would want to make sure the parsers don't complain about For the time being I would recommend they take you up on your suggestion so that at least the current implementations are not broken. |
Even though it's a breaking change, my first thought (depends on the implementation though) is that users aren't really affected as they don't process the pj parameter themselves, they just pass it on to PDK as extracted from the Bitcoin URI. So from a user's point-of-view, it doesn't really matter or shouldn't require any changes as long as parsing the Bitcoin URI doesn't break the pj parameter. Of course inconsistencies in versions will make it incompatible, but currently no two production implementations are on the same version anyways. Both |
Or, another way to go about it, would be keeping the
Instead of every user having to take care of replacing (But yeah, this feels hacky and maybe again error prone, so better to have only one specified way) |
This PR proposes to percent-encode the
+
character used in the Payjoin mailbox URI (pj parameter) as%2B
when included in a query parameter of a Bitcoin URI.The reason is the same as the
#
fragment char that is encoded as%23
to avoid it being parsed as a fragment of the Bitcoin URI instead of the payjoin URI. The+
character also has reserved meaning in query parameter contexts (Bitcoin URI), different from in path contexts (payjoin URI), and improper encoding can break parsing in standards-compliant URI parsers.This change ensures:
%2B
is used (%2b
shouldn't be used as clarified in the change to the bip)