@astermind/astermind-pro
Version:
Astermind Pro - Premium ML Toolkit with Advanced RAG, Reranking, Summarization, and Information Flow Analysis
87 lines • 3.93 kB
TypeScript
/**
* License management for Astermind Pro
* Wraps @astermindai/license-runtime with convenience functions
* Also propagates license to Astermind Synth for unified licensing
*
* SECURITY FEATURES:
* - Cryptographic JWT signature validation using JWKS from license server
* - Token format validation (JWT structure, required claims)
* - Issuer validation (must match https://license.astermind.ai)
* - Expiration checking
* - Fake token rejection (invalid signatures are rejected even if payload looks valid)
* - Multiple validation layers to prevent bypass attempts
*
* The license-runtime library validates tokens using ES256 signatures and public keys
* fetched from the license server's JWKS endpoint. Fake tokens cannot bypass this validation.
*/
import { type LicenseState } from '@astermindai/license-runtime';
/**
* Initialize the license runtime singleton for Astermind Pro.
* Must be called before any other license functions.
* Automatically loads token from ASTERMIND_LICENSE_TOKEN environment variable if present.
*
* This initializes the license runtime for:
* - astermind-pro (primary)
* - astermind-synth (propagated automatically)
*
* PROFESSIONAL LICENSING APPROACH:
* - Always requires a valid license key (strict mode)
* - Trial keys are obtained from the license server and have expiration dates
* - No "eval mode" bypass - all usage requires a valid key
* - For testing, use a test/dev key or mock the license runtime
*/
export declare function initializeLicense(): void;
/**
* Require a valid license (throws if not available).
* Accepts both astermind-pro and astermind-elm licenses.
* Use this before accessing premium features.
*
* SECURITY: This function performs multiple validation checks to prevent bypass attempts.
* Do not modify or wrap this function in a way that suppresses errors.
*/
export declare function requireLicense(): void;
/**
* Check if license is valid and astermind-pro feature is available (non-blocking).
* Also accepts astermind-elm licenses as valid for Pro.
* @returns true if astermind-pro or astermind-elm feature is available
*/
export declare function checkLicense(): boolean;
/**
* Check if astermind-synth feature is available (included with Pro subscription).
* @returns true if astermind-synth feature is available
*/
export declare function checkSynthLicense(): boolean;
/**
* Get detailed license status.
* If token has audience "astermind-elm", we'll check if it has valid features
* even if the runtime marks it as invalid due to audience mismatch.
* @returns LicenseState object with status, reason, payload, etc.
*/
export declare function getLicenseStatus(): LicenseState;
/**
* Set license token from a string.
* This will propagate the license to both astermind-pro and astermind-synth.
* Accepts tokens with audience "astermind-elm" or "astermind-pro".
*
* SECURITY: This function validates the JWT token cryptographically using the license server's
* public keys. Fake tokens will be rejected even if they have valid-looking payloads.
*
* Note: Even if the license-runtime marks astermind-elm tokens as "invalid" due to audience mismatch,
* we still accept them for Pro usage IF they pass cryptographic validation. The checkLicense() and
* requireLicense() functions will check for astermind-elm features as well.
*
* Useful for dynamic token loading from backend services or user input.
* @param token The license token string (JWT format)
*/
export declare function setLicenseTokenFromString(token: string): Promise<void>;
/**
* Get the current license token (if set).
* @returns The current license token or null
*/
export declare function getCurrentLicenseToken(): string | null;
/**
* Check if license runtime has been initialized.
* @returns true if initializeLicense() has been called
*/
export declare function isLicenseInitialized(): boolean;
//# sourceMappingURL=license.d.ts.map