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
505 B
Rust
23 lines
505 B
Rust
mod github;
|
|
|
|
use crate::secret_validation::github::GithubSecretValidator;
|
|
use hyper::HeaderMap;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
|
pub enum SecretFormat {
|
|
GitHub,
|
|
}
|
|
|
|
impl SecretFormat {
|
|
pub fn validator(&self) -> impl SecretValidator {
|
|
match self {
|
|
SecretFormat::GitHub => GithubSecretValidator,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub trait SecretValidator {
|
|
fn validate(&self, headers: &HeaderMap, body: &[u8], secret: &[u8]) -> bool;
|
|
}
|