INNER CODE UNIT · Rust
check_hmac
renegade-fi/renegade · crates/api/gossip-api/src/lib.rs:35
pub fn check_hmac<M: Serialize>(req: &M, mac: &[u8], key: &HmacKey) -> bool {
let expected = create_hmac(req, key);
expected == mac
}
/// The destination to which a request should be sent
pub enum GossipDestination {
/// To the gossip server
GossipServer,
/// Directly handled in the network layer
NetworkManager,
}
#[cfg(test)]
mod tests {
use crate::request_response::{GossipRequest, GossipRequestType};
use super::*;