@hivetechs/hive-ai
Version:
Real-time streaming AI consensus platform with HTTP+SSE MCP integration for Claude Code, VS Code, Cursor, and Windsurf - powered by OpenRouter's unified API
91 lines • 2.49 kB
TypeScript
/**
* License Gating System - Protects Premium Features
*
* This module handles license validation and feature access control.
* Free tier provides basic tools, premium tier unlocks advanced features.
*/
export declare enum FeatureTier {
FREE = "free",
PREMIUM = "premium"
}
export interface LicenseStatus {
valid: boolean;
tier: FeatureTier;
userId?: string;
expiresAt?: number;
features: string[];
message?: string;
dailyLimit?: number;
user_id?: string;
subscription_status?: string;
max_devices?: number;
active_devices?: number;
}
export declare class LicenseGate {
private static instance;
private licenseCache;
private cacheExpiry;
static getInstance(): LicenseGate;
/**
* Check if user has a valid license for the requested feature
* ALL features now require a license key (free, trial, or premium)
*/
checkFeatureAccess(feature: string): Promise<LicenseStatus>;
/**
* Validate license with Cloudflare Workers backend
*/
private validateLicense;
private getLicenseKey;
private createFreeLicense;
private createValidFreeLicense;
private getVersion;
private getDeviceFingerprint;
/**
* Store license key securely
*/
storeLicenseKey(licenseKey: string): Promise<void>;
/**
* Get detailed subscription information
*/
getSubscriptionDetails(): Promise<any>;
/**
* Get usage statistics
*/
getUsageStatistics(period?: string): Promise<any>;
/**
* Get account details
*/
getAccountDetails(): Promise<any>;
/**
* Get registered devices
*/
getRegisteredDevices(): Promise<any[]>;
/**
* Update email address
*/
updateEmail(email: string): Promise<{
success: boolean;
error?: string;
}>;
/**
* Remove device
*/
removeDevice(deviceId: string): Promise<{
success: boolean;
error?: string;
}>;
private getDefaultSubscription;
private getDefaultUsage;
private getDefaultAccount;
}
export declare class NoLicenseError extends Error {
constructor(feature: string);
}
export declare class PremiumFeatureError extends Error {
constructor(feature: string);
}
/**
* Decorator for protecting premium MCP tools
*/
export declare function requiresPremium(target: any, propertyName: string, descriptor: PropertyDescriptor): PropertyDescriptor;
//# sourceMappingURL=license-gate.d.ts.map