pub fn generate(body: &[u8], secret: &str) -> StringExpand description
Compute the wire-format signature for body keyed by secret.
Returns a string of the form "sha256=<lowercase hex>". The hex digest is
64 characters long (32 bytes of HMAC-SHA256 output).
§Panics
Never. HMAC-SHA256 accepts keys of any length, so the underlying
Hmac::new_from_slice call cannot fail; the expect documents the
invariant.
§Examples
use tango_webhooks::generate;
let sig = generate(b"hello", "shh");
assert_eq!(
sig,
"sha256=0e396369ee043c5b6b922743631745b2249cf7cb2c4722e61e802447d5d14c70",
);