diff --git a/client/src/main.rs b/client/src/main.rs index 9b56fc0..a3566fc 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -106,7 +106,7 @@ fn call_api( let data_s = serde_json::to_string(&data)?; info!("body: {}", data_s); let signature = crypto::sign(config.secret.as_bytes(), data_s.as_bytes()); - let signature = crypto::bytes_to_hex_str(&signature)?; + let signature = crypto::bytes_to_hex_str(&signature); let client = reqwest::Client::new(); let url = format!("{}/record", config.host); Ok(if method == Method::POST { diff --git a/crypto/src/lib.rs b/crypto/src/lib.rs index 786895e..84d363a 100644 --- a/crypto/src/lib.rs +++ b/crypto/src/lib.rs @@ -55,10 +55,8 @@ use ring::{digest, hmac}; type Result = std::result::Result; /// Converts a byte slice to a lowercase hex string. -pub fn bytes_to_hex_str(bytes: &[u8]) -> Result { - let mut output = String::new(); - bytes.write_hex(&mut output)?; - Ok(output) +pub fn bytes_to_hex_str(bytes: &[u8]) -> String { + bytes.encode_hex::() } /// Converts a hey string to a vec of bytes.