diff --git a/README.md b/README.md index 4bfed3065..c42334fc1 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,16 @@ The Payjoin Dev Kit `payjoin` library implements both [BIP 78 Payjoin V1](https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki) and [BIP 77 Payjoin V2](https://github.com/bitcoin/bips/blob/master/bip-0077.md). +### Feature Flags + +The `payjoin` crate supports the following features: +- `v1`: Enables BIP 78 Payjoin V1 support. +- `v2`: Enables BIP 77 Payjoin V2 support (enabled by default). +- `directory`: Enables Payjoin Directory support. + +**Note:** +The crate will now build with no features enabled (e.g., `cargo build --no-default-features`), but in this configuration, no functionality is available. This is intended to support comprehensive CI and linting. To use the library, enable at least one of the features above. + ### `payjoin-cli` The [`payjoin-cli`](https://github.com/payjoin/rust-payjoin/tree/master/payjoin-cli) crate performs no-frills Payjoin as a reference implementation using Bitcoin Core wallet. diff --git a/payjoin/Cargo.toml b/payjoin/Cargo.toml index 65c3f2f83..6930e1c85 100644 --- a/payjoin/Cargo.toml +++ b/payjoin/Cargo.toml @@ -16,6 +16,8 @@ exclude = ["tests"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] +# The crate will build with no features enabled, but will provide no functionality. +# Enable at least one of: 'v1', 'v2', or 'directory' to use the library. default = ["v2"] #[doc = "Core features for payjoin state machines"] _core = ["bitcoin/rand-std", "serde_json", "url", "bitcoin_uri", "serde", "bitcoin/serde"] diff --git a/payjoin/src/lib.rs b/payjoin/src/lib.rs index af73afcee..e9d954f49 100644 --- a/payjoin/src/lib.rs +++ b/payjoin/src/lib.rs @@ -18,7 +18,11 @@ //! **Use at your own risk. This crate has not yet been reviewed by independent Rust and Bitcoin security professionals.** #[cfg(not(any(feature = "directory", feature = "v1", feature = "v2")))] -compile_error!("At least one of the features ['directory', 'v1', 'v2'] must be enabled"); +#[doc(hidden)] +pub mod no_features_enabled { + //! This crate was built with no features enabled. No functionality is available. + //! Enable at least one of the features: `directory`, `v1`, or `v2`. +} #[cfg(any(feature = "v2", feature = "directory"))] pub(crate) mod bech32;