use crate::error::PakeError;
use alloc::vec::Vec;
use subtle::ConstantTimeEq;
pub trait Mac {
fn mac(key: &[u8], msg: &[u8]) -> Result<Vec<u8>, PakeError>;
fn verify(key: &[u8], msg: &[u8], tag: &[u8]) -> Result<(), PakeError> {
let computed = Self::mac(key, msg)?;
if computed.ct_eq(tag).into() {
Ok(())
} else {
Err(PakeError::ProtocolError("MAC verification failed"))
}
}
}