license-api 0.2.11

License API client library
Documentation

license-api-rs

License API client library made with Rust

Installation

cargo add license-api

Code example

use inquire::{Password, Text};
use license_api::auth::LoginRequest;
use license_api::hwid::get_hwid;
use license_api::auth::LicenseAPI;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut api = LicenseAPI::new("http://localhost:8080");

    let hwid = get_hwid(true, "anything");
    let key = String::from("your-license-key");

    let creds = LoginRequest {
        key,
        hwid,
    };

    if let Ok(true) = api.login(&creds).await {
        println!("✔ Successfully logged in and HWID linked!");
    } else {
        println!("❌ Failed to login");
    }

    Ok(())
}