pub struct OtpGate {
pub enabled: bool,
pub gated_actions: Vec<String>,
pub gated_domains: Vec<String>,
pub gated_domain_categories: Vec<String>,
pub cache_valid_secs: u64,
/* private fields */
}Expand description
OTP gating engine — checks whether an action or domain requires OTP.
Fields§
§enabled: bool§gated_actions: Vec<String>§gated_domains: Vec<String>§gated_domain_categories: Vec<String>§cache_valid_secs: u64Implementations§
Source§impl OtpGate
impl OtpGate
pub fn new( enabled: bool, gated_actions: Vec<String>, gated_domains: Vec<String>, gated_domain_categories: Vec<String>, cache_valid_secs: u64, ) -> Self
pub fn disabled() -> Self
Sourcepub fn check_action(&self, action: &str) -> OtpGateResult
pub fn check_action(&self, action: &str) -> OtpGateResult
Check if an action requires OTP.
Sourcepub fn check_domain(&self, domain: &str) -> OtpGateResult
pub fn check_domain(&self, domain: &str) -> OtpGateResult
Check if a domain requires OTP.
Sourcepub fn record_approval(&mut self, key: &str)
pub fn record_approval(&mut self, key: &str)
Record an OTP approval for caching.
Sourcepub fn approve_action(&mut self, action: &str)
pub fn approve_action(&mut self, action: &str)
Record an action approval after successful OTP validation.
Sourcepub fn approve_domain(&mut self, domain: &str)
pub fn approve_domain(&mut self, domain: &str)
Record a domain approval after successful OTP validation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OtpGate
impl RefUnwindSafe for OtpGate
impl Send for OtpGate
impl Sync for OtpGate
impl Unpin for OtpGate
impl UnsafeUnpin for OtpGate
impl UnwindSafe for OtpGate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more