4 releases
0.1.3 | Aug 14, 2024 |
---|---|
0.1.2 | Aug 2, 2024 |
0.1.1 | Aug 2, 2024 |
0.1.0 | Aug 2, 2024 |
#1958 in Web programming
21 downloads per month
10KB
199 lines
Pulse Security
Rust SDK
Installation
cargo add pulsesecurity
pulsesecurity = "0.1.2"
Verification
use pulsesecurity::{Pulse, PulseError};
#[tokio::main]
async fn main() {
let pulse = Pulse::new("SITE_KEY".to_string(), "SECRET_KEY".to_string());
let token = "REQUEST_TOKEN".to_string();
match pulse.classify(token).await {
Ok(is_bot) => {
println!("Result: {}", is_bot);
}
Err(err) => match err {
PulseError::TokenNotFoundError(_) => {
println!("Token not found");
}
PulseError::TokenUsedError(_) => {
println!("Token already used");
}
PulseError::TokenExpiredError(_) => {
println!("Token expired");
}
_ => {
println!("Unknown error")
}
},
}
}
Dependencies
~7–19MB
~258K SLoC