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

Improve v1 / v2 module separation #132

Closed
DanGould opened this issue Dec 11, 2023 · 1 comment
Closed

Improve v1 / v2 module separation #132

DanGould opened this issue Dec 11, 2023 · 1 comment
Labels
api receive receiving payjoin send sending payjoin

Comments

@DanGould
Copy link
Contributor

#101 was merged based on correctness and clean v1 / v2 separation so that new releases don't break v1-only clients in production

New releases should prioritize v2 as it becomes production ready, eventually making v2 the default, especially since it is compatible with v2.

This merge included many #[cfg] directives and duplicated code. Notably:

  • uri.rs [duplicates finalize serialization](https://github.com/payjoin/rust-payjoin
    /blob/5f8ab7f046b442ffd8b79f515918d9db2cd64501/payjoin/src/uri.rs#L173-L240)
  • payjoin/v2.rs includes both send and receive module functionality that should be only compiled in the modules where they are necessary
  • payjoin/v2.rs encapsulates the v1 state machine, making handler code that calls similarly named functions incompatible for both. A trait system could allow both to work, or the v1 functionality could be completely encapsulated by a single typestate machine supporting both v1 and v2. The demand for separate conditional compilation for v1 alone is yet to be seen. Having stable ohttp and hpke crates would make default v2 support more savory.
@DanGould DanGould added receive receiving payjoin send sending payjoin api labels Dec 11, 2023
@DanGould DanGould added this to the Payjoin V2 beta milestone Dec 11, 2023
@DanGould
Copy link
Contributor Author

DanGould commented Dec 20, 2023

edit: this concern has been addressed in payjoin-0.13.0

Another related issue here is that rustdocs were not updated to include payjoin v2 feature for payjoin-0.12.0. Checking the docs should be part of a release checklist.

[package.metadata.docs.rs]
features = ["send", "receive", "base64"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api receive receiving payjoin send sending payjoin
Projects
Status: Done
Development

No branches or pull requests

1 participant