You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
501 B
Rust
23 lines
501 B
Rust
mod hash_mac;
|
|
|
|
use crate::secret_validation::hash_mac::HMacSecretValidator;
|
|
use hyper::HeaderMap;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
|
pub enum SecretFormat {
|
|
HMac,
|
|
}
|
|
|
|
impl SecretFormat {
|
|
pub fn validator(&self) -> impl SecretValidator {
|
|
match self {
|
|
SecretFormat::HMac => HMacSecretValidator,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub trait SecretValidator {
|
|
fn validate(&self, headers: &HeaderMap, body: &[u8], secret: &[u8]) -> bool;
|
|
}
|