@ossiana/node-libcurl 1.9.10 → 1.10.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/dist/libcurl.d.ts CHANGED
@@ -7,6 +7,8 @@ declare enum LibCurlHttpVersionInfoEnum {
7
7
  http3_only = 3
8
8
  }
9
9
  export type LibCurlHttpVersionInfo = LibCurlHttpVersionInfoEnum | "http1.1" | "http2" | "http3" | "http3_only";
10
+ export declare const isLibCurlHttp3Version: (v?: LibCurlHttpVersionInfo) => boolean;
11
+ export declare const applyHttp3Fingerprint: (curl: LibCurl, httpVersion: LibCurlHttpVersionInfo | undefined, http3Fingerprint: LibCurlHttp3FingerPrintInfo | undefined) => void;
10
12
  export type LibCurlSetCookieOption = {
11
13
  domain: string;
12
14
  path?: string;
@@ -45,135 +47,8 @@ export type LibCurlCookieAttrObject = {
45
47
  export type LibCurlCookiesAttr = Map<string, LibCurlCookieAttrObject>;
46
48
  export type LibCurlRequestHeadersAttr = CaseInsensitiveMap;
47
49
  export type LibCurlInterfaceInfo = string;
48
- export type LibCurlJA3FingerPrintImpl = "chrome99" | "chrome101" | "chrome110" | "chrome124" | "chrome131" | "chrome133" | "chrome150" | "auto";
49
- export type LibCurlAkamaiFingerPrintImpl = "chrome99" | "chrome107" | "chrome119" | "auto";
50
- export type LibCurlJA3FingerPrintInfo = string | LibCurlJA3FingerPrintImpl;
51
- export type LibCurlAkamaiFingerPrintInfo = string | LibCurlAkamaiFingerPrintImpl;
52
- export type LibCurlHttp3FingerPrintImpl = "chrome126" | "chrome150" | "auto";
53
- type LibCurlHttp3FingerPrintConfig = {
54
- scid: string;
55
- settings: string;
56
- transport_params: string;
57
- tls: string;
58
- permutation: string;
59
- verify_sigalgs: string;
60
- };
61
- export type LibCurlHttp3FingerPrintInfo = LibCurlHttp3FingerPrintConfig | LibCurlHttp3FingerPrintImpl;
62
- export declare enum LibCurlJA3TlsVersion {
63
- TLSv1_2 = 771,
64
- TLSv1_3 = 772
65
- }
66
- export declare enum LibCurlJA3Cipher {
67
- "NULL-SHA" = 2,
68
- "DES-CBC3-SHA" = 10,
69
- "AES128-SHA" = 47,
70
- "AES256-SHA" = 53,
71
- "DHE-RSA-AES128-SHA" = 51,
72
- "DHE-RSA-AES256-SHA" = 57,
73
- "AES128-SHA256" = 60,
74
- "AES256-SHA256" = 61,
75
- "DHE-RSA-AES128-SHA256" = 103,
76
- "DHE-RSA-AES256-SHA256" = 107,
77
- "PSK-AES128-CBC-SHA" = 140,
78
- "PSK-AES256-CBC-SHA" = 141,
79
- "AES128-GCM-SHA256" = 156,
80
- "AES256-GCM-SHA384" = 157,
81
- "DHE-RSA-AES128-GCM-SHA256" = 158,
82
- "DHE-RSA-AES256-GCM-SHA384" = 159,
83
- "TLS_AES_128_GCM_SHA256" = 4865,
84
- "TLS_AES_256_GCM_SHA384" = 4866,
85
- "TLS_CHACHA20_POLY1305_SHA256" = 4867,
86
- "ECDHE-ECDSA-DES-CBC3-SHA" = 49160,
87
- "ECDHE-ECDSA-AES128-SHA" = 49161,
88
- "ECDHE-ECDSA-AES256-SHA" = 49162,
89
- "ECDHE-RSA-DES-CBC3-SHA" = 49170,
90
- "ECDHE-RSA-AES128-SHA" = 49171,
91
- "ECDHE-RSA-AES256-SHA" = 49172,
92
- "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" = 49187,
93
- "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" = 49188,
94
- "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" = 49191,
95
- "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" = 49192,
96
- "ECDHE-ECDSA-AES128-GCM-SHA256" = 49195,
97
- "ECDHE-ECDSA-AES256-GCM-SHA384" = 49196,
98
- "ECDHE-RSA-AES128-GCM-SHA256" = 49199,
99
- "ECDHE-RSA-AES256-GCM-SHA384" = 49200,
100
- "ECDHE-PSK-AES128-CBC-SHA" = 49205,
101
- "ECDHE-PSK-AES256-CBC-SHA" = 49206,
102
- "ECDHE-RSA-CHACHA20-POLY1305" = 52392,
103
- "ECDHE-ECDSA-CHACHA20-POLY1305" = 52393,
104
- "ECDHE-PSK-CHACHA20-POLY1305" = 52396
105
- }
106
- export declare enum LibCurlJA3Extension {
107
- TLSEXT_TYPE_server_name = 0,
108
- TLSEXT_TYPE_status_request = 5,
109
- TLSEXT_TYPE_ec_point_formats = 11,
110
- TLSEXT_TYPE_signature_algorithms = 13,
111
- TLSEXT_TYPE_srtp = 14,
112
- TLSEXT_TYPE_application_layer_protocol_negotiation = 16,
113
- TLSEXT_TYPE_padding = 21,
114
- TLSEXT_TYPE_extended_master_secret = 23,
115
- TLSEXT_TYPE_quic_transport_parameters_legacy = 65445,
116
- TLSEXT_TYPE_quic_transport_parameters = 57,
117
- TLSEXT_TYPE_cert_compression = 27,
118
- TLSEXT_TYPE_session_ticket = 35,
119
- TLSEXT_TYPE_supported_groups = 10,
120
- TLSEXT_TYPE_pre_shared_key = 41,
121
- TLSEXT_TYPE_early_data = 42,
122
- TLSEXT_TYPE_supported_versions = 43,
123
- TLSEXT_TYPE_cookie = 44,
124
- TLSEXT_TYPE_psk_key_exchange_modes = 45,
125
- TLSEXT_TYPE_certificate_authorities = 47,
126
- TLSEXT_TYPE_signature_algorithms_cert = 50,
127
- TLSEXT_TYPE_key_share = 51,
128
- TLSEXT_TYPE_renegotiate = 65281,
129
- TLSEXT_TYPE_delegated_credential = 34,
130
- TLSEXT_TYPE_application_settings_old = 17513,
131
- TLSEXT_TYPE_application_settings = 17613,
132
- TLSEXT_TYPE_encrypted_client_hello = 65037,
133
- TLSEXT_TYPE_ech_outer_extensions = 64768,
134
- TLSEXT_TYPE_certificate_timestamp = 18,
135
- TLSEXT_TYPE_next_proto_neg = 13172,
136
- TLSEXT_TYPE_channel_id = 30032,
137
- TLSEXT_TYPE_record_size_limit = 28,
138
- TLSEXT_TYPE_delegated_credentials = 34,
139
- TLSEXT_TYPE_pake = 35387,
140
- TLSEXT_TYPE_trust_anchors = 51764
141
- }
142
- export declare enum LibCurlTLSVerifySigalgs {
143
- "rsa_pkcs1_sha1" = 513,
144
- "rsa_pkcs1_sha256" = 1025,
145
- "rsa_pkcs1_sha384" = 1281,
146
- "rsa_pkcs1_sha512" = 1537,
147
- "ecdsa_sha1" = 515,
148
- "ecdsa_secp256r1_sha256" = 1027,
149
- "ecdsa_secp384r1_sha384" = 1283,
150
- "ecdsa_secp521r1_sha512" = 1539,
151
- "rsa_pss_rsae_sha256" = 2052,
152
- "rsa_pss_rsae_sha384" = 2053,
153
- "rsa_pss_rsae_sha512" = 2054,
154
- "ed25519" = 2055,
155
- "ml_dsa_44" = 2308,
156
- "ml_dsa_65" = 2309,
157
- "ml_dsa_87" = 2310,
158
- "rsa_pkcs1_sha256_legacy" = 1056,
159
- "rsa_pkcs1_md5_sha1" = 65281
160
- }
161
- export type LibCurlTLSVerifySigalgsInfo = string | Array<LibCurlTLSVerifySigalgs | number | keyof typeof LibCurlTLSVerifySigalgs>;
162
- export declare enum LibCurlJA3SupportGroup {
163
- "P-256" = 23,
164
- "P-384" = 24,
165
- "P-521" = 25,
166
- X25519 = 29,
167
- ffdhe2048 = 256,
168
- ffdhe3072 = 257,
169
- X25519Kyber768Draft00 = 25497,
170
- X25519MLKEM768 = 4588
171
- }
172
- export declare enum LibCurlJA3EcPointFormat {
173
- uncompressed = 0,
174
- compressed_fixed = 1,
175
- compressed_variable = 2
176
- }
50
+ import { LibCurlTLSVerifySigalgsInfo, LibCurlJA3FingerPrintInfo, LibCurlAkamaiFingerPrintInfo, LibCurlHttp3FingerPrintInfo } from "./fingerprints";
51
+ export { LibCurlJA3FingerPrintImpl, LibCurlAkamaiFingerPrintImpl, LibCurlHttp3FingerPrintImpl, LibCurlJA3FingerPrintInfo, LibCurlAkamaiFingerPrintInfo, LibCurlHttp3FingerPrintInfo, LibCurlJA3TlsVersion, LibCurlJA3Cipher, LibCurlJA3Extension, LibCurlTLSVerifySigalgs, LibCurlTLSVerifySigalgsInfo, LibCurlJA3SupportGroup, LibCurlJA3EcPointFormat, } from "./fingerprints";
177
52
  interface LibCurlCommonHeaders {
178
53
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" | "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0";
179
54
  "Content-Type": "application/x-www-form-urlencoded" | "application/json" | "application/octet-stream" | "application/protobuf" | "text/plain";
@@ -204,6 +79,49 @@ export declare class LibCurlError extends Error {
204
79
  export type LibCurlAutoSortRequestHeadersOption = "auto" | boolean | "chrome130" | "chrome131";
205
80
  export type LibCurlRequestHeadersOrder = Array<string>;
206
81
  export type LibCurlRequestType = "fetch" | "XMLHttpRequest";
82
+ export interface BaoLibCurlImpl {
83
+ open(method: string, url: string): void;
84
+ setRequestHeader(key: string, value: string): void;
85
+ setProxy(proxy: string): void;
86
+ setProxy(proxy: string, username: string, password: string): void;
87
+ setConnectTo(connectTo: string): void;
88
+ setTimeout(connectTime: number, sendTime: number): void;
89
+ setCookie(name: string, value: string, domain: string, path: string): void;
90
+ deleteCookie(name: string, domain: string, path: string): void;
91
+ getCookies(): string;
92
+ getCookie(name: string, domain: string, path: string): string;
93
+ getResponseHeaders(): string;
94
+ getResponseStatus(): number;
95
+ getResponseContentLength(): number;
96
+ getResponseEncodedBodySize(): number;
97
+ setSSLVerify(caPath: string): void;
98
+ setTLSVerifySigalgs(sigalgs: string): void;
99
+ setRedirect(enable: boolean): void;
100
+ setVerbose(enable: boolean): void;
101
+ setHttpVersion(version: number): void;
102
+ setInterface(network: string): void;
103
+ setJA3Fingerprint(tlsVersion: number, cipher: string, tls13Cipher: string, extensions: string, supportGroups: string, ecPointFormats: number, trustAnchors: string): void;
104
+ setAkamaiFingerprint(settings: string, windowUpdate: number, streams: string, pseudoHeadersOrder: string): void;
105
+ setHttp3Fingerprint(scid: string, settings: string, transportParams: string, tls: string, permutation: string, verifySigalgs: string, trustAnchors: string): void;
106
+ setHttp2NextStreamId(streamId: number): void;
107
+ setHttp2StreamWeight(weight: number): void;
108
+ setSSLCert(certBlob: Uint8Array, privateKeyBlob: Uint8Array | null, type: string, password: string): void;
109
+ sendAsync(body?: string | Uint8Array): Promise<undefined>;
110
+ getResponseBody(): Uint8Array;
111
+ getResponseString(): string;
112
+ getLastEffectiveUrl(): string;
113
+ getLastCode(): number;
114
+ getLastCodeError(): string;
115
+ }
116
+ export interface LibCurlWebSocketImpl {
117
+ open(url: string): void;
118
+ send(data: Uint8Array | string): void;
119
+ close(): void;
120
+ setOnOpen(callback: () => void): void;
121
+ setOnClose(callback: () => void): void;
122
+ setOnError(callback: (message: string) => void): void;
123
+ setOnMessage(callback: (data: Uint8Array) => void): void;
124
+ }
207
125
  export declare class LibCurl {
208
126
  private m_libCurl_impl_;
209
127
  private m_method_;
@@ -215,8 +133,11 @@ export declare class LibCurl {
215
133
  private m_nextRequestType;
216
134
  private m_chromeVersion;
217
135
  private m_hasCustomTLSVerifySigalgs;
136
+ private m_lastJA3FingerprintArgs;
137
+ private m_lastHttp3FingerprintArgs;
218
138
  private formatTLSVerifySigalgs;
219
139
  constructor();
140
+ get impl(): BaoLibCurlImpl;
220
141
  private checkSending;
221
142
  private checkError;
222
143
  setAutoSortRequestHeaders(option: LibCurlAutoSortRequestHeadersOption): void;
@@ -258,4 +179,3 @@ export declare class LibCurl {
258
179
  getResponseString(): string;
259
180
  getLastEffectiveUrl(): string;
260
181
  }
261
- export {};