Skip to main content

LicenseStorage

Trait LicenseStorage 

Source
pub trait LicenseStorage {
    // Required methods
    fn save_license(&self, license: &License) -> Result<(), LicenseError>;
    fn load_license(&self) -> Result<License, LicenseError>;
    fn license_exists(&self) -> bool;
    fn delete_license(&self) -> Result<(), LicenseError>;
}
Expand description

Trait for applications to implement custom license storage.

Implement this trait to provide custom license storage mechanisms (e.g., encrypted files, secure enclaves, cloud storage).

§Example

use librnxengine::{LicenseStorage, License, LicenseError};

struct EncryptedFileStorage {
    path: std::path::PathBuf,
    encryption_key: [u8; 32],
}

impl LicenseStorage for EncryptedFileStorage {
    fn save_license(&self, license: &License) -> Result<(), LicenseError> {
        // Custom encryption logic here
        Ok(())
    }

    fn load_license(&self) -> Result<License, LicenseError> {
        // Custom decryption logic here
        todo!()
    }
}

Required Methods§

Source

fn save_license(&self, license: &License) -> Result<(), LicenseError>

Saves a license to the custom storage backend.

Source

fn load_license(&self) -> Result<License, LicenseError>

Loads a license from the custom storage backend.

Source

fn license_exists(&self) -> bool

Checks if a license exists in the storage backend.

Source

fn delete_license(&self) -> Result<(), LicenseError>

Removes a license from the storage backend.

Implementors§