diff --git a/examples/Cargo.toml b/examples/Cargo.toml index fe7a397..8b1c7e7 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -21,7 +21,7 @@ name = "demo-server" path = "src/server.rs" [dependencies] -tsp = { path = "../tsp" } +tsp = { path = "../tsp", features = ["async"] } axum = { workspace = true} base64ct = { workspace = true } clap = { workspace = true} diff --git a/tsp/src/error.rs b/tsp/src/error.rs index 0157207..0c3a7ca 100644 --- a/tsp/src/error.rs +++ b/tsp/src/error.rs @@ -31,8 +31,12 @@ pub enum Error { MissingVid(String), #[error("Error: unresolved vid {0}")] UnverifiedVid(String), + #[cfg(feature = "async")] #[error("Error: no relation with sender {0}")] UnverifiedSource(String, Option>), + #[cfg(not(feature = "async"))] + #[error("Error: no relation with sender {0}")] + UnverifiedSource(String), #[error("Error: unresolved next hop {0}")] UnresolvedNextHop(String), #[error("Error: no relation with next hop {0}")] diff --git a/tsp/src/store.rs b/tsp/src/store.rs index 25788e6..0a4041c 100644 --- a/tsp/src/store.rs +++ b/tsp/src/store.rs @@ -544,7 +544,10 @@ impl Store { let sender = String::from_utf8(sender.to_vec())?; let Ok(sender_vid) = self.get_verified_vid(&sender) else { + #[cfg(feature = "async")] return Err(Error::UnverifiedSource(sender, None)); + #[cfg(not(feature = "async"))] + return Err(Error::UnverifiedSource(sender)); }; let (nonconfidential_data, payload) = @@ -565,6 +568,7 @@ impl Store { if self.get_verified_vid(inner_vid).is_err() { return Err(Error::UnverifiedSource( inner_vid.to_owned(), + #[cfg(feature = "async")] Some(inner.to_vec()), )); }