advanced-tls-client 1.0.1 → 3.0.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.
package/dist/index.d.ts CHANGED
@@ -1,18 +1,56 @@
1
- interface RequestOptions {
2
- method?: string;
3
- headers?: Record<string, string>;
4
- body?: string | Buffer;
5
- cookies?: Record<string, string>;
6
- decompress?: boolean;
7
- followRedirects?: boolean;
8
- maxRedirects?: number;
1
+ import { Readable, PassThrough } from 'stream';
2
+ interface TLSFingerprint {
3
+ cipherSuites: number[];
4
+ extensions: number[];
5
+ supportedGroups: number[];
6
+ signatureAlgorithms: number[];
7
+ supportedVersions: number[];
8
+ ecPointFormats: number[];
9
+ alpnProtocols: string[];
10
+ pskKeyExchangeModes: number[];
11
+ compressionMethods: number[];
12
+ grease: boolean;
13
+ recordSizeLimit?: number;
14
+ certificateCompression?: number[];
15
+ ocspStapling?: boolean;
16
+ signedCertificateTimestamp?: boolean;
17
+ delegatedCredentials?: boolean;
9
18
  }
10
- interface Response {
19
+ interface HTTP2Fingerprint {
20
+ windowUpdate: number;
21
+ headerTableSize: number;
22
+ maxConcurrentStreams?: number;
23
+ initialWindowSize: number;
24
+ maxFrameSize?: number;
25
+ maxHeaderListSize?: number;
26
+ enablePush: number;
27
+ settingsOrder: number[];
28
+ connectionPreface: Buffer;
29
+ priorityFrames: Array<{
30
+ streamId: number;
31
+ weight: number;
32
+ dependency: number;
33
+ exclusive: boolean;
34
+ }>;
35
+ pseudoHeaderOrder: string[];
36
+ headerPriority?: {
37
+ streamDep: number;
38
+ exclusive: boolean;
39
+ weight: number;
40
+ };
41
+ headerOrder: string[];
42
+ }
43
+ interface FullResponse {
11
44
  statusCode: number;
12
45
  headers: Record<string, string | string[]>;
13
46
  body: Buffer;
14
- text?: string;
47
+ text: string;
15
48
  json?: any;
49
+ fingerprints: {
50
+ ja3: string;
51
+ ja3Hash: string;
52
+ akamai: string;
53
+ };
16
54
  timing: {
17
55
  socket: number;
18
56
  lookup: number;
@@ -22,11 +60,75 @@ interface Response {
22
60
  end: number;
23
61
  total: number;
24
62
  };
25
- fingerprints: {
26
- ja3: string;
27
- ja3Hash: string;
28
- akamai: string;
29
- };
63
+ }
64
+ interface ChromeProfile {
65
+ name: string;
66
+ version: string;
67
+ tls: TLSFingerprint;
68
+ http2: HTTP2Fingerprint;
69
+ userAgent: string;
70
+ secChUa: string;
71
+ secChUaPlatform: string;
72
+ secChUaMobile: string;
73
+ secFetchSite: string;
74
+ secFetchMode: string;
75
+ secFetchDest: string;
76
+ upgradeInsecureRequests?: string;
77
+ acceptLanguage?: string;
78
+ priority?: string;
79
+ }
80
+ interface RequestOptions {
81
+ method?: string;
82
+ headers?: Record<string, string>;
83
+ body?: string | Buffer | Readable;
84
+ cookies?: Record<string, string>;
85
+ decompress?: boolean;
86
+ followRedirects?: boolean;
87
+ maxRedirects?: number;
88
+ timeout?: number;
89
+ stream?: boolean;
90
+ open_timeout?: number;
91
+ response_timeout?: number;
92
+ read_timeout?: number;
93
+ follow_max?: number;
94
+ proxy?: string;
95
+ username?: string;
96
+ password?: string;
97
+ auth?: 'basic' | 'digest' | 'auto';
98
+ agent?: any;
99
+ json?: boolean;
100
+ multipart?: boolean;
101
+ boundary?: string;
102
+ encoding?: string;
103
+ parse_response?: boolean | 'json' | 'xml';
104
+ compressed?: boolean;
105
+ decode_response?: boolean;
106
+ parse_cookies?: boolean;
107
+ follow_set_cookies?: boolean;
108
+ follow_set_referer?: boolean;
109
+ follow_keep_method?: boolean;
110
+ follow_if_same_host?: boolean;
111
+ follow_if_same_protocol?: boolean;
112
+ follow_if_same_location?: boolean;
113
+ use_proxy_from_env_var?: boolean;
114
+ output?: string;
115
+ localAddress?: string;
116
+ lookup?: Function;
117
+ signal?: AbortSignal;
118
+ connection?: string;
119
+ content_type?: string;
120
+ uri_modifier?: Function;
121
+ }
122
+ declare class ProfileRegistry {
123
+ private static getGrease;
124
+ static chromeMobile143Android(): ChromeProfile;
125
+ static chrome133PSK(): ChromeProfile;
126
+ static chrome133(): ChromeProfile;
127
+ static firefox117(): ChromeProfile;
128
+ static safariIOS18(): ChromeProfile;
129
+ static get(name: string): ChromeProfile;
130
+ static get latest(): ChromeProfile;
131
+ static get latestMobile(): ChromeProfile;
30
132
  }
31
133
  declare class AdvancedTLSClient {
32
134
  private profile;
@@ -35,18 +137,14 @@ declare class AdvancedTLSClient {
35
137
  private maxCachedSessions;
36
138
  private sessionTimeout;
37
139
  private cleanupInterval;
140
+ private defaults;
38
141
  constructor(profileName?: string);
39
- private startSessionCleanup;
40
- request(url: string, options?: RequestOptions): Promise<Response>;
41
- private performRequest;
142
+ setup(uri: string, options: RequestOptions): any;
143
+ request(uri: string, data?: any, options?: RequestOptions, callback?: Function): Promise<FullResponse | PassThrough>;
42
144
  private generateJA3;
43
- private buildHeaders;
44
- private isSessionAlive;
45
- getCookies(domain: string): string;
46
- setCookie(domain: string, name: string, value: string, options?: {
47
- expires?: Date;
48
- path?: string;
49
- }): void;
145
+ private buildMultipart;
146
+ private generateMultipart;
147
+ private flatten;
50
148
  destroy(): void;
51
149
  }
52
- export { AdvancedTLSClient };
150
+ export { AdvancedTLSClient, ProfileRegistry, FullResponse };