Skip to main content

load_license

Macro load_license 

Source
macro_rules! load_license {
    ($license_path:expr) => { ... };
    ($license_path:expr, $key_path:expr) => { ... };
}
Expand description

Macro to load and validate a license at compile time.

This macro ensures that:

  1. The public key exists at compile time (include_str! fails otherwise)
  2. License validation happens early in the program

Returns Result<ValidatedLicense> - the caller decides how to handle errors.

§Usage

// In main.rs
let license = licenz_core::load_license!("license.lic")?;

Or with a custom key path:

let license = licenz_core::load_license!("license.lic", "keys/public.pem")?;

§Note

For policy enforcement (exit on failure, custom thresholds, etc.), use licenz-policy crate’s PolicyEnforcer instead.