bloop-sdk 0.2.0

Bloop error reporting and LLM tracing SDK for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use hmac::{Hmac, Mac};
use sha2::Sha256;

type HmacSha256 = Hmac<Sha256>;

/// Compute HMAC-SHA256 signature for a request body.
pub fn sign(key: &str, body: &[u8]) -> String {
    let mut mac = HmacSha256::new_from_slice(key.as_bytes())
        .expect("HMAC can take key of any size");
    mac.update(body);
    hex::encode(mac.finalize().into_bytes())
}