Prepare sensitive_url for crates.io (#8223)

Another good candidate for publishing separately from Lighthouse is `sensitive_url` as it's a general utility crate and not related to Ethereum. This PR prepares it to be spun out into its own crate.


  I've made the `full` field on `SensitiveUrl` private and instead provided an explicit getter called `.expose_full()`. It's a bit ugly for the diff but I prefer the explicit nature of the getter.
I've also added some extra tests and doc strings along with feature gating `Serialize` and `Deserialize` implementations behind the `serde` feature.


Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
Mac L
2025-11-05 11:46:32 +04:00
committed by GitHub
parent 7b1cbca264
commit 3066f0bef2
16 changed files with 225 additions and 93 deletions

View File

@@ -481,7 +481,12 @@ fn run_execution_jwt_secret_key_is_persisted() {
.with_config(|config| {
let config = config.execution_layer.as_ref().unwrap();
assert_eq!(
config.execution_endpoint.as_ref().unwrap().full.to_string(),
config
.execution_endpoint
.as_ref()
.unwrap()
.expose_full()
.to_string(),
"http://localhost:8551/"
);
let mut file_jwt_secret_key = String::new();
@@ -532,7 +537,12 @@ fn bellatrix_jwt_secrets_flag() {
.with_config(|config| {
let config = config.execution_layer.as_ref().unwrap();
assert_eq!(
config.execution_endpoint.as_ref().unwrap().full.to_string(),
config
.execution_endpoint
.as_ref()
.unwrap()
.expose_full()
.to_string(),
"http://localhost:8551/"
);
assert_eq!(

View File

@@ -109,12 +109,12 @@ fn beacon_nodes_flag() {
.run()
.with_config(|config| {
assert_eq!(
config.beacon_nodes[0].full.to_string(),
config.beacon_nodes[0].expose_full().to_string(),
"http://localhost:1001/"
);
assert_eq!(config.beacon_nodes[0].to_string(), "http://localhost:1001/");
assert_eq!(
config.beacon_nodes[1].full.to_string(),
config.beacon_nodes[1].expose_full().to_string(),
"https://project:secret@infura.io/"
);
assert_eq!(config.beacon_nodes[1].to_string(), "https://infura.io/");