use hmac::{Hmac, Mac};
use sha2::Sha256;
use uuid::Uuid;
pub fn identity_hash(user_id: &str, identity_secret: &str) -> String {
let mut mac = Hmac::<Sha256>::new_from_slice(identity_secret.as_bytes())
.expect("HMAC takes keys of any length");
mac.update(user_id.as_bytes());
crate::webhooks::hex(&mac.finalize().into_bytes())
}
pub fn purchase_token(site_id: &str, user_id: &str) -> String {
let namespace = Uuid::new_v5(
&Uuid::NAMESPACE_URL,
format!("hatang:site:{site_id}").as_bytes(),
);
Uuid::new_v5(&namespace, user_id.as_bytes()).to_string()
}