/** * SDK Configuration options */ export type LicenseSeatConfig = { /** * - Base URL for the LicenseSeat API */ apiBaseUrl?: string; /** * - Product slug (required for API calls, e.g., "my-app") */ productSlug?: string; /** * - API key for authentication (required for most operations) */ apiKey?: string; /** * - Prefix for localStorage keys */ storagePrefix?: string; /** * - Interval in ms for automatic license validation (default: 1 hour) */ autoValidateInterval?: number; /** * - Interval in ms to check network connectivity when offline (default: 30s) */ networkRecheckInterval?: number; /** * - Maximum number of retry attempts for failed API calls */ maxRetries?: number; /** * - Initial delay in ms between retries (exponential backoff applied) */ retryDelay?: number; /** * - Enable debug logging to console */ debug?: boolean; /** * - Interval in ms to refresh offline token (default: 72 hours) */ offlineLicenseRefreshInterval?: number; /** * - Enable offline validation fallback on network errors */ offlineFallbackEnabled?: boolean; /** * - Maximum days a license can be used offline (0 = disabled) */ maxOfflineDays?: number; /** * - Maximum allowed clock skew in ms for offline validation (default: 5 minutes) */ maxClockSkewMs?: number; /** * - Automatically initialize and validate cached license on construction */ autoInitialize?: boolean; /** * - Enable telemetry collection on POST requests (set false for GDPR compliance) */ telemetryEnabled?: boolean; /** * - Interval in ms between automatic heartbeats (default: 5 minutes, set 0 to disable) */ heartbeatInterval?: number; /** * - User-provided app version string, sent as app_version in telemetry */ appVersion?: string; /** * - User-provided app build identifier, sent as app_build in telemetry */ appBuild?: string; }; /** * License activation options */ export type ActivationOptions = { /** * - Custom device ID (auto-generated if not provided) */ deviceId?: string; /** * - Human-readable device name (e.g., "John's MacBook Pro") */ deviceName?: string; /** * - Additional metadata to include with the activation */ metadata?: any; }; /** * License validation options */ export type ValidationOptions = { /** * - Device ID to validate against (required for hardware_locked mode) */ deviceId?: string; }; /** * Activation response from the API */ export type ActivationResponse = { /** * - Object type ("activation") */ object: string; /** * - Activation ID */ id: number; /** * - Device ID used for activation */ device_id: string; /** * - Human-readable device name */ device_name?: string; /** * - The activated license key */ license_key: string; /** * - ISO8601 timestamp of activation */ activated_at: string; /** * - ISO8601 timestamp of deactivation (null if active) */ deactivated_at?: string | null; /** * - IP address of activation request */ ip_address?: string; /** * - Additional metadata */ metadata?: any; /** * - The license object */ license: LicenseObject; }; /** * Deactivation response from the API */ export type DeactivationResponse = { /** * - Object type ("deactivation") */ object: string; /** * - The deactivated activation ID */ activation_id: number; /** * - ISO8601 timestamp of deactivation */ deactivated_at: string; }; /** * License object from API responses */ export type LicenseObject = { /** * - The license key */ key: string; /** * - License status ("active", "revoked", "suspended", etc.) */ status: string; /** * - ISO8601 start timestamp */ starts_at?: string; /** * - ISO8601 expiration timestamp (null for perpetual) */ expires_at?: string | null; /** * - License mode ("hardware_locked", "floating", "named_user") */ mode: string; /** * - License plan key */ plan_key: string; /** * - Maximum allowed seats */ seat_limit?: number; /** * - Currently active seats */ active_seats: number; /** * - List of active entitlements */ active_entitlements: Entitlement[]; /** * - Additional metadata */ metadata?: any; /** * - Product information */ product: ProductInfo; }; /** * Product information */ export type ProductInfo = { /** * - Product slug */ slug: string; /** * - Product display name */ name: string; }; /** * Cached license data */ export type CachedLicense = { /** * - The license key */ license_key: string; /** * - Device ID */ device_id: string; /** * - Original activation response */ activation?: ActivationResponse; /** * - ISO8601 timestamp of activation */ activated_at: string; /** * - ISO8601 timestamp of last validation */ last_validated: string; /** * - Latest validation result */ validation?: ValidationResult; }; /** * Entitlement object */ export type Entitlement = { /** * - Unique entitlement key */ key: string; /** * - ISO8601 expiration timestamp (null for perpetual) */ expires_at: string | null; /** * - Additional metadata */ metadata: any | null; }; /** * Validation result from API or offline verification */ export type ValidationResult = { /** * - Whether the license is valid */ valid: boolean; /** * - Whether this was an offline validation */ offline?: boolean; /** * - Machine-readable reason code (when invalid) */ code?: string; /** * - Human-readable message (when invalid) */ message?: string; /** * - Non-fatal warnings (e.g., expiring soon) */ warnings?: ValidationWarning[]; /** * - The license object (online validation) */ license?: LicenseObject; /** * - The activation object (if device_id provided) */ activation?: ActivationResponse; /** * - List of active entitlements */ active_entitlements?: Entitlement[]; /** * - Whether this is an optimistic validation (pending server confirmation) */ optimistic?: boolean; }; /** * Validation warning */ export type ValidationWarning = { /** * - Warning code (e.g., "license_expiring_soon") */ code: string; /** * - Human-readable warning message */ message: string; }; /** * Entitlement check result */ export type EntitlementCheckResult = { /** * - Whether the entitlement is active */ active: boolean; /** * - Reason if not active ("no_license" | "not_found" | "expired") */ reason?: string; /** * - ISO8601 expiration timestamp if expired */ expires_at?: string; /** * - Full entitlement object if active */ entitlement?: Entitlement; }; /** * License status object */ export type LicenseStatus = { /** * - Status string ("inactive" | "pending" | "invalid" | "offline-invalid" | "offline-valid" | "active") */ status: string; /** * - Human-readable status message */ message?: string; /** * - License key (if active) */ license?: string; /** * - Device ID (if active) */ device?: string; /** * - ISO8601 activation timestamp */ activated_at?: string; /** * - ISO8601 last validation timestamp */ last_validated?: string; /** * - List of active entitlements */ entitlements?: Entitlement[]; }; /** * Offline token data (new v1 format) */ export type OfflineToken = { /** * - Object type ("offline_token") */ object: string; /** * - The token payload */ token: OfflineTokenPayload; /** * - Signature information */ signature: OfflineTokenSignature; /** * - Canonical JSON string that was signed */ canonical: string; }; /** * Offline token payload */ export type OfflineTokenPayload = { /** * - Token schema version (currently 1) */ schema_version: number; /** * - License key */ license_key: string; /** * - Product slug */ product_slug: string; /** * - License plan key */ plan_key: string; /** * - License mode ("hardware_locked", "floating", "named_user") */ mode: string; /** * - Seat limit (null for unlimited) */ seat_limit?: number | null; /** * - Device ID (required for hardware_locked mode) */ device_id?: string | null; /** * - Issued at (Unix timestamp in seconds) */ iat: number; /** * - Expires at (Unix timestamp in seconds) */ exp: number; /** * - Not before (Unix timestamp in seconds) */ nbf: number; /** * - License expiration (Unix timestamp in seconds, null for perpetual) */ license_expires_at?: number | null; /** * - Key ID for signature verification */ kid: string; /** * - Active entitlements */ entitlements: OfflineEntitlement[]; /** * - Additional metadata */ metadata?: any; }; /** * Offline token entitlement */ export type OfflineEntitlement = { /** * - Entitlement key */ key: string; /** * - Expiration (Unix timestamp in seconds) */ expires_at?: number | null; }; /** * Offline token signature */ export type OfflineTokenSignature = { /** * - Signature algorithm (e.g., "Ed25519") */ algorithm: string; /** * - Key ID for public key lookup */ key_id: string; /** * - Base64URL-encoded signature value */ value: string; }; /** * Signing key response from API */ export type SigningKey = { /** * - Object type ("signing_key") */ object: string; /** * - Key ID */ key_id: string; /** * - Algorithm (e.g., "Ed25519") */ algorithm: string; /** * - Base64-encoded public key */ public_key: string; /** * - ISO8601 creation timestamp */ created_at?: string; /** * - Key status ("active", "revoked") */ status: string; }; /** * Heartbeat response from the API */ export type HeartbeatResponse = { /** * - Object type ("heartbeat") */ object: string; /** * - ISO8601 timestamp of when the heartbeat was received */ received_at: string; /** * - The license object */ license: LicenseObject; }; /** * Health check response */ export type HealthResponse = { /** * - Object type ("health") */ object: string; /** * - Health status ("healthy") */ status: string; /** * - API version string */ api_version: string; /** * - ISO8601 timestamp */ timestamp: string; }; /** * Event callback function */ export type EventCallback = (data: any) => void; /** * Event unsubscribe function */ export type EventUnsubscribe = () => void; /** * API Error data (new format) */ export type APIErrorData = { /** * - Error object (new format) */ error?: APIErrorObject; /** * - Machine-readable error code (fallback) */ code?: string; /** * - Human-readable error message (fallback) */ message?: string; }; /** * API Error object */ export type APIErrorObject = { /** * - Machine-readable error code */ code: string; /** * - Human-readable error message */ message: string; /** * - Additional error details */ details?: any; }; //# sourceMappingURL=types.d.ts.map