Add introducers
- add the `Introducer` types - get introducers from the certificate store (and log them)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// husk-milter
|
||||
//
|
||||
// introducers
|
||||
//
|
||||
|
||||
use sequoia_wot as wot;
|
||||
use wot::{CertSynopsis, Certification};
|
||||
use sequoia_openpgp::{policy::StandardPolicy, Cert, KeyID};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Introducer {
|
||||
pub cert: CertSynopsis,
|
||||
pub certification: Certification,
|
||||
}
|
||||
|
||||
impl Introducer {
|
||||
|
||||
pub fn can_introduce(&self, email: &str) -> bool {
|
||||
if let Some(regexset) = self.certification.regular_expressions() {
|
||||
if regexset.matches_everything() {
|
||||
// return false, because unlimited certifications are
|
||||
// ignored.
|
||||
false
|
||||
} else {
|
||||
regexset.is_match(email)
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user