From b1615fd3ddc6ed97313601fc6f2074094146ed9e Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 16 Aug 2018 01:34:28 +0000 Subject: [PATCH] add an error message --- examples/github.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/github.rs b/examples/github.rs index 71f2a4f..7b9f9a5 100644 --- a/examples/github.rs +++ b/examples/github.rs @@ -51,11 +51,11 @@ fn main() -> Result<(), Error> { mac.input(payload.body.as_bytes()); let signature = mac.result().code().into_iter().map(|b| format!("{:02x}", b)).collect::>().join(""); - let auth = payload.headers.get("X-Hub-Signature").ok_or(err_msg("Missing auth header."))?; + let auth = payload.headers.get("X-Hub-Signature").ok_or(err_msg("Missing auth header"))?; let left = SecStr::from(format!("sha1={}", signature)); let right = SecStr::from(auth.bytes().collect::>()); - assert_eq!(left, right); + assert!(left == right, "HMAC signature didn't match"); println!("{}", payload.body); Ok(())