{"id":46995729,"url":"https://github.com/licensechain/licensechain-rust-sdk","last_synced_at":"2026-03-11T15:02:57.315Z","repository":{"id":316821209,"uuid":"1064684404","full_name":"LicenseChain/LicenseChain-Rust-SDK","owner":"LicenseChain","description":"Official Rust SDK for LicenseChain - Secure license management with automatic /v1 API prefix support","archived":false,"fork":false,"pushed_at":"2025-12-18T05:41:28.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-21T14:52:43.435Z","etag":null,"topics":["api","authentication","cargo","license","license-management","licensechain","rust","sdk","validation","webhook"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LicenseChain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-26T11:57:01.000Z","updated_at":"2025-12-18T05:41:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"21ca7df1-0de6-421b-bfc1-add0aad11ee3","html_url":"https://github.com/LicenseChain/LicenseChain-Rust-SDK","commit_stats":null,"previous_names":["licensechain/licensechain-rust-sdk"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LicenseChain/LicenseChain-Rust-SDK","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LicenseChain%2FLicenseChain-Rust-SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LicenseChain%2FLicenseChain-Rust-SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LicenseChain%2FLicenseChain-Rust-SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LicenseChain%2FLicenseChain-Rust-SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LicenseChain","download_url":"https://codeload.github.com/LicenseChain/LicenseChain-Rust-SDK/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LicenseChain%2FLicenseChain-Rust-SDK/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30385034,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T14:10:17.325Z","status":"ssl_error","status_checked_at":"2026-03-11T14:09:37.934Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","authentication","cargo","license","license-management","licensechain","rust","sdk","validation","webhook"],"created_at":"2026-03-11T15:02:52.227Z","updated_at":"2026-03-11T15:02:57.304Z","avatar_url":"https://github.com/LicenseChain.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LicenseChain Rust SDK\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Rust](https://img.shields.io/badge/Rust-1.70+-blue.svg)](https://www.rust-lang.org/)\n[![Crates.io](https://img.shields.io/crates/v/licensechain-sdk)](https://crates.io/crates/licensechain-sdk)\n[![Documentation](https://docs.rs/licensechain-sdk/badge.svg)](https://docs.rs/licensechain-sdk)\n\nOfficial Rust SDK for LicenseChain - Secure license management for Rust applications.\n\n## 🚀 Features\n\n- **🔐 Secure Authentication** - User registration, login, and session management\n- **📜 License Management** - Create, validate, update, and revoke licenses\n- **🛡️ Hardware ID Validation** - Prevent license sharing and unauthorized access\n- **🔔 Webhook Support** - Real-time license events and notifications\n- **📊 Analytics Integration** - Track license usage and performance metrics\n- **⚡ High Performance** - Optimized for production workloads\n- **🔄 Async Operations** - Non-blocking HTTP requests and data processing\n- **🛠️ Easy Integration** - Simple API with comprehensive documentation\n\n## 📦 Installation\n\n### Method 1: Cargo (Recommended)\n\nAdd to your `Cargo.toml`:\n\n```toml\n[dependencies]\nlicensechain-sdk = \"1.0.0\"\n```\n\n### Method 2: Git Repository\n\n```toml\n[dependencies]\nlicensechain-sdk = { git = \"https://github.com/LicenseChain/LicenseChain-Rust-SDK.git\" }\n```\n\n### Method 3: Local Path\n\n```toml\n[dependencies]\nlicensechain-sdk = { path = \"path/to/licensechain-sdk\" }\n```\n\n## 🚀 Quick Start\n\n### Basic Setup\n\n```rust\nuse licensechain_sdk::{LicenseChainClient, LicenseChainConfig};\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // Initialize the client\n    let config = LicenseChainConfig::new()\n        .api_key(\"your-api-key\")\n        .app_name(\"your-app-name\")\n        .version(\"1.0.0\");\n        \n    let mut client = LicenseChainClient::new(config);\n    \n    // Connect to LicenseChain\n    client.connect().await?;\n    println!(\"Connected to LicenseChain successfully!\");\n    \n    Ok(())\n}\n```\n\n### User Authentication\n\n```rust\n// Register a new user\nmatch client.register(\"username\", \"password\", \"email@example.com\").await {\n    Ok(user) =\u003e {\n        println!(\"User registered successfully!\");\n        println!(\"User ID: {}\", user.id);\n    }\n    Err(e) =\u003e eprintln!(\"Registration failed: {}\", e),\n}\n\n// Login existing user\nmatch client.login(\"username\", \"password\").await {\n    Ok(user) =\u003e {\n        println!(\"User logged in successfully!\");\n        println!(\"Session ID: {}\", user.session_id);\n    }\n    Err(e) =\u003e eprintln!(\"Login failed: {}\", e),\n}\n```\n\n### License Management\n\n```rust\n// Validate a license\nmatch client.validate_license(\"LICENSE-KEY-HERE\").await {\n    Ok(license) =\u003e {\n        println!(\"License is valid!\");\n        println!(\"License Key: {}\", license.key);\n        println!(\"Status: {}\", license.status);\n        println!(\"Expires: {}\", license.expires);\n        println!(\"Features: {:?}\", license.features);\n        println!(\"User: {}\", license.user);\n    }\n    Err(e) =\u003e eprintln!(\"License validation failed: {}\", e),\n}\n\n// Get user's licenses\nmatch client.get_user_licenses().await {\n    Ok(licenses) =\u003e {\n        println!(\"Found {} licenses:\", licenses.len());\n        for (i, license) in licenses.iter().enumerate() {\n            println!(\"  {}. {} - {} (Expires: {})\", \n                i + 1, license.key, license.status, license.expires);\n        }\n    }\n    Err(e) =\u003e eprintln!(\"Failed to get licenses: {}\", e),\n}\n```\n\n### Hardware ID Validation\n\n```rust\n// Get hardware ID (automatically generated)\nlet hardware_id = client.get_hardware_id();\nprintln!(\"Hardware ID: {}\", hardware_id);\n\n// Validate hardware ID with license\nmatch client.validate_hardware_id(\"LICENSE-KEY-HERE\", \u0026hardware_id).await {\n    Ok(is_valid) =\u003e {\n        if is_valid {\n            println!(\"Hardware ID is valid for this license!\");\n        } else {\n            println!(\"Hardware ID is not valid for this license.\");\n        }\n    }\n    Err(e) =\u003e eprintln!(\"Hardware ID validation failed: {}\", e),\n}\n```\n\n### Webhook Integration\n\n```rust\n// Set up webhook handler\nclient.set_webhook_handler(|event, data| {\n    println!(\"Webhook received: {}\", event);\n    \n    match event.as_str() {\n        \"license.created\" =\u003e {\n            if let Some(license_key) = data.get(\"licenseKey\") {\n                println!(\"New license created: {}\", license_key);\n            }\n        }\n        \"license.updated\" =\u003e {\n            if let Some(license_key) = data.get(\"licenseKey\") {\n                println!(\"License updated: {}\", license_key);\n            }\n        }\n        \"license.revoked\" =\u003e {\n            if let Some(license_key) = data.get(\"licenseKey\") {\n                println!(\"License revoked: {}\", license_key);\n            }\n        }\n        _ =\u003e {}\n    }\n});\n\n// Start webhook listener\nclient.start_webhook_listener().await?;\n```\n\n## 🌐 API Endpoints\n\nThis SDK connects to the LicenseChain API at `https://api.licensechain.app` using the `/v1` API version prefix.\n\n### Base URL\n```\nhttps://api.licensechain.app\n```\n\n### Available Endpoints\n\nAll endpoints use the `/v1` prefix:\n\n- **Health Check**: `GET /v1/health`\n- **Authentication**:\n  - `POST /v1/auth/register` - Register new user\n  - `POST /v1/auth/login` - User login\n  - `GET /v1/auth/me` - Get current user\n  - `POST /v1/auth/logout` - User logout\n- **Applications**:\n  - `GET /v1/apps` - List all apps\n  - `GET /v1/apps/:id` - Get app by ID\n  - `POST /v1/apps` - Create new app\n  - `PUT /v1/apps/:id` - Update app\n  - `DELETE /v1/apps/:id` - Delete app\n- **Licenses**:\n  - `GET /v1/licenses` - List licenses\n  - `GET /v1/licenses/:id` - Get license by ID\n  - `POST /v1/licenses` - Create license\n  - `POST /v1/licenses/verify` - Verify license key\n  - `PUT /v1/licenses/:id` - Update license\n  - `DELETE /v1/licenses/:id` - Delete license\n- **Webhooks**:\n  - `GET /v1/webhooks` - List webhooks\n  - `POST /v1/webhooks` - Create webhook\n  - `GET /v1/webhooks/:id` - Get webhook by ID\n  - `PUT /v1/webhooks/:id` - Update webhook\n  - `DELETE /v1/webhooks/:id` - Delete webhook\n- **Analytics**:\n  - `GET /v1/analytics` - Get analytics data\n\n\u003e **Note**: The SDK automatically prepends `/v1` to all endpoint calls. You don't need to include it manually.\n\n## 📚 API Reference\n\n### LicenseChainClient\n\n#### Constructor\n\n```rust\nlet config = LicenseChainConfig::new()\n    .api_key(\"your-api-key\")\n    .app_name(\"your-app-name\")\n    .version(\"1.0.0\")\n    .base_url(\"https://api.licensechain.app\"); // Optional\n    \nlet mut client = LicenseChainClient::new(config);\n```\n\n#### Methods\n\n##### Connection Management\n\n```rust\n// Connect to LicenseChain\nclient.connect().await?;\n\n// Disconnect from LicenseChain\nclient.disconnect().await?;\n\n// Check connection status\nlet is_connected = client.is_connected();\n```\n\n##### User Authentication\n\n```rust\n// Register a new user\nlet user = client.register(username, password, email).await?;\n\n// Login existing user\nlet user = client.login(username, password).await?;\n\n// Logout current user\nclient.logout().await?;\n\n// Get current user info\nlet user = client.get_current_user().await?;\n```\n\n##### License Management\n\n```rust\n// Validate a license\nlet license = client.validate_license(license_key).await?;\n\n// Get user's licenses\nlet licenses = client.get_user_licenses().await?;\n\n// Create a new license\nlet license = client.create_license(user_id, features, expires).await?;\n\n// Update a license\nlet license = client.update_license(license_key, updates).await?;\n\n// Revoke a license\nclient.revoke_license(license_key).await?;\n\n// Extend a license\nlet license = client.extend_license(license_key, days).await?;\n```\n\n##### Hardware ID Management\n\n```rust\n// Get hardware ID\nlet hardware_id = client.get_hardware_id();\n\n// Validate hardware ID\nlet is_valid = client.validate_hardware_id(license_key, \u0026hardware_id).await?;\n\n// Bind hardware ID to license\nclient.bind_hardware_id(license_key, \u0026hardware_id).await?;\n```\n\n##### Webhook Management\n\n```rust\n// Set webhook handler\nclient.set_webhook_handler(handler);\n\n// Start webhook listener\nclient.start_webhook_listener().await?;\n\n// Stop webhook listener\nclient.stop_webhook_listener().await?;\n```\n\n##### Analytics\n\n```rust\n// Track event\nlet mut properties = HashMap::new();\nproperties.insert(\"level\".to_string(), \"1\".to_string());\nproperties.insert(\"playerCount\".to_string(), \"10\".to_string());\nclient.track_event(\"app.started\", properties).await?;\n\n// Get analytics data\nlet analytics = client.get_analytics(time_range).await?;\n```\n\n## 🔧 Configuration\n\n### Environment Variables\n\nSet these in your environment or through your build process:\n\n```bash\n# Required\nexport LICENSECHAIN_API_KEY=your-api-key\nexport LICENSECHAIN_APP_NAME=your-app-name\nexport LICENSECHAIN_APP_VERSION=1.0.0\n\n# Optional\nexport LICENSECHAIN_BASE_URL=https://api.licensechain.app\nexport LICENSECHAIN_DEBUG=true\n```\n\n### Advanced Configuration\n\n```rust\nlet config = LicenseChainConfig::new()\n    .api_key(\"your-api-key\")\n    .app_name(\"your-app-name\")\n    .version(\"1.0.0\")\n    .base_url(\"https://api.licensechain.app\")\n    .timeout(Duration::from_secs(30))  // Request timeout\n    .retries(3)                        // Number of retry attempts\n    .debug(false)                      // Enable debug logging\n    .user_agent(\"MyApp/1.0.0\");       // Custom user agent\n```\n\n## 🛡️ Security Features\n\n### Hardware ID Protection\n\nThe SDK automatically generates and manages hardware IDs to prevent license sharing:\n\n```rust\n// Hardware ID is automatically generated and stored\nlet hardware_id = client.get_hardware_id();\n\n// Validate against license\nlet is_valid = client.validate_hardware_id(license_key, \u0026hardware_id).await?;\n```\n\n### Secure Communication\n\n- All API requests use HTTPS\n- API keys are securely stored and transmitted\n- Session tokens are automatically managed\n- Webhook signatures are verified\n\n### License Validation\n\n- Real-time license validation\n- Hardware ID binding\n- Expiration checking\n- Feature-based access control\n\n## 📊 Analytics and Monitoring\n\n### Event Tracking\n\n```rust\n// Track custom events\nlet mut properties = HashMap::new();\nproperties.insert(\"level\".to_string(), \"1\".to_string());\nproperties.insert(\"playerCount\".to_string(), \"10\".to_string());\nclient.track_event(\"app.started\", properties).await?;\n\n// Track license events\nlet mut license_properties = HashMap::new();\nlicense_properties.insert(\"licenseKey\".to_string(), \"LICENSE-KEY\".to_string());\nlicense_properties.insert(\"features\".to_string(), \"premium,unlimited\".to_string());\nclient.track_event(\"license.validated\", license_properties).await?;\n```\n\n### Performance Monitoring\n\n```rust\n// Get performance metrics\nlet metrics = client.get_performance_metrics().await?;\nprintln!(\"API Response Time: {}ms\", metrics.average_response_time);\nprintln!(\"Success Rate: {:.2}%\", metrics.success_rate * 100.0);\nprintln!(\"Error Count: {}\", metrics.error_count);\n```\n\n## 🔄 Error Handling\n\n### Custom Error Types\n\n```rust\nmatch client.validate_license(\"invalid-key\").await {\n    Ok(license) =\u003e {\n        // Handle valid license\n    }\n    Err(LicenseChainError::InvalidLicense) =\u003e {\n        eprintln!(\"License key is invalid\");\n    }\n    Err(LicenseChainError::ExpiredLicense) =\u003e {\n        eprintln!(\"License has expired\");\n    }\n    Err(LicenseChainError::NetworkError(e)) =\u003e {\n        eprintln!(\"Network connection failed: {}\", e);\n    }\n    Err(e) =\u003e {\n        eprintln!(\"LicenseChain error: {}\", e);\n    }\n}\n```\n\n### Retry Logic\n\n```rust\n// Automatic retry for network errors\nlet config = LicenseChainConfig::new()\n    .api_key(\"your-api-key\")\n    .app_name(\"your-app-name\")\n    .version(\"1.0.0\")\n    .retries(3)                        // Retry up to 3 times\n    .timeout(Duration::from_secs(30)); // Wait 30 seconds for each request\n```\n\n## 🧪 Testing\n\n### Unit Tests\n\n```bash\n# Run tests\ncargo test\n\n# Run tests with output\ncargo test -- --nocapture\n\n# Run specific test\ncargo test test_validate_license\n```\n\n### Integration Tests\n\n```bash\n# Test with real API\ncargo test --test integration_tests\n```\n\n## 📝 Examples\n\nSee the `examples/` directory for complete examples:\n\n- `basic_usage.rs` - Basic SDK usage\n- `advanced_features.rs` - Advanced features and configuration\n- `webhook_integration.rs` - Webhook handling\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n### Development Setup\n\n1. Clone the repository\n2. Install Rust 1.70 or later\n3. Build: `cargo build`\n4. Test: `cargo test`\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🆘 Support\n\n- **Documentation**: [https://docs.licensechain.app/rust](https://docs.licensechain.app/rust)\n- **Issues**: [GitHub Issues](https://github.com/LicenseChain/LicenseChain-Rust-SDK/issues)\n- **Discord**: [LicenseChain Discord](https://discord.gg/licensechain)\n- **Email**: support@licensechain.app\n\n## 🔗 Related Projects\n\n- [LicenseChain JavaScript SDK](https://github.com/LicenseChain/LicenseChain-JavaScript-SDK)\n- [LicenseChain Python SDK](https://github.com/LicenseChain/LicenseChain-Python-SDK)\n- [LicenseChain Node.js SDK](https://github.com/LicenseChain/LicenseChain-NodeJS-SDK)\n- [LicenseChain Customer Panel](https://github.com/LicenseChain/LicenseChain-Customer-Panel)\n\n---\n\n**Made with ❤️ for the Rust community**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flicensechain%2Flicensechain-rust-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flicensechain%2Flicensechain-rust-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flicensechain%2Flicensechain-rust-sdk/lists"}