@licensechain/javascript-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,763 @@
1
+ import * as jose from 'jose';
2
+
3
+ interface ConfigurationOptions {
4
+ apiKey: string;
5
+ baseUrl?: string;
6
+ timeout?: number;
7
+ retries?: number;
8
+ }
9
+ declare class Configuration {
10
+ private apiKey;
11
+ private baseUrl;
12
+ private timeout;
13
+ private retries;
14
+ constructor(options: ConfigurationOptions);
15
+ getApiKey(): string;
16
+ getBaseUrl(): string;
17
+ getTimeout(): number;
18
+ getRetries(): number;
19
+ isValid(): boolean;
20
+ setApiKey(apiKey: string): this;
21
+ setBaseUrl(baseUrl: string): this;
22
+ setTimeout(timeout: number): this;
23
+ setRetries(retries: number): this;
24
+ toObject(): ConfigurationOptions;
25
+ static fromObject(config: ConfigurationOptions): Configuration;
26
+ static fromEnvironment(): Configuration;
27
+ }
28
+
29
+ declare class ApiClient {
30
+ private readonly core;
31
+ constructor(config: Configuration);
32
+ get<T = any>(endpoint: string, params?: Record<string, any>): Promise<T>;
33
+ post<T = any>(endpoint: string, data?: any): Promise<T>;
34
+ put<T = any>(endpoint: string, data?: any): Promise<T>;
35
+ patch<T = any>(endpoint: string, data?: any): Promise<T>;
36
+ delete<T = any>(endpoint: string, data?: any): Promise<T>;
37
+ ping(): Promise<any>;
38
+ health(): Promise<any>;
39
+ }
40
+
41
+ interface License$1 {
42
+ id: string;
43
+ user_id: string;
44
+ product_id: string;
45
+ license_key: string;
46
+ status: string;
47
+ created_at: string;
48
+ updated_at: string;
49
+ expires_at?: string;
50
+ metadata?: Record<string, any>;
51
+ }
52
+ interface CreateLicenseRequest$1 {
53
+ user_id?: string;
54
+ product_id?: string;
55
+ app_id?: string;
56
+ plan?: 'FREE' | 'PRO' | 'BUSINESS' | 'ENTERPRISE';
57
+ issued_email?: string;
58
+ expires_at?: string;
59
+ metadata?: Record<string, any>;
60
+ }
61
+ interface UpdateLicenseRequest$1 {
62
+ status?: string;
63
+ expires_at?: string;
64
+ metadata?: Record<string, any>;
65
+ }
66
+ interface LicenseListResponse {
67
+ data: License$1[];
68
+ total: number;
69
+ page: number;
70
+ limit: number;
71
+ }
72
+ interface LicenseStats {
73
+ total: number;
74
+ active: number;
75
+ expired: number;
76
+ revoked: number;
77
+ revenue: number;
78
+ }
79
+ declare class LicenseService {
80
+ private client;
81
+ constructor(client: ApiClient);
82
+ create(request: CreateLicenseRequest$1): Promise<License$1>;
83
+ get(licenseId: string): Promise<License$1>;
84
+ update(licenseId: string, updates: UpdateLicenseRequest$1): Promise<License$1>;
85
+ revoke(licenseId: string): Promise<void>;
86
+ validate(licenseKey: string, hwuid?: string | null): Promise<boolean>;
87
+ /** Full POST /v1/licenses/verify JSON (optional license_token / license_jwks_uri). */
88
+ verifyWithDetails(licenseKey: string, hwuid?: string | null): Promise<Record<string, unknown>>;
89
+ listUserLicenses(userId: string, page?: number, limit?: number): Promise<LicenseListResponse>;
90
+ stats(): Promise<LicenseStats>;
91
+ private extractLicenseResponse;
92
+ private defaultHwuid;
93
+ }
94
+
95
+ interface User$1 {
96
+ id: string;
97
+ email: string;
98
+ name: string;
99
+ created_at: string;
100
+ updated_at: string;
101
+ metadata?: Record<string, any>;
102
+ }
103
+ interface CreateUserRequest {
104
+ email: string;
105
+ name: string;
106
+ password?: string;
107
+ metadata?: Record<string, any>;
108
+ }
109
+ interface UpdateUserRequest {
110
+ email?: string;
111
+ name?: string;
112
+ metadata?: Record<string, any>;
113
+ }
114
+ interface UserListResponse {
115
+ data: User$1[];
116
+ total: number;
117
+ page: number;
118
+ limit: number;
119
+ }
120
+ interface UserStats {
121
+ total: number;
122
+ active: number;
123
+ inactive: number;
124
+ }
125
+ declare class UserService {
126
+ private client;
127
+ constructor(client: ApiClient);
128
+ create(request: CreateUserRequest): Promise<User$1>;
129
+ get(userId: string): Promise<User$1>;
130
+ update(userId: string, updates: UpdateUserRequest): Promise<User$1>;
131
+ delete(userId: string): Promise<void>;
132
+ list(page?: number, limit?: number): Promise<UserListResponse>;
133
+ stats(): Promise<UserStats>;
134
+ private validateEmail;
135
+ }
136
+
137
+ interface Product {
138
+ id: string;
139
+ name: string;
140
+ description?: string;
141
+ price: number;
142
+ currency: string;
143
+ created_at: string;
144
+ updated_at: string;
145
+ metadata?: Record<string, any>;
146
+ }
147
+ interface CreateProductRequest {
148
+ name: string;
149
+ description?: string;
150
+ price: number;
151
+ currency: string;
152
+ metadata?: Record<string, any>;
153
+ }
154
+ interface UpdateProductRequest {
155
+ name?: string;
156
+ description?: string;
157
+ price?: number;
158
+ currency?: string;
159
+ metadata?: Record<string, any>;
160
+ }
161
+ interface ProductListResponse {
162
+ data: Product[];
163
+ total: number;
164
+ page: number;
165
+ limit: number;
166
+ }
167
+ interface ProductStats {
168
+ total: number;
169
+ active: number;
170
+ revenue: number;
171
+ }
172
+ declare class ProductService {
173
+ private client;
174
+ constructor(client: ApiClient);
175
+ create(request: CreateProductRequest): Promise<Product>;
176
+ get(productId: string): Promise<Product>;
177
+ update(productId: string, updates: UpdateProductRequest): Promise<Product>;
178
+ delete(productId: string): Promise<void>;
179
+ list(page?: number, limit?: number): Promise<ProductListResponse>;
180
+ stats(): Promise<ProductStats>;
181
+ private validateRequiredParams;
182
+ }
183
+
184
+ interface Webhook$1 {
185
+ id: string;
186
+ url: string;
187
+ events: string[];
188
+ secret?: string;
189
+ created_at: string;
190
+ updated_at: string;
191
+ }
192
+ interface CreateWebhookRequest$1 {
193
+ url: string;
194
+ events: string[];
195
+ secret?: string;
196
+ }
197
+ interface UpdateWebhookRequest$1 {
198
+ url?: string;
199
+ events?: string[];
200
+ secret?: string;
201
+ }
202
+ interface WebhookListResponse {
203
+ data: Webhook$1[];
204
+ total: number;
205
+ page: number;
206
+ limit: number;
207
+ }
208
+ declare class WebhookService {
209
+ private client;
210
+ constructor(client: ApiClient);
211
+ create(request: CreateWebhookRequest$1): Promise<Webhook$1>;
212
+ get(webhookId: string): Promise<Webhook$1>;
213
+ update(webhookId: string, updates: UpdateWebhookRequest$1): Promise<Webhook$1>;
214
+ delete(webhookId: string): Promise<void>;
215
+ list(): Promise<WebhookListResponse>;
216
+ private validateWebhookParams;
217
+ private validateUuid;
218
+ private normalizeWebhookPayload;
219
+ }
220
+
221
+ declare class LicenseChainClient {
222
+ private config;
223
+ private apiClient;
224
+ private licenses;
225
+ private users;
226
+ private products;
227
+ private webhooks;
228
+ constructor(config: Configuration | ConfigurationOptions);
229
+ getConfiguration(): Configuration;
230
+ getLicenses(): LicenseService;
231
+ getUsers(): UserService;
232
+ getProducts(): ProductService;
233
+ getWebhooks(): WebhookService;
234
+ validateLicense(licenseKey: string, hwuid?: string): Promise<{
235
+ valid: boolean;
236
+ }>;
237
+ ping(): Promise<any>;
238
+ health(): Promise<any>;
239
+ static create(apiKey: string, baseUrl?: string): LicenseChainClient;
240
+ static fromEnvironment(): LicenseChainClient;
241
+ updateConfig(config: {
242
+ apiKey?: string;
243
+ baseUrl?: string;
244
+ timeout?: number;
245
+ retries?: number;
246
+ }): void;
247
+ private defaultHwuid;
248
+ }
249
+
250
+ declare class WebhookHandler {
251
+ private secret;
252
+ private tolerance;
253
+ constructor(secret: string, tolerance?: number);
254
+ verifySignature(payload: string, signature: string): boolean;
255
+ verifyTimestamp(timestamp: string): void;
256
+ verifyWebhook(payload: string, signature: string, timestamp: string): void;
257
+ processEvent(eventData: any): void;
258
+ private handleLicenseCreated;
259
+ private handleLicenseUpdated;
260
+ private handleLicenseRevoked;
261
+ private handleLicenseExpired;
262
+ private handleUserCreated;
263
+ private handleUserUpdated;
264
+ private handleUserDeleted;
265
+ private handleProductCreated;
266
+ private handleProductUpdated;
267
+ private handleProductDeleted;
268
+ private handlePaymentCompleted;
269
+ private handlePaymentFailed;
270
+ private handlePaymentRefunded;
271
+ }
272
+ declare class WebhookEvents {
273
+ static readonly LICENSE_CREATED = "license.created";
274
+ static readonly LICENSE_UPDATED = "license.updated";
275
+ static readonly LICENSE_REVOKED = "license.revoked";
276
+ static readonly LICENSE_EXPIRED = "license.expired";
277
+ static readonly USER_CREATED = "user.created";
278
+ static readonly USER_UPDATED = "user.updated";
279
+ static readonly USER_DELETED = "user.deleted";
280
+ static readonly PRODUCT_CREATED = "product.created";
281
+ static readonly PRODUCT_UPDATED = "product.updated";
282
+ static readonly PRODUCT_DELETED = "product.deleted";
283
+ static readonly PAYMENT_COMPLETED = "payment.completed";
284
+ static readonly PAYMENT_FAILED = "payment.failed";
285
+ static readonly PAYMENT_REFUNDED = "payment.refunded";
286
+ }
287
+ declare function createOutgoingWebhookSignature(payload: string, secret: string): string;
288
+ declare function verifyIncomingWebhookSignature(payload: string, signature: string, secret: string): boolean;
289
+
290
+ /**
291
+ * TypeScript type definitions for LicenseChain JavaScript SDK
292
+ */
293
+ interface LicenseChainConfig {
294
+ apiKey: string;
295
+ baseUrl?: string;
296
+ timeout?: number;
297
+ retryAttempts?: number;
298
+ retryDelay?: number;
299
+ }
300
+ interface User {
301
+ id?: string;
302
+ email: string;
303
+ name?: string;
304
+ company?: string;
305
+ createdAt?: string;
306
+ updatedAt?: string;
307
+ emailVerified?: boolean;
308
+ status?: string;
309
+ }
310
+ interface Application {
311
+ id?: string;
312
+ name: string;
313
+ description?: string;
314
+ apiKey?: string;
315
+ webhookUrl?: string;
316
+ allowedOrigins?: string[];
317
+ createdAt?: string;
318
+ updatedAt?: string;
319
+ status?: string;
320
+ licenseCount?: number;
321
+ }
322
+ interface License {
323
+ id?: string;
324
+ key?: string;
325
+ appId: string;
326
+ userId?: string;
327
+ userEmail: string;
328
+ userName?: string;
329
+ status?: string;
330
+ expiresAt?: string;
331
+ createdAt?: string;
332
+ updatedAt?: string;
333
+ metadata?: Record<string, any>;
334
+ features?: string[];
335
+ usageCount?: number;
336
+ }
337
+ interface Webhook {
338
+ id?: string;
339
+ appId: string;
340
+ url: string;
341
+ events?: string[];
342
+ secret?: string;
343
+ status?: string;
344
+ createdAt?: string;
345
+ updatedAt?: string;
346
+ lastTriggeredAt?: string;
347
+ failureCount?: number;
348
+ }
349
+ interface Analytics {
350
+ totalLicenses?: number;
351
+ activeLicenses?: number;
352
+ expiredLicenses?: number;
353
+ revokedLicenses?: number;
354
+ validationsToday?: number;
355
+ validationsThisWeek?: number;
356
+ validationsThisMonth?: number;
357
+ topFeatures?: string[];
358
+ usageByDay?: Array<Record<string, any>>;
359
+ usageByWeek?: Array<Record<string, any>>;
360
+ usageByMonth?: Array<Record<string, any>>;
361
+ }
362
+ interface PaginatedResponse<T = any> {
363
+ data: T[];
364
+ page: number;
365
+ limit: number;
366
+ total: number;
367
+ totalPages: number;
368
+ }
369
+ interface ValidationResult {
370
+ valid: boolean;
371
+ license?: Record<string, any>;
372
+ user?: Record<string, any>;
373
+ app?: Record<string, any>;
374
+ expiresAt?: string;
375
+ metadata?: Record<string, any>;
376
+ error?: string;
377
+ }
378
+ interface ApiResponse<T = any> {
379
+ data?: T;
380
+ error?: string;
381
+ message?: string;
382
+ status?: number;
383
+ }
384
+ interface RequestOptions {
385
+ timeout?: number;
386
+ retries?: number;
387
+ retryDelay?: number;
388
+ headers?: Record<string, string>;
389
+ }
390
+ interface WebhookEvent {
391
+ id: string;
392
+ type: string;
393
+ createdAt: string;
394
+ data: Record<string, any>;
395
+ }
396
+ interface WebhookPayload {
397
+ id: string;
398
+ type: string;
399
+ createdAt: string;
400
+ data: Record<string, any>;
401
+ signature?: string;
402
+ }
403
+ interface LicenseValidationRules {
404
+ maxUsage?: number;
405
+ allowedFeatures?: string[];
406
+ requiredFeatures?: string[];
407
+ maxConcurrentUsers?: number;
408
+ allowedDomains?: string[];
409
+ allowedIPs?: string[];
410
+ }
411
+ interface CreateLicenseRequest {
412
+ appId: string;
413
+ userEmail: string;
414
+ userName?: string;
415
+ expiresAt?: string;
416
+ metadata?: Record<string, any>;
417
+ features?: string[];
418
+ }
419
+ interface UpdateLicenseRequest {
420
+ status?: string;
421
+ expiresAt?: string;
422
+ metadata?: Record<string, any>;
423
+ features?: string[];
424
+ }
425
+ interface CreateApplicationRequest {
426
+ name: string;
427
+ description?: string;
428
+ webhookUrl?: string;
429
+ allowedOrigins?: string[];
430
+ }
431
+ interface UpdateApplicationRequest {
432
+ name?: string;
433
+ description?: string;
434
+ webhookUrl?: string;
435
+ allowedOrigins?: string[];
436
+ }
437
+ interface CreateWebhookRequest {
438
+ appId: string;
439
+ url: string;
440
+ events: string[];
441
+ secret?: string;
442
+ }
443
+ interface UpdateWebhookRequest {
444
+ url?: string;
445
+ events?: string[];
446
+ secret?: string;
447
+ status?: string;
448
+ }
449
+ interface ListOptions {
450
+ page?: number;
451
+ limit?: number;
452
+ sortBy?: string;
453
+ sortOrder?: 'asc' | 'desc';
454
+ filter?: Record<string, any>;
455
+ }
456
+ interface LicenseListOptions extends ListOptions {
457
+ appId?: string;
458
+ status?: string;
459
+ userId?: string;
460
+ userEmail?: string;
461
+ }
462
+ interface ApplicationListOptions extends ListOptions {
463
+ status?: string;
464
+ }
465
+ interface WebhookListOptions extends ListOptions {
466
+ appId?: string;
467
+ status?: string;
468
+ }
469
+ interface AnalyticsOptions {
470
+ appId?: string;
471
+ startDate?: string;
472
+ endDate?: string;
473
+ metric?: string;
474
+ period?: string;
475
+ }
476
+ interface UsageStatsOptions {
477
+ appId?: string;
478
+ period?: string;
479
+ granularity?: 'day' | 'week' | 'month';
480
+ }
481
+ interface PaginationInfo {
482
+ page: number;
483
+ limit: number;
484
+ total: number;
485
+ totalPages: number;
486
+ hasNextPage: boolean;
487
+ hasPreviousPage: boolean;
488
+ nextPage?: number;
489
+ previousPage?: number;
490
+ }
491
+ interface ErrorResponse {
492
+ error: string;
493
+ message?: string;
494
+ code?: string;
495
+ details?: Record<string, any>;
496
+ timestamp?: string;
497
+ }
498
+ interface RateLimitInfo {
499
+ limit: number;
500
+ remaining: number;
501
+ reset: number;
502
+ retryAfter?: number;
503
+ }
504
+ interface ClientInfo {
505
+ version: string;
506
+ userAgent: string;
507
+ platform?: string;
508
+ language?: string;
509
+ }
510
+ interface WebhookVerificationResult {
511
+ valid: boolean;
512
+ event?: WebhookEvent;
513
+ error?: string;
514
+ }
515
+ interface LicenseValidationContext {
516
+ licenseKey: string;
517
+ appId?: string;
518
+ userId?: string;
519
+ userEmail?: string;
520
+ ipAddress?: string;
521
+ userAgent?: string;
522
+ timestamp?: string;
523
+ metadata?: Record<string, any>;
524
+ }
525
+
526
+ /**
527
+ * LicenseChain License Validator
528
+ *
529
+ * Easy-to-use license validation functionality.
530
+ */
531
+
532
+ declare class LicenseValidator {
533
+ private client;
534
+ constructor(config: {
535
+ apiKey: string;
536
+ baseUrl?: string;
537
+ timeout?: number;
538
+ retryAttempts?: number;
539
+ retryDelay?: number;
540
+ });
541
+ /**
542
+ * Validate a license key
543
+ */
544
+ validateLicense(licenseKey: string, appId?: string, context?: Partial<LicenseValidationContext>): Promise<ValidationResult>;
545
+ /**
546
+ * Check if license is valid (quick check)
547
+ */
548
+ isValid(licenseKey: string, appId?: string): Promise<boolean>;
549
+ /**
550
+ * Get license information
551
+ */
552
+ getLicenseInfo(licenseKey: string, appId?: string): Promise<ValidationResult | null>;
553
+ /**
554
+ * Check if license is expired
555
+ */
556
+ isExpired(licenseKey: string, appId?: string): Promise<boolean>;
557
+ /**
558
+ * Get days until expiration
559
+ */
560
+ getDaysUntilExpiration(licenseKey: string, appId?: string): Promise<number | null>;
561
+ /**
562
+ * Validate multiple licenses
563
+ */
564
+ validateLicenses(licenseKeys: string[], appId?: string): Promise<ValidationResult[]>;
565
+ /**
566
+ * Validate with custom validation rules
567
+ */
568
+ validateWithRules(licenseKey: string, rules: LicenseValidationRules, appId?: string): Promise<ValidationResult>;
569
+ /**
570
+ * Check if license has specific feature
571
+ */
572
+ hasFeature(licenseKey: string, feature: string, appId?: string): Promise<boolean>;
573
+ /**
574
+ * Get license usage count
575
+ */
576
+ getUsageCount(licenseKey: string, appId?: string): Promise<number | null>;
577
+ /**
578
+ * Get license metadata
579
+ */
580
+ getMetadata(licenseKey: string, appId?: string): Promise<Record<string, any> | null>;
581
+ /**
582
+ * Get license features
583
+ */
584
+ getFeatures(licenseKey: string, appId?: string): Promise<string[]>;
585
+ /**
586
+ * Get user information from license
587
+ */
588
+ getUserInfo(licenseKey: string, appId?: string): Promise<{
589
+ email?: string;
590
+ name?: string;
591
+ id?: string;
592
+ } | null>;
593
+ /**
594
+ * Get application information from license
595
+ */
596
+ getAppInfo(licenseKey: string, appId?: string): Promise<{
597
+ name?: string;
598
+ id?: string;
599
+ } | null>;
600
+ /**
601
+ * Validate license with context
602
+ */
603
+ validateWithContext(context: LicenseValidationContext): Promise<ValidationResult>;
604
+ /**
605
+ * Batch validate licenses with rules
606
+ */
607
+ batchValidateWithRules(licenses: Array<{
608
+ licenseKey: string;
609
+ appId?: string;
610
+ rules?: LicenseValidationRules;
611
+ }>): Promise<ValidationResult[]>;
612
+ /**
613
+ * Get client instance for advanced operations
614
+ */
615
+ getClient(): LicenseChainClient;
616
+ /**
617
+ * Update configuration
618
+ */
619
+ updateConfig(config: {
620
+ apiKey?: string;
621
+ baseUrl?: string;
622
+ timeout?: number;
623
+ retryAttempts?: number;
624
+ retryDelay?: number;
625
+ }): void;
626
+ }
627
+
628
+ /** Must match Core API `LICENSE_TOKEN_USE_CLAIM`. */
629
+ declare const LICENSE_TOKEN_USE_CLAIM = "licensechain_license_v1";
630
+ type VerifyLicenseAssertionOptions = {
631
+ /** When set, payload `aud` must equal this Dashboard app id. */
632
+ expectedAppId?: string;
633
+ /** When set, passed to JWT issuer verification. */
634
+ issuer?: string;
635
+ };
636
+ /**
637
+ * Verify a `license_token` from POST /v1/licenses/verify using the JWKS URL
638
+ * from the same response (`license_jwks_uri`) or `GET /v1/licenses/jwks`.
639
+ * Same contract as `licensechain-node-sdk` — also exported from the package root (`dist/index.js`).
640
+ */
641
+ declare function verifyLicenseAssertionJwt(token: string, jwksUrl: string, options?: VerifyLicenseAssertionOptions): Promise<jose.JWTPayload>;
642
+
643
+ /**
644
+ * LicenseChain JavaScript SDK Exceptions
645
+ *
646
+ * Custom exceptions for the LicenseChain JavaScript SDK.
647
+ */
648
+ declare class LicenseChainException extends Error {
649
+ readonly code?: string;
650
+ readonly statusCode?: number;
651
+ readonly details?: Record<string, any>;
652
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>);
653
+ }
654
+ declare class AuthenticationError extends LicenseChainException {
655
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>);
656
+ }
657
+ declare class ValidationError extends LicenseChainException {
658
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>);
659
+ }
660
+ declare class NotFoundError extends LicenseChainException {
661
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>);
662
+ }
663
+ declare class RateLimitError extends LicenseChainException {
664
+ readonly retryAfter?: number;
665
+ readonly limit?: number;
666
+ readonly remaining?: number;
667
+ readonly reset?: number;
668
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>, retryAfter?: number, limit?: number, remaining?: number, reset?: number);
669
+ }
670
+ declare class ServerError extends LicenseChainException {
671
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>);
672
+ }
673
+ declare class NetworkError extends LicenseChainException {
674
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>);
675
+ }
676
+ declare class WebhookVerificationError extends LicenseChainException {
677
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>);
678
+ }
679
+ declare class LicenseValidationError extends LicenseChainException {
680
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>);
681
+ }
682
+ declare class ConfigurationError extends LicenseChainException {
683
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>);
684
+ }
685
+ declare class TimeoutError extends LicenseChainException {
686
+ constructor(message?: string, code?: string, statusCode?: number, details?: Record<string, any>);
687
+ }
688
+ declare const NetworkException: typeof NetworkError;
689
+ declare const ServerException: typeof ServerError;
690
+ declare const ValidationException: typeof ValidationError;
691
+ declare const AuthenticationException: typeof AuthenticationError;
692
+ declare const NotFoundException: typeof NotFoundError;
693
+ declare const RateLimitException: typeof RateLimitError;
694
+ declare const ConfigurationException: typeof ConfigurationError;
695
+ /**
696
+ * Error factory for creating appropriate exceptions based on HTTP status codes
697
+ */
698
+ declare function createErrorFromResponse(statusCode: number, message: string, code?: string, details?: Record<string, any>): LicenseChainException;
699
+ /**
700
+ * Check if an error is a LicenseChain exception
701
+ */
702
+ declare function isLicenseChainError(error: any): error is LicenseChainException;
703
+ /**
704
+ * Check if an error is a retryable error
705
+ */
706
+ declare function isRetryableError(error: any): boolean;
707
+
708
+ declare function validateEmail(email: string): boolean;
709
+ declare function validateLicenseKey(licenseKey: string): boolean;
710
+ declare function validateUuid(uuid: string): boolean;
711
+ declare function validateAmount(amount: number): boolean;
712
+ declare function validateCurrency(currency: string): boolean;
713
+ declare function validateStatus(status: string, allowedStatuses: string[]): boolean;
714
+ declare function sanitizeInput(input: string): string;
715
+ declare function sanitizeMetadata(metadata: Record<string, any>): Record<string, any>;
716
+ declare function generateLicenseKey(): string;
717
+ declare function generateUuid(): string;
718
+ declare function formatTimestamp(timestamp: number): string;
719
+ declare function parseTimestamp(timestamp: string): number;
720
+ declare function validatePagination(page?: number, limit?: number): [number, number];
721
+ declare function validateDateRange(startDate: string, endDate: string): void;
722
+ declare function createWebhookSignature(payload: string, secret: string): string;
723
+ declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
724
+ declare function retryWithBackoff<T>(fn: () => Promise<T>, maxRetries?: number, initialDelay?: number): Promise<T>;
725
+ declare function formatBytes(bytes: number): string;
726
+ declare function formatDuration(seconds: number): string;
727
+ declare function capitalizeFirst(text: string): string;
728
+ declare function toSnakeCase(text: string): string;
729
+ declare function toPascalCase(text: string): string;
730
+ declare function truncateString(text: string, maxLength: number): string;
731
+ declare function removeSpecialChars(text: string): string;
732
+ declare function slugify(text: string): string;
733
+ declare function validateNotEmpty(value: string, fieldName: string): void;
734
+ declare function validatePositive(value: number, fieldName: string): void;
735
+ declare function validateRange(value: number, min: number, max: number, fieldName: string): void;
736
+ declare function jsonSerialize(obj: any): string;
737
+ declare function jsonDeserialize(jsonString: string): any;
738
+ declare function deepMerge(target: Record<string, any>, source: Record<string, any>): Record<string, any>;
739
+ declare function chunkArray<T>(array: T[], chunkSize: number): T[][];
740
+ declare function flattenObject(obj: Record<string, any>, separator?: string): Record<string, any>;
741
+ declare function unflattenObject(obj: Record<string, any>, separator?: string): Record<string, any>;
742
+ declare function generateRandomString(length: number, characters?: string): string;
743
+ declare function generateRandomBytes(length: number): Buffer;
744
+ declare function sha256(data: string): string;
745
+ declare function sha1(data: string): string;
746
+ declare function md5(data: string): string;
747
+ declare function base64Encode(data: string): string;
748
+ declare function base64Decode(data: string): string;
749
+ declare function urlEncode(data: string): string;
750
+ declare function urlDecode(data: string): string;
751
+ declare function isValidJson(jsonString: string): boolean;
752
+ declare function isValidUrl(url: string): boolean;
753
+ declare function isValidIp(ip: string): boolean;
754
+ declare function isValidEmail(email: string): boolean;
755
+ declare function getCurrentTimestamp(): number;
756
+ declare function getCurrentDate(): string;
757
+ declare function getCurrentDateFormatted(format: string): string;
758
+ declare function sleep(ms: number): Promise<void>;
759
+ declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
760
+ declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void;
761
+
762
+ export { ApiClient, AuthenticationError, AuthenticationException, Configuration, ConfigurationError, ConfigurationException, LICENSE_TOKEN_USE_CLAIM, LicenseChainClient, LicenseChainException, LicenseService, LicenseValidationError, LicenseValidator, NetworkError, NetworkException, NotFoundError, NotFoundException, ProductService, RateLimitError, RateLimitException, ServerError, ServerException, TimeoutError, UserService, ValidationError, ValidationException, WebhookEvents, WebhookHandler, WebhookService, WebhookVerificationError, base64Decode, base64Encode, capitalizeFirst, chunkArray, createErrorFromResponse, createOutgoingWebhookSignature, createWebhookSignature, debounce, deepMerge, LicenseChainClient as default, flattenObject, formatBytes, formatDuration, formatTimestamp, generateLicenseKey, generateRandomBytes, generateRandomString, generateUuid, getCurrentDate, getCurrentDateFormatted, getCurrentTimestamp, isLicenseChainError, isRetryableError, isValidEmail, isValidIp, isValidJson, isValidUrl, jsonDeserialize, jsonSerialize, md5, parseTimestamp, removeSpecialChars, retryWithBackoff, sanitizeInput, sanitizeMetadata, sha1, sha256, sleep, slugify, throttle, toPascalCase, toSnakeCase, truncateString, unflattenObject, urlDecode, urlEncode, validateAmount, validateCurrency, validateDateRange, validateEmail, validateLicenseKey, validateNotEmpty, validatePagination, validatePositive, validateRange, validateStatus, validateUuid, verifyIncomingWebhookSignature, verifyLicenseAssertionJwt, verifyWebhookSignature };
763
+ export type { Analytics, AnalyticsOptions, ApiResponse, Application, ApplicationListOptions, ClientInfo, ConfigurationOptions, CreateApplicationRequest, CreateLicenseRequest, CreateWebhookRequest, ErrorResponse, License, LicenseChainConfig, LicenseListOptions, LicenseValidationContext, LicenseValidationRules, ListOptions, PaginatedResponse, PaginationInfo, RateLimitInfo, RequestOptions, UpdateApplicationRequest, UpdateLicenseRequest, UpdateWebhookRequest, UsageStatsOptions, User, ValidationResult, VerifyLicenseAssertionOptions, Webhook, WebhookEvent, WebhookListOptions, WebhookPayload, WebhookVerificationResult };