1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! # Payjoin implementation in Rust
//!
//! **Important: this crate is WIP!**
//!
//! While I don't think there's a huge risk running it, don't rely on its security for now!
//! Please at least review the code that verifies there's no overpayment and let me know you did.
//!
//! This is a library and an example binary implementing BIP78 Payjoin.
//! The library is perfectly IO-agnostic - in fact, it does no IO.
//! The primary goal of such design is to make it easy to unit test.
//! While we're not there yet, it already has infinitely more tests than the Payjoin PR against Electrum. :P
//!
//! Additional advantage is it doesn't care whether you use `async`, blocking, `tokio`, `sync-std` `hyper`, `actix` or whatever.
//! There are already too many frameworks in Rust so it's best avoiding directly introducing them into library code.
//!
//! To use this library as a sender (client, payer), you need to enable `send` Cargo feature.
//!
//! To use this library as a receiver (server, payee), you need to enable `receive` Cargo feature.

pub extern crate bitcoin;

#[cfg(feature = "receive")]
pub mod receive;
#[cfg(feature = "receive")]
pub use crate::receive::Error;

#[cfg(feature = "send")]
pub mod send;

#[cfg(any(feature = "send", feature = "receive"))]
pub(crate) mod input_type;
#[cfg(any(feature = "send", feature = "receive"))]
pub(crate) mod psbt;
mod uri;
#[cfg(any(feature = "send", feature = "receive"))]
pub(crate) mod weight;

#[cfg(feature = "base64")]
pub use bitcoin::base64;
pub use uri::{PjParseError, PjUri, Uri};