use eva::fut::Fut; use viendesu_core::{ bail, types::captcha::Token, world::{World, WorldMut}, }; use self::error::CaptchaResult; pub mod error; pub trait Service: Send + Sync { fn verify( &self, w: World, token: &Token, ) -> impl Fut>; } impl Service for bool { async fn verify(&self, w: World, token: &Token) -> CaptchaResult<()> { _ = w; _ = token; if *self { Ok(()) } else { bail!("invalid captcha") } } }