rustify-licensing 0.1.0

Framework-agnostic in-app licensing (validate / machine-activate / offline-grace) for native Rust apps. Keygen provider + Bevy / egui / headless adapters.
Documentation
//! The load-bearing distinction in the whole system: was the "no" *authoritative*
//! (lock now, ignore grace) or *transient* (honor the offline grace window)?

use std::fmt;

/// Why a license check couldn't reach a positive verdict. The distinction decides
/// whether we honor the offline grace window or **fail closed**.
///
/// A subtle failure mode to avoid: treating *all* errors as "offline" — a wrong-account or
/// revoked license then silently rode the grace window. Mapping authoritative 4xx
/// answers to [`CheckErr::Denied`] (no grace) is what fixes that.
#[derive(Debug, Clone)]
pub enum CheckErr {
    /// Authoritative rejection (4xx: wrong account, unauthorized, bad request) — the
    /// server answered "no". Lock; do **not** ride offline grace.
    Denied(String),
    /// Transient connectivity issue (network error, timeout, 429/5xx, or an ambiguous
    /// non-JSON body — e.g. a captive portal). Honor the offline grace window.
    Offline(String),
}

impl fmt::Display for CheckErr {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            CheckErr::Denied(s) | CheckErr::Offline(s) => write!(f, "{s}"),
        }
    }
}

impl std::error::Error for CheckErr {}