pulsesecurity

Crates.iopulsesecurity
lib.rspulsesecurity
version0.1.3
sourcesrc
created_at2024-08-02 19:49:56.363265
updated_at2024-08-14 19:41:00.075222
descriptionPulse Security SDK
homepagehttps://www.pulsesecurity.org
repositoryhttps://github.com/pulsesec/pulse-sdk-rust
max_upload_size
id1323635
size10,766
(saucesteals)

documentation

README

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")
            }
        },
    }
}
Commit count: 0

cargo fmt