Lycento SDK for Rust
A comprehensive Rust SDK for the Lycento licensing platform, designed for integration with Tauri desktop applications.
Description
Lycento SDK provides a complete client library for managing software licenses in Rust applications. It handles license activation, validation, and deactivation with automatic device identification, making it ideal for desktop applications built with Tauri or other Rust frameworks.
Installation
From crates.io
Add this to your Cargo.toml:
[]
= "1.0.0"
From git
[]
= { = "https://github.com/lycento/sdk", = "main" }
Quick Start
use ;
async
Features
- License Activation - Activate licenses with automatic device registration
- License Validation - Validate license status and expiration
- License Deactivation - Deactivate licenses from current or specific devices
- Device Information - Automatic device ID generation using system identifiers
- Full Async/Await - Built on Tokio for async operations
- Tauri Ready - Designed specifically for Tauri desktop applications
- Error Handling - Comprehensive error types for all failure scenarios
- Configurable - Customizable timeouts, base URLs, and API keys
API Reference
LycentoClient
The main client for all license operations.
let config = new;
let client = new?;
client.activate.await?;
client.validate_license.await?;
client.is_valid.await;
client.get_info.await?;
client.can_activate.await?;
client.deactivate.await?;
client.deactivate_current.await?;
LycentoConfig
Configuration builder for the client.
let config = new
.with_api_key
.with_timeout;
ActivateOptions
Options for license activation.
let options = new
.with_platform
.with_device_name
.with_device_id;
ValidateOptions
Options for license validation.
let options = new
.with_device_id;
DeactivateOptions
Options for license deactivation.
let options = new
.with_device_id;
Error Handling
The SDK provides comprehensive error types:
use ;
match client.validate_license.await
Error Types
| Error Type | Description |
|---|---|
LycentoError |
Top-level error enum wrapping all error types |
ActivationError |
Errors during license activation |
ValidationError |
Errors during license validation |
DeactivationError |
Errors during license deactivation |
NetworkError |
Network and HTTP-related errors |
Tauri Integration
The SDK integrates seamlessly with Tauri applications. Here's an example of exposing license functionality to your frontend:
use ;
use State;
use Mutex;
async
async
Examples
See examples/basic_usage.rs for a complete working example.
Run the example:
LYCENTO_BASE_URL=https://api.lycento.com LYCENTO_API_KEY=your-key
License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 Lycento
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.