Licensing System
The system includes an advanced licensing mechanism (src/license) that enables permission management at the Organization or server level.
Architecture
The license is a cryptographically signed JSON file (HMAC-SHA256) that prevents forgery.
The file is saved in server-nest/config/license.json or loaded from environment variable BT_MANAGEMENT_LICENSE.
License Types (Tiers)
- Trial: Limited to 30 days, 5 devices.
- Basic: Basic features only.
- Professional: Includes advanced analytics and smart alerts.
- Enterprise: SSO, Audit Logs, and unlimited devices.
License Structure
interface LicenseInfo {
id: string; // Unique identifier
type: 'trial' | 'basic' | ...;
maxDevices: number; // Device limit enforcement
maxUsers: number;
features: string[]; // List of enabled features
signature: string; // Authentication signature
}
Enforcement
- Periodic Check: The server checks license validity and quota violations every hour (
@Interval). - Feature Flags: The
LicenseServiceexposes a methodisFeatureEnabled('smart_alerts')used by business logic to check permissions. - Grace Period: In case of network disconnection, the system will continue to work with the last loaded license ("Cached License").
License Creation
Currently creation is done manually via CLI or createTrialLicense function used for initial setup.
The Secret Key for signing is found in ENV LICENSE_SECRET_KEY.