Crate licenses_pro

source ·
Expand description

This crate allows you to verify and generate licenses.

§Example usage

use licenses_pro::gen::*;
use licenses_pro::LicenseStructParameters;
let generator=AdminGenerator::new_with_random_ivs(LicenseStructParameters::default());
// This generates a license with a seed, which should be constant length unique identifier.
// This example just uses some random bytes as a seed. The seed should be the same length as specified in the LicenseStructParameters
let license=generator.generate_license(vec![5, 100, 42, 69, 3,90]).unwrap();
println!("{}",license.to_human_readable()); // BWQq-RQNa-kDp6-mJn8-SSEh-UStw-p9+q-krw1-KDH4-mw

Meanwhile on the client side

use licenses_pro::check::*;
use licenses_pro::LicenseStructParameters;
let parsed=License::from_human_readable("BWQq-RQNa-kDp6-mJn8-SSEh-UStw-p9+q-krw1-KDH4-mw".to_string(),LicenseStructParameters::default()).unwrap();
let verify_result=verify_license(parsed,LicenseCheckInfo {
       known_iv: vec![43, 194, 247, 127, 168, 171, 16],
       iv_index: 0,
   },licenses_pro::blockers::NoBlock);
// Go ahead and match this!

Modules§

  • Block compromised licenses
  • Check licenses generated by the generator
  • Generate valid licenses

Structs§

  • Information about the structure of your license. This must be shared between your generator and checker.