Skip to content

Improve v1 / v2 module separation #132

@DanGould

Description

@DanGould

#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apireceivereceiving payjoinsendsending payjoin

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions