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§
Sourcefn save_license(&self, license: &License) -> Result<(), LicenseError>
fn save_license(&self, license: &License) -> Result<(), LicenseError>
Saves a license to the custom storage backend.
Sourcefn load_license(&self) -> Result<License, LicenseError>
fn load_license(&self) -> Result<License, LicenseError>
Loads a license from the custom storage backend.
Sourcefn license_exists(&self) -> bool
fn license_exists(&self) -> bool
Checks if a license exists in the storage backend.
Sourcefn delete_license(&self) -> Result<(), LicenseError>
fn delete_license(&self) -> Result<(), LicenseError>
Removes a license from the storage backend.