Skip to content

feat: add tls backend control through features to rust api client#443

Open
Alenar wants to merge 1 commit intoblockfrost:masterfrom
Alenar:master
Open

feat: add tls backend control through features to rust api client#443
Alenar wants to merge 1 commit intoblockfrost:masterfrom
Alenar:master

Conversation

@Alenar
Copy link

@Alenar Alenar commented Mar 16, 2026

Content

This PR add tls backend control through features to the rust api client.

This was done by upgrading the generator from 0.7.12 to 0.7.20 and regenerating the rust crate using yarn generate-types:rust.

Rational

At Mithril one of our current focus is switching all our binaries to static linking, for TLS we want to switch our backend from native-tls-vendored to rustls to remove all paths that build openssl but ... this blockfrost-openapi crate doesn't allow to control the features of its reqwest dependency as it is declared like this:

reqwest = { version = "^0.12", features = ["json", "multipart"] }

Meaning that it activate the default feature of reqwest which spread to our crates through the blockfrost crate.

Looking at the OpenApi generator project I found out that they added TLS backend control last year since version 7.13.0 and it was futher enhanced with later versions (e.g with configurable default backend in 7.17.0).

Additional impact

The generator also upgraded reqwest to 0.13+, which have some impacts (e.g. default backend switching from native-tls to rustls, rustls-tls feature renamed to rustls)

Another auto-generated change is the renaming of some enums variants from Array to ArrayVecString, I took a look at the blockfrost-rust crate and those variants were not used here, so it should be fine as long as third party crates are not using them (which I don't know).

Next

To allow full control of the TLS backend by child crates the blockfrost-rust Cargo.toml have to be updated to propagate the already available backend choice to the its blockfrost-openapi dependency.

A base patch could be this one:

diff --git a/Cargo.toml b/Cargo.toml
index f2843be..5a5231e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,10 +10,10 @@ repository = "https://github.com/blockfrost/blockfrost-rust"
 homepage = "https://blockfrost.io"
 
 [dependencies]
-blockfrost-openapi = "0.1.83"
+blockfrost-openapi = { version = "0.1.84", default-features = false }
 futures = "0.3.31"
 futures-timer = "3.0.3"
-reqwest = { version = "0.12.9", default-features = false, features = [
+reqwest = { version = "0.13.2", default-features = false, features = [
     "http2",
     "charset",
     "macos-system-configuration",
@@ -32,7 +32,8 @@ tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] }
 
 [features]
 default = ["default-tls"]
-default-tls = ["reqwest/default-tls"]
+default-tls = ["reqwest/rustls-tls", "blockfrost-openapi/rustls"]
+native-tls = ["reqwest/native-tls", "blockfrost-openapi/native-tls"]
 rustls-tls = ["reqwest/rustls-tls"]
 rustls-tls-manual-roots = ["reqwest/rustls-tls-manual-roots"]
 rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"]

Several notes:

  • the blockfrost-openapi 0.1.84 version is tentative.
  • reqwest is upgraded to 0.13.2 to be consistent with the version now used in blockfrost-openapi
  • I added a native-tls feature since before native-tls backend could only be set though the default-tls feature which have changed to rustls
  • you may want to rename the rustls-tls feature to rustls like what reqwest did

I can do a PR on the blockfrost-rust repository but I feel that those choices are not neutral, so they should be made by core maintainers.

by upgrading the generator from `0.7.12` to `0.7.20`

This also upgrade `reqwest` to `0.13+`.
@vercel
Copy link

vercel bot commented Mar 16, 2026

@Alenar is attempting to deploy a commit to the Five Binaries IOG Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant