Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contrib/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ set -e

# https://github.com/taiki-e/cargo-llvm-cov?tab=readme-ov-file#merge-coverages-generated-under-different-test-conditions
cargo llvm-cov clean --workspace # remove artifacts that may affect the coverage results
cargo llvm-cov --no-report --features=send,receive
cargo llvm-cov --no-report --features=v2,_danger-local-https,io
cargo llvm-cov --no-report --no-default-features --features=v1,_danger-local-https
cargo llvm-cov --no-report --no-default-features --features=v2,_danger-local-https,io
cargo llvm-cov report --lcov --output-path lcov.info # generate report without tests
4 changes: 2 additions & 2 deletions contrib/lint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e

cargo clippy --all-targets --keep-going --features=send,receive -- -D warnings
cargo clippy --all-targets --keep-going --features=v2,_danger-local-https,io -- -D warnings
cargo clippy --all-targets --keep-going --no-default-features --features=v1,_danger-local-https -- -D warnings
cargo clippy --all-targets --keep-going --no-default-features --features=v2,_danger-local-https,io -- -D warnings
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
inherit src;
})
) {
"payjoin" = "--features v2,send,receive";
"payjoin" = "--features v2";
"payjoin-cli" = "--features v1,v2";
"payjoin-directory" = "";
};
Expand Down
6 changes: 3 additions & 3 deletions payjoin-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ path = "src/main.rs"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["v1"]
default = ["v2"]
native-certs = ["reqwest/rustls-tls-native-roots"]
_danger-local-https = ["rcgen", "reqwest/rustls-tls", "rustls", "hyper-rustls", "payjoin/_danger-local-https", "tokio-rustls"]
v1 = ["hyper", "hyper-util", "http-body-util"]
v1 = ["payjoin/v1","hyper", "hyper-util", "http-body-util"]
v2 = ["payjoin/v2", "payjoin/io"]

[dependencies]
Expand All @@ -37,7 +37,7 @@ hyper = { version = "1", features = ["http1", "server"], optional = true }
hyper-rustls = { version = "0.26", optional = true }
hyper-util = { version = "0.1", optional = true }
log = "0.4.7"
payjoin = { version = "0.22.0", features = ["send", "receive", "base64"] }
payjoin = { version = "0.22.0", features = ["base64"], default-features = false }
rcgen = { version = "0.11.1", optional = true }
reqwest = { version = "0.12", default-features = false }
rustls = { version = "0.22.4", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion payjoin-cli/contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -e

cargo test --locked --package payjoin-cli --verbose --no-default-features --features=_danger-local-https,v2 --test e2e
cargo test --locked --package payjoin-cli --verbose --features=_danger-local-https
cargo test --locked --package payjoin-cli --verbose --no-default-features --features=v1,_danger-local-https
6 changes: 3 additions & 3 deletions payjoin-cli/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ mod e2e {
.arg("--rpchost")
.arg(&receiver_rpchost)
.arg("--cookie-file")
.arg(&cookie_file)
.arg(cookie_file)
.arg("--db-path")
.arg(&receiver_db_path_clone)
.arg("receive")
.arg(RECEIVE_SATS)
.arg("--port")
.arg(&port.to_string())
.arg(port.to_string())
.arg("--pj-endpoint")
.arg(&pj_endpoint)
.stdout(Stdio::piped())
Expand Down Expand Up @@ -110,7 +110,7 @@ mod e2e {
.arg("--rpchost")
.arg(&sender_rpchost)
.arg("--cookie-file")
.arg(&cookie_file)
.arg(cookie_file)
.arg("--db-path")
.arg(&sender_db_path_clone)
.arg("send")
Expand Down
6 changes: 3 additions & 3 deletions payjoin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ exclude = ["tests"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
send = []
receive = ["bitcoin/rand"]
default = ["v2"]
base64 = ["bitcoin/base64"]
v1 = ["bitcoin/rand"]
v2 = ["bitcoin/rand", "bitcoin/serde", "hpke", "dep:http", "bhttp", "ohttp", "serde", "url/serde" ]
#[doc = "Functions to fetch OHTTP keys via CONNECT proxy using reqwest. Enables `v2` since only `v2` uses OHTTP."]
io = ["v2", "reqwest/rustls-tls"]
Expand Down Expand Up @@ -54,4 +54,4 @@ tracing = "0.1.40"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }

[package.metadata.docs.rs]
features = ["send", "receive", "base64", "v2", "io"]
features = ["base64", "v2", "io"]
4 changes: 0 additions & 4 deletions payjoin/src/hpke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ impl<'de> serde::Deserialize<'de> for HpkePublicKey {
}

/// Message A is sent from the sender to the receiver containing an Original PSBT payload
#[cfg(feature = "send")]
pub fn encrypt_message_a(
body: Vec<u8>,
reply_pk: &HpkePublicKey,
Expand All @@ -192,7 +191,6 @@ pub fn encrypt_message_a(
Ok(message_a.to_vec())
}

#[cfg(feature = "receive")]
pub fn decrypt_message_a(
message_a: &[u8],
receiver_sk: HpkeSecretKey,
Expand Down Expand Up @@ -223,7 +221,6 @@ pub fn decrypt_message_a(
}

/// Message B is sent from the receiver to the sender containing a Payjoin PSBT payload or an error
#[cfg(feature = "receive")]
pub fn encrypt_message_b(
mut plaintext: Vec<u8>,
receiver_keypair: &HpkeKeyPair,
Expand All @@ -246,7 +243,6 @@ pub fn encrypt_message_b(
Ok(message_b.to_vec())
}

#[cfg(feature = "send")]
pub fn decrypt_message_b(
message_b: &[u8],
receiver_pk: HpkePublicKey,
Expand Down
6 changes: 0 additions & 6 deletions payjoin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@

pub extern crate bitcoin;

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

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

#[cfg(feature = "v2")]
Expand All @@ -39,11 +36,8 @@ pub(crate) mod bech32;
#[cfg(feature = "io")]
pub mod io;

#[cfg(any(feature = "send", feature = "receive"))]
pub(crate) mod psbt;
#[cfg(any(feature = "send", all(feature = "receive", feature = "v2")))]
mod request;
#[cfg(any(feature = "send", all(feature = "receive", feature = "v2")))]
pub use request::*;

mod uri;
Expand Down
7 changes: 5 additions & 2 deletions payjoin/src/send/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
//!
//! This module contains types and methods used to implement sending via Payjoin.
//!
//! For most use cases, it is recommended to start with the [`v2`] module, as it is
//! backwards compatible and provides the latest features. If you specifically need to use
//! For most use cases, we recommended enabling the `v2` feature, as it is
//! backwards compatible and provides the most convenient experience for users and implementors.
#![cfg_attr(feature = "v2", doc = "To use version 2, refer to [`v2`] module documentation.")]
//!
//! If you specifically need to use
//! version 1, refer to the [`v1`] module documentation.

use std::str::FromStr;
Expand Down
1 change: 0 additions & 1 deletion payjoin/tests/integration.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[cfg(all(feature = "send", feature = "receive"))]
mod integration {
use std::collections::HashMap;
use std::env;
Expand Down