@moontra/moonui-pro 2.36.7 → 2.37.1

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,103 @@
1
+ /**
2
+ * Server-side authentication utilities for MoonUI Pro
3
+ * These functions should ONLY run on the server
4
+ */
5
+ /**
6
+ * Encrypt data for secure cookie storage
7
+ */
8
+ declare function encryptData(data: any): string;
9
+ /**
10
+ * Decrypt data from secure cookie
11
+ */
12
+ declare function decryptData(encryptedData: string): any;
13
+ /**
14
+ * Generate device fingerprint from request (server-side)
15
+ */
16
+ declare function generateServerDeviceFingerprint(): Promise<string>;
17
+ /**
18
+ * Validate with MoonUI server (server-to-server call)
19
+ */
20
+ declare function validateWithMoonUIServer(token: string, deviceId: string): Promise<{
21
+ valid: boolean;
22
+ hasProAccess: boolean;
23
+ plan?: string;
24
+ error?: string;
25
+ }>;
26
+ /**
27
+ * Get validation from cookies (server-side)
28
+ */
29
+ declare function getValidationFromCookies(): Promise<{
30
+ valid: boolean;
31
+ hasProAccess: boolean;
32
+ timestamp: number;
33
+ } | null>;
34
+ /**
35
+ * Set validation in cookies (server-side)
36
+ */
37
+ declare function setValidationInCookies(validation: {
38
+ valid: boolean;
39
+ hasProAccess: boolean;
40
+ plan?: string;
41
+ }): Promise<void>;
42
+ /**
43
+ * Clear validation cookies
44
+ */
45
+ declare function clearValidationCookies(): Promise<void>;
46
+ /**
47
+ * Perform full server-side validation
48
+ */
49
+ declare function performServerValidation(): Promise<{
50
+ valid: boolean;
51
+ hasProAccess: boolean;
52
+ plan?: string;
53
+ cached?: boolean;
54
+ }>;
55
+
56
+ /**
57
+ * MoonUI Pro Authentication Configuration
58
+ *
59
+ * This configuration is determined at BUILD TIME, not runtime.
60
+ * It ensures zero external API calls from the browser.
61
+ */
62
+ declare const AUTH_CONFIG: {
63
+ readonly internalEndpoint: "/api/moonui/validate-pro";
64
+ readonly cache: {
65
+ readonly serverCacheDuration: number;
66
+ readonly cookieMaxAge: number;
67
+ readonly refreshThreshold: 0.5;
68
+ };
69
+ readonly security: {
70
+ readonly enforceDeviceFingerprint: true;
71
+ readonly maxDevicesPerLicense: 3 | 5;
72
+ readonly sessionTimeout: number;
73
+ readonly cookieOptions: {
74
+ readonly httpOnly: true;
75
+ readonly secure: boolean;
76
+ readonly sameSite: "lax";
77
+ readonly path: "/";
78
+ };
79
+ };
80
+ readonly api: {
81
+ readonly moonuiValidationEndpoint: "https://api.moonui.dev/v1/license/validate";
82
+ readonly timeout: 10000;
83
+ readonly retry: {
84
+ readonly attempts: 1 | 3;
85
+ readonly delay: 1000;
86
+ };
87
+ };
88
+ readonly cookies: {
89
+ readonly validation: "moonui_pro_validation";
90
+ readonly session: "moonui_pro_session";
91
+ readonly device: "moonui_pro_device";
92
+ };
93
+ readonly headers: {
94
+ readonly validation: "x-moonui-pro-validation";
95
+ readonly device: "x-moonui-device-id";
96
+ readonly session: "x-moonui-session-id";
97
+ };
98
+ };
99
+ type AuthConfig = typeof AUTH_CONFIG;
100
+ type CacheConfig = typeof AUTH_CONFIG.cache;
101
+ type SecurityConfig = typeof AUTH_CONFIG.security;
102
+
103
+ export { AUTH_CONFIG, AuthConfig, CacheConfig, SecurityConfig, clearValidationCookies, decryptData, encryptData, generateServerDeviceFingerprint, getValidationFromCookies, performServerValidation, setValidationInCookies, validateWithMoonUIServer };