Skip to content

Should the _manual-tls feature include enabling reqwest? #1483

@benalleng

Description

@benalleng

In the payjoin crate our Cargo.toml states

io = ["v2", "reqwest/rustls-tls"]
_manual-tls = ["reqwest/rustls-tls", "rustls"]

but the only place this is used for is

#[cfg(feature = "_manual-tls")]
pub async fn fetch_ohttp_keys_with_cert(
ohttp_relay: impl IntoUrl,
payjoin_directory: impl IntoUrl,
cert_der: &[u8],
) -> Result<OhttpKeys, Error> {
let ohttp_keys_url = payjoin_directory.into_url()?.join("/.well-known/ohttp-gateway")?;
let proxy = Proxy::all(ohttp_relay.into_url()?.as_str())?;
let client = Client::builder()
.use_rustls_tls()
.add_root_certificate(reqwest::tls::Certificate::from_der(cert_der)?)
.proxy(proxy)
.http1_only()
.build()?;
let res = client
.get(ohttp_keys_url)
.timeout(Duration::from_secs(10))
.header(ACCEPT, "application/ohttp-keys")
.send()
.await?;
parse_ohttp_keys_response(res).await
}

Should we require this to be gated behind both io and _manual-tls with a

#[cfg(all(feature = "_manual-tls", feature = "io"))]

Or can the reqwest dep just be safely removed already since it is inside of io.rs?

With this change we would be able to completely close #1124 following the merge of #1377

Right now in benalleng:url-rewrite the following command still shows a build dep of url without the io feature (while _manual-tls and _test-utils are dev features they are not explicitly io so I want to make sure that it is foolproof)

cargo tree -p payjoin --no-default-features --features v1,v2,directory,_manual-tls,_test-utils -i url -e no-dev,no-build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions