3xui-api-client 2.0.0 → 2.1.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.
package/index.d.ts CHANGED
@@ -1,416 +1,437 @@
1
- // Type definitions for 3xui-api-client v2.0.0
2
-
3
- declare module '3xui-api-client' {
4
- import { AxiosInstance } from 'axios';
5
-
6
- // ===========================================
7
- // CORE INTERFACES
8
- // ===========================================
9
-
10
- export interface ThreeXUIOptions {
11
- sessionManager?: SessionManager | SessionConfig;
12
- autoGenerateCredentials?: boolean;
13
- timeout?: number;
14
- }
15
-
16
- export interface LoginResponse {
17
- success: boolean;
18
- fromCache?: boolean;
19
- headers?: any;
20
- data: any;
21
- }
22
-
23
- export interface InboundConfig {
24
- remark: string;
25
- port: number;
26
- protocol: string;
27
- settings: any;
28
- streamSettings?: any;
29
- listen?: string;
30
- enable?: boolean;
31
- }
32
-
33
- export interface ClientConfig {
34
- id: number;
35
- settings: string;
36
- }
37
-
38
- // ===========================================
39
- // CREDENTIAL GENERATION INTERFACES
40
- // ===========================================
41
-
42
- export interface CredentialOptions {
43
- email?: string;
44
- passwordLength?: number;
45
- level?: number;
46
- alterId?: number;
47
- flow?: string;
48
- method?: string;
49
- username?: string;
50
- limitIp?: number;
51
- totalGB?: number;
52
- expiryTime?: number;
53
- enable?: boolean;
54
- subId?: string;
55
- allowedIPs?: string[];
56
- keepAlive?: number;
57
- }
58
-
59
- export interface VLESSCredentials {
60
- id: string;
61
- email: string;
62
- flow: string;
63
- encryption: string;
64
- }
65
-
66
- export interface VMESSCredentials {
67
- id: string;
68
- email: string;
69
- level: number;
70
- alterId: number;
71
- }
72
-
73
- export interface TrojanCredentials {
74
- password: string;
75
- email: string;
76
- level: number;
77
- }
78
-
79
- export interface ShadowsocksCredentials {
80
- method: string;
81
- password: string;
82
- email: string;
83
- }
84
-
85
- export interface WireGuardCredentials {
86
- privateKey: string;
87
- publicKey: string;
88
- allowedIPs: string[];
89
- keepAlive: number;
90
- }
91
-
92
- export interface SocksCredentials {
93
- user: string;
94
- pass: string;
95
- email: string;
96
- }
97
-
98
- export interface ValidationResult {
99
- valid: boolean;
100
- errors: string[];
101
- }
102
-
103
- export interface WireGuardKeys {
104
- privateKey: string;
105
- publicKey: string;
106
- generateClientConfig: (allowedIPs?: string[]) => any;
107
- }
108
-
109
- export interface RealityKeys {
110
- privateKey: string;
111
- publicKey: string;
112
- generateRealityConfig: (dest?: string, serverNames?: string[]) => any;
113
- }
114
-
115
- // ===========================================
116
- // SESSION MANAGEMENT INTERFACES
117
- // ===========================================
118
-
119
- export interface SessionConfig {
120
- sessionTTL?: number;
121
- autoRefresh?: boolean;
122
- refreshThreshold?: number;
123
- store?: SessionStore;
124
- redis?: any;
125
- redisOptions?: any;
126
- database?: any;
127
- databaseOptions?: any;
128
- customHandler?: any;
129
- }
130
-
131
- export interface SessionStore {
132
- get(key: string): Promise<any>;
133
- set(key: string, value: any, ttl?: number): Promise<void>;
134
- delete(key: string): Promise<void>;
135
- clear(): Promise<void>;
136
- exists(key: string): Promise<boolean>;
137
- }
138
-
139
- export interface SessionManager {
140
- generateSessionKey(baseURL: string, username: string): string;
141
- storeSession(baseURL: string, username: string, sessionData: any): Promise<string>;
142
- getSession(baseURL: string, username: string): Promise<any>;
143
- hasValidSession(baseURL: string, username: string): Promise<boolean>;
144
- shouldRefreshSession(session: any): boolean;
145
- deleteSession(baseURL: string, username: string): Promise<void>;
146
- clearAllSessions(): Promise<void>;
147
- getStats(): Promise<any>;
148
- }
149
-
150
- // ===========================================
151
- // WEB MIDDLEWARE INTERFACES
152
- // ===========================================
153
-
154
- export interface ExpressMiddlewareConfig {
155
- baseURL: string;
156
- username: string;
157
- password: string;
158
- sessionManager?: SessionManager;
159
- sessionKey?: string;
160
- }
161
-
162
- export interface NextJSConfig {
163
- baseURL: string;
164
- username: string;
165
- password: string;
166
- sessionManager?: SessionManager;
167
- }
168
-
169
- export interface ReactHookMethods {
170
- generateCredentials(protocol: string, options?: CredentialOptions): Promise<any>;
171
- addClientWithCredentials(inboundId: number, protocol: string, options?: CredentialOptions): Promise<any>;
172
- getInbounds(): Promise<any[]>;
173
- getClientTraffic(email: string): Promise<any>;
174
- }
175
-
176
- // ===========================================
177
- // PROTOCOL BUILDER INTERFACES
178
- // ===========================================
179
-
180
- export interface BuilderConfig {
181
- protocol: string;
182
- settings: any;
183
- streamSettings?: any;
184
- remark?: string;
185
- port?: number;
186
- listen?: string;
187
- enable?: boolean;
188
- }
189
-
190
- export interface TLSOptions {
191
- serverName?: string;
192
- certificates?: any[];
193
- certFile?: string;
194
- keyFile?: string;
195
- }
196
-
197
- export interface RealityOptions {
198
- keys?: RealityKeys;
199
- dest?: string;
200
- serverNames?: string[];
201
- shortIds?: string[];
202
- }
203
-
204
- export interface WebSocketOptions {
205
- path?: string;
206
- headers?: Record<string, string>;
207
- }
208
-
209
- export interface HTTP2Options {
210
- path?: string;
211
- host?: string[];
212
- }
213
-
214
- export interface GRPCOptions {
215
- serviceName?: string;
216
- }
217
-
218
- // ===========================================
219
- // MAIN CLASS
220
- // ===========================================
221
-
222
- export default class ThreeXUI {
223
- constructor(baseURL: string, username: string, password: string, options?: ThreeXUIOptions);
224
-
225
- // Authentication
226
- login(forceRefresh?: boolean): Promise<LoginResponse>;
227
- logout(): Promise<void>;
228
-
229
- // Credential Generation Methods
230
- generateCredentials(protocol: string, options?: CredentialOptions): VLESSCredentials | VMESSCredentials | TrojanCredentials | ShadowsocksCredentials | WireGuardCredentials | SocksCredentials;
231
- generateUUID(secure?: boolean): string;
232
- generatePassword(length?: number, options?: any): string;
233
- generateBulkCredentials(protocol: string, count: number, options?: CredentialOptions): any[];
234
- getShadowsocksCiphers(): string[];
235
- getRecommendedShadowsocksCipher(): string;
236
- generateWireGuardKeys(): WireGuardKeys;
237
- generateRealityKeys(): RealityKeys;
238
- generatePort(min?: number, max?: number): number;
239
- validateCredentials(credentials: any, protocol: string): ValidationResult;
240
-
241
- // Enhanced Client Management
242
- addClientWithCredentials(inboundId: number, protocol: string, options?: CredentialOptions): Promise<any>;
243
-
244
- // Session Management
245
- getSessionStats(): Promise<any>;
246
- clearAllSessions(): Promise<void>;
247
- isSessionValid(): Promise<boolean>;
248
-
249
- // Original API Methods
250
- getInbounds(): Promise<any>;
251
- getInbound(id: number): Promise<any>;
252
- addInbound(inboundConfig: InboundConfig): Promise<any>;
253
- deleteInbound(id: number): Promise<any>;
254
- updateInbound(id: number, inboundConfig: InboundConfig): Promise<any>;
255
- addClient(clientConfig: ClientConfig): Promise<any>;
256
- deleteClient(inboundId: number, clientId: string): Promise<any>;
257
- updateClient(clientId: string, clientConfig: ClientConfig): Promise<any>;
258
- getClientTrafficsByEmail(email: string): Promise<any>;
259
- getClientTrafficsById(id: number): Promise<any>;
260
- getClientIps(email: string): Promise<any>;
261
- clearClientIps(email: string): Promise<any>;
262
- resetClientTraffic(inboundId: number, email: string): Promise<any>;
263
- resetAllTraffics(): Promise<any>;
264
- resetAllClientTraffics(inboundId: number): Promise<any>;
265
- deleteDepletedClients(inboundId: number): Promise<any>;
266
- getOnlineClients(): Promise<any>;
267
- createBackup(): Promise<any>;
268
-
269
- // Static exports
270
- static CredentialGenerator: typeof CredentialGenerator;
271
- static SessionManager: typeof SessionManager;
272
- static createSessionManager: (options?: SessionConfig) => SessionManager;
273
- }
274
-
275
- // ===========================================
276
- // CREDENTIAL GENERATOR CLASS
277
- // ===========================================
278
-
279
- export class CredentialGenerator {
280
- static generateUUID(): string;
281
- static generateSecureUUID(): string;
282
- static generatePassword(length?: number, options?: any): string;
283
- static generateShadowsocks2022PSK(method?: string): string;
284
- static generateWireGuardKeys(): WireGuardKeys;
285
- static generateRealityKeys(): RealityKeys;
286
- static generateUsername(prefix?: string): string;
287
- static generateEmail(domain?: string): string;
288
- static getRecommendedShadowsocksCipher(): string;
289
- static getShadowsocksCipherMethods(): string[];
290
- static generatePort(min?: number, max?: number): number;
291
- static generateRealityShortId(): string;
292
- static generateForProtocol(protocol: string, options?: CredentialOptions): any;
293
- static generateBulk(protocol: string, count: number, options?: CredentialOptions): any[];
294
- static validateCredentials(credentials: any, protocol: string): ValidationResult;
295
- }
296
-
297
- // ===========================================
298
- // SESSION MANAGEMENT CLASSES
299
- // ===========================================
300
-
301
- export class SessionStore {
302
- get(key: string): Promise<any>;
303
- set(key: string, value: any, ttl?: number): Promise<void>;
304
- delete(key: string): Promise<void>;
305
- clear(): Promise<void>;
306
- exists(key: string): Promise<boolean>;
307
- }
308
-
309
- export class MemorySessionStore extends SessionStore {
310
- constructor();
311
- getStats(): any;
312
- }
313
-
314
- export class RedisSessionStore extends SessionStore {
315
- constructor(redisClient: any, options?: any);
316
- }
317
-
318
- export class DatabaseSessionStore extends SessionStore {
319
- constructor(database: any, options?: any);
320
- cleanupExpired(): Promise<number>;
321
- static getCreateTableSQL(tableName?: string): string;
322
- }
323
-
324
- export class CustomSessionHandler {
325
- constructor(handlers: any);
326
- validate(key: string): Promise<boolean>;
327
- }
328
-
329
- export function createSessionManager(options?: SessionConfig): SessionManager;
330
- export function createMemoryStore(): MemorySessionStore;
331
- export function createRedisStore(redisClient: any, options?: any): RedisSessionStore;
332
- export function createDatabaseStore(database: any, options?: any): DatabaseSessionStore;
333
- export function createCustomHandler(handlers: any): CustomSessionHandler;
334
-
335
- // ===========================================
336
- // WEB MIDDLEWARE EXPORTS
337
- // ===========================================
338
-
339
- export function createExpressMiddleware(config: ExpressMiddlewareConfig): any;
340
- export function withThreeXUI(config: NextJSConfig, handler: any): any;
341
- export function createReactHook(apiEndpoint?: string): ReactHookMethods;
342
- export function createNextjsRoutes(config: NextJSConfig): any;
343
-
344
- export const SessionConfig: {
345
- memory(): SessionConfig;
346
- redis(redisClient: any, options?: any): SessionConfig;
347
- database(database: any, options?: any): SessionConfig;
348
- custom(handlers: any): SessionConfig;
349
- };
350
-
351
- // ===========================================
352
- // PROTOCOL BUILDERS
353
- // ===========================================
354
-
355
- export class BaseBuilder {
356
- constructor();
357
- remark(remark: string): this;
358
- port(port: number): this;
359
- randomPort(min?: number, max?: number): this;
360
- listen(listen?: string): this;
361
- enable(enabled?: boolean): this;
362
- build(): BuilderConfig;
363
- }
364
-
365
- export class VLESSBuilder extends BaseBuilder {
366
- addClient(options?: CredentialOptions): this;
367
- network(network: string): this;
368
- tls(options?: TLSOptions): this;
369
- reality(options?: RealityOptions): this;
370
- websocket(options?: WebSocketOptions): this;
371
- http2(options?: HTTP2Options): this;
372
- grpc(options?: GRPCOptions): this;
373
- flow(flow: string): this;
374
- }
375
-
376
- export class VMESSBuilder extends BaseBuilder {
377
- addClient(options?: CredentialOptions): this;
378
- network(network: string): this;
379
- tls(options?: TLSOptions): this;
380
- websocket(options?: WebSocketOptions): this;
381
- }
382
-
383
- export class TrojanBuilder extends BaseBuilder {
384
- addClient(options?: CredentialOptions): this;
385
- tls(options?: TLSOptions): this;
386
- fallbacks(fallbacks: any[]): this;
387
- }
388
-
389
- export class ShadowsocksBuilder extends BaseBuilder {
390
- method(method: string): this;
391
- password(password?: string): this;
392
- generatePassword(length?: number): this;
393
- network(network: string): this;
394
- }
395
-
396
- export class WireGuardBuilder extends BaseBuilder {
397
- serverKeys(keys?: WireGuardKeys): this;
398
- address(addresses: string | string[]): this;
399
- addPeer(options?: any): this;
400
- mtu(mtu: number): this;
401
- }
402
-
403
- export class ProtocolBuilder {
404
- static vless(): VLESSBuilder;
405
- static vmess(): VMESSBuilder;
406
- static trojan(): TrojanBuilder;
407
- static shadowsocks(): ShadowsocksBuilder;
408
- static wireguard(): WireGuardBuilder;
409
- static templates: {
410
- vlessReality(options?: any): BuilderConfig;
411
- vmessWsTls(options?: any): BuilderConfig;
412
- trojanTls(options?: any): BuilderConfig;
413
- shadowsocks(options?: any): BuilderConfig;
414
- };
415
- }
416
- }
1
+ // Type definitions for 3xui-api-client v2.0.0
2
+
3
+ declare module '3xui-api-client' {
4
+ import { AxiosInstance } from 'axios';
5
+
6
+ // ===========================================
7
+ // CORE INTERFACES
8
+ // ===========================================
9
+
10
+ export interface ThreeXUIOptions {
11
+ sessionManager?: SessionManager | SessionConfig;
12
+ autoGenerateCredentials?: boolean;
13
+ timeout?: number;
14
+ maxRequestsPerMinute?: number;
15
+ maxLoginAttemptsPerHour?: number;
16
+ isDevelopment?: boolean;
17
+ enableCSP?: boolean;
18
+ userAgent?: string;
19
+ }
20
+
21
+ export interface LoginResponse {
22
+ success: boolean;
23
+ fromCache?: boolean;
24
+ headers?: any;
25
+ data: any;
26
+ }
27
+
28
+ export interface InboundConfig {
29
+ remark: string;
30
+ port: number;
31
+ protocol: string;
32
+ settings: any;
33
+ streamSettings?: any;
34
+ listen?: string;
35
+ enable?: boolean;
36
+ }
37
+
38
+ export interface ClientConfig {
39
+ id: number;
40
+ settings: string;
41
+ }
42
+
43
+ // ===========================================
44
+ // CREDENTIAL GENERATION INTERFACES
45
+ // ===========================================
46
+
47
+ export interface CredentialOptions {
48
+ email?: string;
49
+ passwordLength?: number;
50
+ level?: number;
51
+ alterId?: number;
52
+ flow?: string;
53
+ method?: string;
54
+ username?: string;
55
+ limitIp?: number;
56
+ totalGB?: number;
57
+ expiryTime?: number;
58
+ enable?: boolean;
59
+ subId?: string;
60
+ allowedIPs?: string[];
61
+ keepAlive?: number;
62
+ }
63
+
64
+ export interface VLESSCredentials {
65
+ id: string;
66
+ email: string;
67
+ flow: string;
68
+ encryption: string;
69
+ }
70
+
71
+ export interface VMESSCredentials {
72
+ id: string;
73
+ email: string;
74
+ level: number;
75
+ alterId: number;
76
+ }
77
+
78
+ export interface TrojanCredentials {
79
+ password: string;
80
+ email: string;
81
+ level: number;
82
+ }
83
+
84
+ export interface ShadowsocksCredentials {
85
+ method: string;
86
+ password: string;
87
+ email: string;
88
+ }
89
+
90
+ export interface WireGuardCredentials {
91
+ privateKey: string;
92
+ publicKey: string;
93
+ allowedIPs: string[];
94
+ keepAlive: number;
95
+ }
96
+
97
+ export interface SocksCredentials {
98
+ user: string;
99
+ pass: string;
100
+ email: string;
101
+ }
102
+
103
+ export interface ValidationResult {
104
+ valid: boolean;
105
+ errors: string[];
106
+ }
107
+
108
+ export interface WireGuardKeys {
109
+ privateKey: string;
110
+ publicKey: string;
111
+ generateClientConfig: (allowedIPs?: string[]) => any;
112
+ }
113
+
114
+ export interface RealityKeys {
115
+ privateKey: string;
116
+ publicKey: string;
117
+ generateRealityConfig: (dest?: string, serverNames?: string[]) => any;
118
+ }
119
+
120
+ // ===========================================
121
+ // SESSION MANAGEMENT INTERFACES
122
+ // ===========================================
123
+
124
+ export interface SessionConfig {
125
+ sessionTTL?: number;
126
+ autoRefresh?: boolean;
127
+ refreshThreshold?: number;
128
+ store?: SessionStore;
129
+ redis?: any;
130
+ redisOptions?: any;
131
+ database?: any;
132
+ databaseOptions?: any;
133
+ customHandler?: any;
134
+ }
135
+
136
+ export interface SessionStore {
137
+ get(key: string): Promise<any>;
138
+ set(key: string, value: any, ttl?: number): Promise<void>;
139
+ delete(key: string): Promise<void>;
140
+ clear(): Promise<void>;
141
+ exists(key: string): Promise<boolean>;
142
+ }
143
+
144
+ export interface SessionManager {
145
+ generateSessionKey(baseURL: string, username: string): string;
146
+ storeSession(baseURL: string, username: string, sessionData: any): Promise<string>;
147
+ getSession(baseURL: string, username: string): Promise<any>;
148
+ hasValidSession(baseURL: string, username: string): Promise<boolean>;
149
+ shouldRefreshSession(session: any): boolean;
150
+ deleteSession(baseURL: string, username: string): Promise<void>;
151
+ clearAllSessions(): Promise<void>;
152
+ getStats(): Promise<any>;
153
+ }
154
+
155
+ // ===========================================
156
+ // WEB MIDDLEWARE INTERFACES
157
+ // ===========================================
158
+
159
+ export interface ExpressMiddlewareConfig {
160
+ baseURL: string;
161
+ username: string;
162
+ password: string;
163
+ sessionManager?: SessionManager;
164
+ sessionKey?: string;
165
+ }
166
+
167
+ export interface NextJSConfig {
168
+ baseURL: string;
169
+ username: string;
170
+ password: string;
171
+ sessionManager?: SessionManager;
172
+ }
173
+
174
+ export interface ReactHookMethods {
175
+ generateCredentials(protocol: string, options?: CredentialOptions): Promise<any>;
176
+ addClientWithCredentials(inboundId: number, protocol: string, options?: CredentialOptions): Promise<any>;
177
+ getInbounds(): Promise<any[]>;
178
+ getClientTraffic(email: string): Promise<any>;
179
+ }
180
+
181
+ // ===========================================
182
+ // PROTOCOL BUILDER INTERFACES
183
+ // ===========================================
184
+
185
+ export interface BuilderConfig {
186
+ protocol: string;
187
+ settings: any;
188
+ streamSettings?: any;
189
+ remark?: string;
190
+ port?: number;
191
+ listen?: string;
192
+ enable?: boolean;
193
+ }
194
+
195
+ export interface TLSOptions {
196
+ serverName?: string;
197
+ certificates?: any[];
198
+ certFile?: string;
199
+ keyFile?: string;
200
+ }
201
+
202
+ export interface RealityOptions {
203
+ keys?: RealityKeys;
204
+ dest?: string;
205
+ serverNames?: string[];
206
+ shortIds?: string[];
207
+ }
208
+
209
+ export interface WebSocketOptions {
210
+ path?: string;
211
+ headers?: Record<string, string>;
212
+ }
213
+
214
+ export interface HTTP2Options {
215
+ path?: string;
216
+ host?: string[];
217
+ }
218
+
219
+ export interface GRPCOptions {
220
+ serviceName?: string;
221
+ }
222
+
223
+ // ===========================================
224
+ // MAIN CLASS
225
+ // ===========================================
226
+
227
+ export default class ThreeXUI {
228
+ constructor(baseURL: string, username: string, password: string, options?: ThreeXUIOptions);
229
+
230
+ // Authentication
231
+ login(forceRefresh?: boolean): Promise<LoginResponse>;
232
+ logout(): Promise<void>;
233
+
234
+ // Credential Generation Methods
235
+ generateCredentials(protocol: string, options?: CredentialOptions): VLESSCredentials | VMESSCredentials | TrojanCredentials | ShadowsocksCredentials | WireGuardCredentials | SocksCredentials;
236
+ generateUUID(secure?: boolean): string;
237
+ generatePassword(length?: number, options?: any): string;
238
+ generateBulkCredentials(protocol: string, count: number, options?: CredentialOptions): any[];
239
+ getShadowsocksCiphers(): string[];
240
+ getRecommendedShadowsocksCipher(): string;
241
+ generateWireGuardKeys(): WireGuardKeys;
242
+ generateRealityKeys(): RealityKeys;
243
+ generatePort(min?: number, max?: number): number;
244
+ validateCredentials(credentials: any, protocol: string): ValidationResult;
245
+
246
+ // Security helpers
247
+ getSecurityStats(): any;
248
+ clearBlockedIPs(): void;
249
+ validateCredentialStrength(credential: string, type: 'password' | 'uuid' | 'port'): { isValid: boolean; issues: string[]; strength: 'weak' | 'medium' | 'strong' };
250
+ generateSecureToken(): string;
251
+ setDevelopmentMode(enabled: boolean): void;
252
+
253
+ // Enhanced Client Management
254
+ addClientWithCredentials(inboundId: number, protocol: string, options?: CredentialOptions): Promise<any>;
255
+ updateClientWithCredentials(clientId: string, inboundId: number, options?: CredentialOptions): Promise<any>;
256
+
257
+ // Session Management
258
+ getSessionStats(): Promise<any>;
259
+ clearAllSessions(): Promise<void>;
260
+ isSessionValid(): Promise<boolean>;
261
+
262
+ // Original API Methods
263
+ getInbounds(): Promise<any>;
264
+ getInbound(id: number): Promise<any>;
265
+ addInbound(inboundConfig: InboundConfig): Promise<any>;
266
+ deleteInbound(id: number): Promise<any>;
267
+ updateInbound(id: number, inboundConfig: InboundConfig): Promise<any>;
268
+ addClient(clientConfig: ClientConfig): Promise<any>;
269
+ deleteClient(inboundId: number, clientId: string): Promise<any>;
270
+ updateClient(clientId: string, clientConfig: ClientConfig): Promise<any>;
271
+ getClientTrafficsByEmail(email: string): Promise<any>;
272
+ getClientTrafficsById(id: number): Promise<any>;
273
+ getClientIps(email: string): Promise<any>;
274
+ clearClientIps(email: string): Promise<any>;
275
+ resetClientTraffic(inboundId: number, email: string): Promise<any>;
276
+ resetAllTraffics(): Promise<any>;
277
+ resetAllClientTraffics(inboundId: number): Promise<any>;
278
+ deleteDepletedClients(inboundId: number): Promise<any>;
279
+ getOnlineClients(): Promise<any>;
280
+ createBackup(): Promise<any>;
281
+
282
+ // Static exports
283
+ static CredentialGenerator: typeof CredentialGenerator;
284
+ static SessionManager: typeof SessionManager;
285
+ static createSessionManager: (options?: SessionConfig) => SessionManager;
286
+ }
287
+
288
+ // ===========================================
289
+ // CREDENTIAL GENERATOR CLASS
290
+ // ===========================================
291
+
292
+ export class CredentialGenerator {
293
+ static generateUUID(): string;
294
+ static generateSecureUUID(): string;
295
+ static generatePassword(length?: number, options?: any): string;
296
+ static generateShadowsocks2022PSK(method?: string): string;
297
+ static generateWireGuardKeys(): WireGuardKeys;
298
+ static generateRealityKeys(): RealityKeys;
299
+ static generateUsername(prefix?: string): string;
300
+ static getRecommendedShadowsocksCipher(): string;
301
+ static getShadowsocksCipherMethods(): string[];
302
+ static generatePort(min?: number, max?: number): number;
303
+ static generateRealityShortId(): string;
304
+ static generateForProtocol(protocol: string, options?: CredentialOptions): any;
305
+ static generateBulk(protocol: string, count: number, options?: CredentialOptions): any[];
306
+ static validateCredentials(credentials: any, protocol: string): ValidationResult;
307
+ }
308
+
309
+ // ===========================================
310
+ // SESSION MANAGEMENT CLASSES
311
+ // ===========================================
312
+
313
+ export class SessionStore {
314
+ get(key: string): Promise<any>;
315
+ set(key: string, value: any, ttl?: number): Promise<void>;
316
+ delete(key: string): Promise<void>;
317
+ clear(): Promise<void>;
318
+ exists(key: string): Promise<boolean>;
319
+ }
320
+
321
+ export class MemorySessionStore extends SessionStore {
322
+ constructor();
323
+ getStats(): any;
324
+ }
325
+
326
+ export class RedisSessionStore extends SessionStore {
327
+ constructor(redisClient: any, options?: any);
328
+ }
329
+
330
+ export class DatabaseSessionStore extends SessionStore {
331
+ constructor(database: any, options?: any);
332
+ cleanupExpired(): Promise<number>;
333
+ static getCreateTableSQL(tableName?: string): string;
334
+ }
335
+
336
+ export class CustomSessionHandler {
337
+ constructor(handlers: any);
338
+ validate(key: string): Promise<boolean>;
339
+ }
340
+
341
+ export function createSessionManager(options?: SessionConfig): SessionManager;
342
+ export function createMemoryStore(): MemorySessionStore;
343
+ export function createRedisStore(redisClient: any, options?: any): RedisSessionStore;
344
+ export function createDatabaseStore(database: any, options?: any): DatabaseSessionStore;
345
+ export function createCustomHandler(handlers: any): CustomSessionHandler;
346
+
347
+ // ===========================================
348
+ // WEB MIDDLEWARE EXPORTS
349
+ // ===========================================
350
+
351
+ export function createExpressMiddleware(config: ExpressMiddlewareConfig): any;
352
+ export function withThreeXUI(config: NextJSConfig, handler: any): any;
353
+ export function createReactHook(apiEndpoint?: string): ReactHookMethods;
354
+ export function createNextjsRoutes(config: NextJSConfig): any;
355
+
356
+ export const SessionConfig: {
357
+ memory(): SessionConfig;
358
+ redis(redisClient: any, options?: any): SessionConfig;
359
+ database(database: any, options?: any): SessionConfig;
360
+ custom(handlers: any): SessionConfig;
361
+ };
362
+
363
+ // ===========================================
364
+ // PROTOCOL BUILDERS
365
+ // ===========================================
366
+
367
+ export class BaseBuilder {
368
+ constructor();
369
+ remark(remark: string): this;
370
+ port(port: number): this;
371
+ randomPort(min?: number, max?: number): this;
372
+ listen(listen?: string): this;
373
+ enable(enabled?: boolean): this;
374
+ build(): BuilderConfig;
375
+ }
376
+
377
+ export class VLESSBuilder extends BaseBuilder {
378
+ addClient(options?: CredentialOptions): this;
379
+ network(network: string): this;
380
+ tls(options?: TLSOptions): this;
381
+ reality(options?: RealityOptions): this;
382
+ websocket(options?: WebSocketOptions): this;
383
+ http2(options?: HTTP2Options): this;
384
+ grpc(options?: GRPCOptions): this;
385
+ flow(flow: string): this;
386
+ }
387
+
388
+ export class VMESSBuilder extends BaseBuilder {
389
+ addClient(options?: CredentialOptions): this;
390
+ network(network: string): this;
391
+ tls(options?: TLSOptions): this;
392
+ websocket(options?: WebSocketOptions): this;
393
+ }
394
+
395
+ export class TrojanBuilder extends BaseBuilder {
396
+ addClient(options?: CredentialOptions): this;
397
+ tls(options?: TLSOptions): this;
398
+ fallbacks(fallbacks: any[]): this;
399
+ }
400
+
401
+ export class ShadowsocksBuilder extends BaseBuilder {
402
+ method(method: string): this;
403
+ password(password?: string): this;
404
+ generatePassword(length?: number): this;
405
+ network(network: string): this;
406
+ }
407
+
408
+ export class WireGuardBuilder extends BaseBuilder {
409
+ serverKeys(keys?: WireGuardKeys): this;
410
+ address(addresses: string | string[]): this;
411
+ addPeer(options?: any): this;
412
+ mtu(mtu: number): this;
413
+ }
414
+
415
+ export class ProtocolBuilder {
416
+ static vless(): VLESSBuilder;
417
+ static vmess(): VMESSBuilder;
418
+ static trojan(): TrojanBuilder;
419
+ static shadowsocks(): ShadowsocksBuilder;
420
+ static wireguard(): WireGuardBuilder;
421
+ static templates: {
422
+ vlessReality(options?: any): BuilderConfig;
423
+ vmessWsTls(options?: any): BuilderConfig;
424
+ trojanTls(options?: any): BuilderConfig;
425
+ shadowsocks(options?: any): BuilderConfig;
426
+ };
427
+ }
428
+
429
+ // Optional: expose security helpers for advanced users
430
+ export const SecurityEnhancer: {
431
+ InputValidator: any;
432
+ SecureHeaders: any;
433
+ SecurityMonitor: any;
434
+ CredentialSecurity: any;
435
+ ErrorSecurity: any;
436
+ };
437
+ }