nlcurl 0.1.0 → 0.2.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.
Files changed (197) hide show
  1. package/README.md +5 -13
  2. package/dist/cli/args.d.ts +37 -5
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +6 -17
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/cli/index.d.ts +3 -3
  7. package/dist/cli/index.js +25 -10
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/cli/output.d.ts +24 -7
  10. package/dist/cli/output.d.ts.map +1 -1
  11. package/dist/cli/output.js +24 -12
  12. package/dist/cli/output.js.map +1 -1
  13. package/dist/cookies/jar.d.ts +45 -13
  14. package/dist/cookies/jar.d.ts.map +1 -1
  15. package/dist/cookies/jar.js +88 -29
  16. package/dist/cookies/jar.js.map +1 -1
  17. package/dist/cookies/parser.d.ts +25 -3
  18. package/dist/cookies/parser.d.ts.map +1 -1
  19. package/dist/cookies/parser.js +12 -7
  20. package/dist/cookies/parser.js.map +1 -1
  21. package/dist/core/client.d.ts +49 -33
  22. package/dist/core/client.d.ts.map +1 -1
  23. package/dist/core/client.js +64 -38
  24. package/dist/core/client.js.map +1 -1
  25. package/dist/core/errors.d.ts +94 -6
  26. package/dist/core/errors.d.ts.map +1 -1
  27. package/dist/core/errors.js +95 -6
  28. package/dist/core/errors.js.map +1 -1
  29. package/dist/core/request.d.ts +96 -30
  30. package/dist/core/request.d.ts.map +1 -1
  31. package/dist/core/request.js +0 -3
  32. package/dist/core/request.js.map +1 -1
  33. package/dist/core/response.d.ts +92 -8
  34. package/dist/core/response.d.ts.map +1 -1
  35. package/dist/core/response.js +92 -7
  36. package/dist/core/response.js.map +1 -1
  37. package/dist/core/session.d.ts +109 -14
  38. package/dist/core/session.d.ts.map +1 -1
  39. package/dist/core/session.js +124 -46
  40. package/dist/core/session.js.map +1 -1
  41. package/dist/fingerprints/akamai.d.ts +11 -11
  42. package/dist/fingerprints/akamai.d.ts.map +1 -1
  43. package/dist/fingerprints/akamai.js +10 -14
  44. package/dist/fingerprints/akamai.js.map +1 -1
  45. package/dist/fingerprints/database.d.ts +14 -15
  46. package/dist/fingerprints/database.d.ts.map +1 -1
  47. package/dist/fingerprints/database.js +14 -19
  48. package/dist/fingerprints/database.js.map +1 -1
  49. package/dist/fingerprints/extensions.d.ts +121 -27
  50. package/dist/fingerprints/extensions.d.ts.map +1 -1
  51. package/dist/fingerprints/extensions.js +132 -49
  52. package/dist/fingerprints/extensions.js.map +1 -1
  53. package/dist/fingerprints/ja3.d.ts +34 -18
  54. package/dist/fingerprints/ja3.d.ts.map +1 -1
  55. package/dist/fingerprints/ja3.js +34 -18
  56. package/dist/fingerprints/ja3.js.map +1 -1
  57. package/dist/fingerprints/profiles/chrome.d.ts +21 -10
  58. package/dist/fingerprints/profiles/chrome.d.ts.map +1 -1
  59. package/dist/fingerprints/profiles/chrome.js +25 -22
  60. package/dist/fingerprints/profiles/chrome.js.map +1 -1
  61. package/dist/fingerprints/profiles/edge.d.ts +10 -7
  62. package/dist/fingerprints/profiles/edge.d.ts.map +1 -1
  63. package/dist/fingerprints/profiles/edge.js +10 -10
  64. package/dist/fingerprints/profiles/edge.js.map +1 -1
  65. package/dist/fingerprints/profiles/firefox.d.ts +11 -3
  66. package/dist/fingerprints/profiles/firefox.d.ts.map +1 -1
  67. package/dist/fingerprints/profiles/firefox.js +15 -14
  68. package/dist/fingerprints/profiles/firefox.js.map +1 -1
  69. package/dist/fingerprints/profiles/safari.d.ts +14 -3
  70. package/dist/fingerprints/profiles/safari.d.ts.map +1 -1
  71. package/dist/fingerprints/profiles/safari.js +16 -13
  72. package/dist/fingerprints/profiles/safari.js.map +1 -1
  73. package/dist/fingerprints/profiles/tor.d.ts +8 -7
  74. package/dist/fingerprints/profiles/tor.d.ts.map +1 -1
  75. package/dist/fingerprints/profiles/tor.js +8 -14
  76. package/dist/fingerprints/profiles/tor.js.map +1 -1
  77. package/dist/fingerprints/types.d.ts +70 -47
  78. package/dist/fingerprints/types.d.ts.map +1 -1
  79. package/dist/fingerprints/types.js +0 -7
  80. package/dist/fingerprints/types.js.map +1 -1
  81. package/dist/http/h1/client.d.ts +30 -9
  82. package/dist/http/h1/client.d.ts.map +1 -1
  83. package/dist/http/h1/client.js +152 -15
  84. package/dist/http/h1/client.js.map +1 -1
  85. package/dist/http/h1/encoder.d.ts +9 -6
  86. package/dist/http/h1/encoder.d.ts.map +1 -1
  87. package/dist/http/h1/encoder.js +8 -12
  88. package/dist/http/h1/encoder.js.map +1 -1
  89. package/dist/http/h1/parser.d.ts +68 -14
  90. package/dist/http/h1/parser.d.ts.map +1 -1
  91. package/dist/http/h1/parser.js +92 -37
  92. package/dist/http/h1/parser.js.map +1 -1
  93. package/dist/http/h2/client.d.ts +81 -14
  94. package/dist/http/h2/client.d.ts.map +1 -1
  95. package/dist/http/h2/client.js +465 -63
  96. package/dist/http/h2/client.js.map +1 -1
  97. package/dist/http/h2/frames.d.ts +103 -6
  98. package/dist/http/h2/frames.d.ts.map +1 -1
  99. package/dist/http/h2/frames.js +96 -17
  100. package/dist/http/h2/frames.js.map +1 -1
  101. package/dist/http/h2/hpack.d.ts +30 -5
  102. package/dist/http/h2/hpack.d.ts.map +1 -1
  103. package/dist/http/h2/hpack.js +39 -35
  104. package/dist/http/h2/hpack.js.map +1 -1
  105. package/dist/http/negotiator.d.ts +35 -12
  106. package/dist/http/negotiator.d.ts.map +1 -1
  107. package/dist/http/negotiator.js +89 -24
  108. package/dist/http/negotiator.js.map +1 -1
  109. package/dist/http/pool.d.ts +66 -17
  110. package/dist/http/pool.d.ts.map +1 -1
  111. package/dist/http/pool.js +47 -20
  112. package/dist/http/pool.js.map +1 -1
  113. package/dist/index.d.ts +2 -3
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +0 -13
  116. package/dist/index.js.map +1 -1
  117. package/dist/middleware/interceptor.d.ts +40 -8
  118. package/dist/middleware/interceptor.d.ts.map +1 -1
  119. package/dist/middleware/interceptor.js +28 -6
  120. package/dist/middleware/interceptor.js.map +1 -1
  121. package/dist/middleware/rate-limiter.d.ts +18 -5
  122. package/dist/middleware/rate-limiter.d.ts.map +1 -1
  123. package/dist/middleware/rate-limiter.js +12 -7
  124. package/dist/middleware/rate-limiter.js.map +1 -1
  125. package/dist/middleware/retry.d.ts +17 -5
  126. package/dist/middleware/retry.d.ts.map +1 -1
  127. package/dist/middleware/retry.js +13 -11
  128. package/dist/middleware/retry.js.map +1 -1
  129. package/dist/proxy/http-proxy.d.ts +17 -9
  130. package/dist/proxy/http-proxy.d.ts.map +1 -1
  131. package/dist/proxy/http-proxy.js +9 -13
  132. package/dist/proxy/http-proxy.js.map +1 -1
  133. package/dist/proxy/socks.d.ts +20 -9
  134. package/dist/proxy/socks.d.ts.map +1 -1
  135. package/dist/proxy/socks.js +20 -31
  136. package/dist/proxy/socks.js.map +1 -1
  137. package/dist/tls/constants.d.ts +74 -4
  138. package/dist/tls/constants.d.ts.map +1 -1
  139. package/dist/tls/constants.js +75 -21
  140. package/dist/tls/constants.js.map +1 -1
  141. package/dist/tls/node-engine.d.ts +17 -16
  142. package/dist/tls/node-engine.d.ts.map +1 -1
  143. package/dist/tls/node-engine.js +20 -27
  144. package/dist/tls/node-engine.js.map +1 -1
  145. package/dist/tls/stealth/client-hello.d.ts +32 -16
  146. package/dist/tls/stealth/client-hello.d.ts.map +1 -1
  147. package/dist/tls/stealth/client-hello.js +13 -37
  148. package/dist/tls/stealth/client-hello.js.map +1 -1
  149. package/dist/tls/stealth/engine.d.ts +18 -10
  150. package/dist/tls/stealth/engine.d.ts.map +1 -1
  151. package/dist/tls/stealth/engine.js +18 -24
  152. package/dist/tls/stealth/engine.js.map +1 -1
  153. package/dist/tls/stealth/handshake.d.ts +31 -17
  154. package/dist/tls/stealth/handshake.d.ts.map +1 -1
  155. package/dist/tls/stealth/handshake.js +173 -74
  156. package/dist/tls/stealth/handshake.js.map +1 -1
  157. package/dist/tls/stealth/key-schedule.d.ts +89 -32
  158. package/dist/tls/stealth/key-schedule.d.ts.map +1 -1
  159. package/dist/tls/stealth/key-schedule.js +62 -42
  160. package/dist/tls/stealth/key-schedule.js.map +1 -1
  161. package/dist/tls/stealth/record-layer.d.ts +76 -25
  162. package/dist/tls/stealth/record-layer.d.ts.map +1 -1
  163. package/dist/tls/stealth/record-layer.js +66 -36
  164. package/dist/tls/stealth/record-layer.js.map +1 -1
  165. package/dist/tls/types.d.ts +33 -25
  166. package/dist/tls/types.d.ts.map +1 -1
  167. package/dist/tls/types.js +0 -4
  168. package/dist/tls/types.js.map +1 -1
  169. package/dist/utils/buffer-reader.d.ts +99 -7
  170. package/dist/utils/buffer-reader.d.ts.map +1 -1
  171. package/dist/utils/buffer-reader.js +99 -7
  172. package/dist/utils/buffer-reader.js.map +1 -1
  173. package/dist/utils/buffer-writer.d.ts +99 -10
  174. package/dist/utils/buffer-writer.d.ts.map +1 -1
  175. package/dist/utils/buffer-writer.js +101 -12
  176. package/dist/utils/buffer-writer.js.map +1 -1
  177. package/dist/utils/encoding.d.ts +33 -8
  178. package/dist/utils/encoding.d.ts.map +1 -1
  179. package/dist/utils/encoding.js +58 -13
  180. package/dist/utils/encoding.js.map +1 -1
  181. package/dist/utils/logger.d.ts +61 -2
  182. package/dist/utils/logger.d.ts.map +1 -1
  183. package/dist/utils/logger.js +52 -4
  184. package/dist/utils/logger.js.map +1 -1
  185. package/dist/utils/url.d.ts +47 -7
  186. package/dist/utils/url.d.ts.map +1 -1
  187. package/dist/utils/url.js +47 -7
  188. package/dist/utils/url.js.map +1 -1
  189. package/dist/ws/client.d.ts +59 -15
  190. package/dist/ws/client.d.ts.map +1 -1
  191. package/dist/ws/client.js +34 -27
  192. package/dist/ws/client.js.map +1 -1
  193. package/dist/ws/frame.d.ts +43 -9
  194. package/dist/ws/frame.d.ts.map +1 -1
  195. package/dist/ws/frame.js +35 -19
  196. package/dist/ws/frame.js.map +1 -1
  197. package/package.json +2 -2
@@ -1,55 +1,91 @@
1
1
  /**
2
- * TLS 1.3 key schedule.
2
+ * Hash algorithm identifiers supported by the TLS 1.3 key schedule.
3
3
  *
4
- * Implements the HKDF-based key derivation defined in RFC 8446 section 7.
5
- * Uses only `node:crypto` -- zero external dependencies.
4
+ * @typedef {'sha256'|'sha384'} HashAlgorithm
6
5
  */
7
6
  export type HashAlgorithm = 'sha256' | 'sha384';
8
- /** Hash output length in bytes. */
7
+ /**
8
+ * Returns the output length in bytes for the given hash algorithm.
9
+ *
10
+ * @param {HashAlgorithm} alg - Hash algorithm identifier.
11
+ * @returns {number} Output length: `32` for `sha256`, `48` for `sha384`.
12
+ */
9
13
  export declare function hashLength(alg: HashAlgorithm): number;
10
14
  /**
11
- * HKDF-Extract (RFC 5869 section 2.2).
15
+ * Performs the HKDF-Extract step (RFC 5869 §2.2): computes `HMAC-Hash(salt, IKM)`.
12
16
  *
13
- * Returns a pseudo-random key of `hashLength(alg)` bytes.
17
+ * @param {HashAlgorithm} alg - Hash algorithm for the HMAC computation.
18
+ * @param {Buffer} salt - Salt value (used as HMAC key).
19
+ * @param {Buffer} ikm - Input keying material.
20
+ * @returns {Buffer} Pseudorandom key (PRK) of length `hashLength(alg)`.
14
21
  */
15
22
  export declare function hkdfExtract(alg: HashAlgorithm, salt: Buffer, ikm: Buffer): Buffer;
16
23
  /**
17
- * HKDF-Expand-Label (RFC 8446 section 7.1).
18
- *
19
- * HKDF-Expand-Label(Secret, Label, Context, Length) =
20
- * HKDF-Expand(Secret, HkdfLabel, Length)
24
+ * Performs the TLS 1.3 HKDF-Expand-Label operation (RFC 8446 §7.1),
25
+ * deriving a key of `length` bytes from `secret` using the given label
26
+ * and context hash.
21
27
  *
22
- * struct {
23
- * uint16 length = Length;
24
- * opaque label<7..255> = "tls13 " + Label;
25
- * opaque context<0..255> = Context;
26
- * } HkdfLabel;
28
+ * @param {HashAlgorithm} alg - Hash algorithm for HKDF.
29
+ * @param {Buffer} secret - Input secret (PRK from HKDF-Extract).
30
+ * @param {string} label - TLS 1.3 label string (without the `"tls13 "` prefix).
31
+ * @param {Buffer} context - Transcript hash, or empty buffer for simple derivations.
32
+ * @param {number} length - Desired output length in bytes.
33
+ * @returns {Buffer} Derived key material of the specified length.
27
34
  */
28
35
  export declare function hkdfExpandLabel(alg: HashAlgorithm, secret: Buffer, label: string, context: Buffer, length: number): Buffer;
29
36
  /**
30
- * Derive-Secret (RFC 8446 section 7.1).
37
+ * Derives a secret with a transcript hash context using HKDF-Expand-Label
38
+ * (RFC 8446 §7.1). This is the canonical `Derive-Secret` function of the
39
+ * TLS 1.3 key schedule.
31
40
  *
32
- * Derive-Secret(Secret, Label, Messages) =
33
- * HKDF-Expand-Label(Secret, Label, Transcript-Hash(Messages), Hash.length)
41
+ * @param {HashAlgorithm} alg - Hash algorithm for HKDF.
42
+ * @param {Buffer} secret - Input PRK.
43
+ * @param {string} label - TLS 1.3 label string.
44
+ * @param {Buffer} transcriptHash - Current transcript hash value.
45
+ * @returns {Buffer} Derived secret of length `hashLength(alg)`.
34
46
  */
35
47
  export declare function deriveSecret(alg: HashAlgorithm, secret: Buffer, label: string, transcriptHash: Buffer): Buffer;
36
- /**
37
- * Compute transcript hash incrementally.
38
- */
39
48
  export { createHash } from 'node:crypto';
40
49
  /**
41
- * Zero-length secret for the initial extract stage.
50
+ * Returns a zero-filled `Buffer` whose length equals the output size of
51
+ * `alg` — used as the IKM or salt argument in HKDF-Extract calls that
52
+ * require a zero-length secret at the start of the TLS 1.3 key schedule.
53
+ *
54
+ * @param {HashAlgorithm} alg - Hash algorithm that determines buffer length.
55
+ * @returns {Buffer} Zero-filled buffer of `hashLength(alg)` bytes.
42
56
  */
43
57
  export declare function zeroKey(alg: HashAlgorithm): Buffer;
58
+ /**
59
+ * Key material derived during the handshake phase of TLS 1.3 key schedule,
60
+ * used to decrypt EncryptedExtensions, Certificate, CertificateVerify, and
61
+ * Finished messages from the server.
62
+ *
63
+ * @typedef {Object} HandshakeKeys
64
+ * @property {Buffer} clientHandshakeKey - Client handshake traffic key.
65
+ * @property {Buffer} clientHandshakeIV - Client handshake traffic IV.
66
+ * @property {Buffer} serverHandshakeKey - Server handshake traffic key.
67
+ * @property {Buffer} serverHandshakeIV - Server handshake traffic IV.
68
+ * @property {Buffer} handshakeSecret - TLS 1.3 handshake secret (intermediate key schedule value).
69
+ * @property {Buffer} masterSecret - TLS 1.3 master secret used to derive application keys.
70
+ */
44
71
  export interface HandshakeKeys {
45
72
  clientHandshakeKey: Buffer;
46
73
  clientHandshakeIV: Buffer;
47
74
  serverHandshakeKey: Buffer;
48
75
  serverHandshakeIV: Buffer;
49
76
  handshakeSecret: Buffer;
50
- /** Master secret (used to derive application keys after Finished). */
51
77
  masterSecret: Buffer;
52
78
  }
79
+ /**
80
+ * Application traffic key material derived after handshake completion,
81
+ * used to encrypt and decrypt application data records.
82
+ *
83
+ * @typedef {Object} ApplicationKeys
84
+ * @property {Buffer} clientKey - Client application traffic key.
85
+ * @property {Buffer} clientIV - Client application traffic IV.
86
+ * @property {Buffer} serverKey - Server application traffic key.
87
+ * @property {Buffer} serverIV - Server application traffic IV.
88
+ */
53
89
  export interface ApplicationKeys {
54
90
  clientKey: Buffer;
55
91
  clientIV: Buffer;
@@ -57,29 +93,50 @@ export interface ApplicationKeys {
57
93
  serverIV: Buffer;
58
94
  }
59
95
  /**
60
- * Key and IV length for a cipher suite.
96
+ * Returns the key and IV byte lengths for the given AEAD cipher name.
97
+ *
98
+ * @param {string} cipherName - AEAD cipher name (e.g. `"TLS_AES_128_GCM_SHA256"`).
99
+ * @returns {{ keyLen: number; ivLen: number }} Key length and IV length in bytes.
61
100
  */
62
101
  export declare function keyIVLengths(cipherName: string): {
63
102
  keyLen: number;
64
103
  ivLen: number;
65
104
  };
66
105
  /**
67
- * Derive handshake traffic keys from the shared secret and transcript hash.
106
+ * Derives TLS 1.3 handshake traffic keys from the ECDH shared secret and
107
+ * the transcript hash of the ClientHello and ServerHello messages
108
+ * (RFC 8446 §7.1).
68
109
  *
69
- * This implements the Early Secret -> Handshake Secret portion of the
70
- * RFC 8446 key schedule.
110
+ * @param {HashAlgorithm} alg - Hash algorithm specified by the negotiated cipher suite.
111
+ * @param {Buffer} sharedSecret - ECDH shared secret from key exchange.
112
+ * @param {Buffer} helloHash - Transcript hash over ClientHello..ServerHello.
113
+ * @param {number} keyLen - Required key byte length.
114
+ * @param {number} ivLen - Required IV byte length.
115
+ * @returns {HandshakeKeys} Derived handshake keys and intermediate secrets.
71
116
  */
72
117
  export declare function deriveHandshakeKeys(alg: HashAlgorithm, sharedSecret: Buffer, helloHash: Buffer, keyLen: number, ivLen: number): HandshakeKeys;
73
118
  /**
74
- * Derive application traffic keys from the master secret and the
75
- * full handshake transcript hash.
119
+ * Derives TLS 1.3 application traffic keys from the master secret and the
120
+ * full handshake transcript hash (RFC 8446 §7.1). These keys are used to
121
+ * encrypt and decrypt all application data after the handshake completes.
122
+ *
123
+ * @param {HashAlgorithm} alg - Hash algorithm specified by the negotiated cipher suite.
124
+ * @param {Buffer} masterSecret - TLS 1.3 master secret from {@link deriveHandshakeKeys}.
125
+ * @param {Buffer} handshakeHash - Transcript hash over the complete handshake.
126
+ * @param {number} keyLen - Required key byte length.
127
+ * @param {number} ivLen - Required IV byte length.
128
+ * @returns {ApplicationKeys} Derived application traffic keys.
76
129
  */
77
130
  export declare function deriveApplicationKeys(alg: HashAlgorithm, masterSecret: Buffer, handshakeHash: Buffer, keyLen: number, ivLen: number): ApplicationKeys;
78
131
  /**
79
- * Build the Finished verify_data.
132
+ * Computes the `verify_data` for a TLS 1.3 Finished message (RFC 8446 §4.4.4)
133
+ * as `HMAC(finished_key, transcript_hash)`, where `finished_key` is derived
134
+ * from the base traffic secret using HKDF-Expand-Label.
80
135
  *
81
- * finished_key = HKDF-Expand-Label(BaseKey, "finished", "", Hash.length)
82
- * verify_data = HMAC(finished_key, Transcript-Hash(Handshake Context))
136
+ * @param {HashAlgorithm} alg - Hash algorithm for HMAC.
137
+ * @param {Buffer} baseSecret - Base traffic secret (client or server handshake secret).
138
+ * @param {Buffer} transcriptHash - Current transcript hash at the point of Finished.
139
+ * @returns {Buffer} The `verify_data` bytes to include in or validate against the Finished message.
83
140
  */
84
141
  export declare function computeFinishedVerifyData(alg: HashAlgorithm, baseSecret: Buffer, transcriptHash: Buffer): Buffer;
85
142
  //# sourceMappingURL=key-schedule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"key-schedule.d.ts","sourceRoot":"","sources":["../../../src/tls/stealth/key-schedule.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEhD,mCAAmC;AACnC,wBAAgB,UAAU,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAErD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,MAAM,CAER;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,MAAM,CAeR;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,GACrB,MAAM,CAER;AAED;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAElD;AAID,MAAM,WAAW,aAAa;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAQlF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,aAAa,CAgCf;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,aAAa,EAClB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,eAAe,CAUjB;AAWD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,aAAa,EAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,MAAM,CASR"}
1
+ {"version":3,"file":"key-schedule.d.ts","sourceRoot":"","sources":["../../../src/tls/stealth/key-schedule.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,MAAM,CAER;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe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ClB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,eAAe,CAUjB;AAOD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,aAAa,EAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,MAAM,CASR"}
@@ -1,33 +1,35 @@
1
+ import { createHmac, hkdfSync } from 'node:crypto';
1
2
  /**
2
- * TLS 1.3 key schedule.
3
+ * Returns the output length in bytes for the given hash algorithm.
3
4
  *
4
- * Implements the HKDF-based key derivation defined in RFC 8446 section 7.
5
- * Uses only `node:crypto` -- zero external dependencies.
5
+ * @param {HashAlgorithm} alg - Hash algorithm identifier.
6
+ * @returns {number} Output length: `32` for `sha256`, `48` for `sha384`.
6
7
  */
7
- import { createHmac, hkdfSync } from 'node:crypto';
8
- /** Hash output length in bytes. */
9
8
  export function hashLength(alg) {
10
9
  return alg === 'sha256' ? 32 : 48;
11
10
  }
12
11
  /**
13
- * HKDF-Extract (RFC 5869 section 2.2).
12
+ * Performs the HKDF-Extract step (RFC 5869 §2.2): computes `HMAC-Hash(salt, IKM)`.
14
13
  *
15
- * Returns a pseudo-random key of `hashLength(alg)` bytes.
14
+ * @param {HashAlgorithm} alg - Hash algorithm for the HMAC computation.
15
+ * @param {Buffer} salt - Salt value (used as HMAC key).
16
+ * @param {Buffer} ikm - Input keying material.
17
+ * @returns {Buffer} Pseudorandom key (PRK) of length `hashLength(alg)`.
16
18
  */
17
19
  export function hkdfExtract(alg, salt, ikm) {
18
20
  return Buffer.from(createHmac(alg, salt).update(ikm).digest());
19
21
  }
20
22
  /**
21
- * HKDF-Expand-Label (RFC 8446 section 7.1).
23
+ * Performs the TLS 1.3 HKDF-Expand-Label operation (RFC 8446 §7.1),
24
+ * deriving a key of `length` bytes from `secret` using the given label
25
+ * and context hash.
22
26
  *
23
- * HKDF-Expand-Label(Secret, Label, Context, Length) =
24
- * HKDF-Expand(Secret, HkdfLabel, Length)
25
- *
26
- * struct {
27
- * uint16 length = Length;
28
- * opaque label<7..255> = "tls13 " + Label;
29
- * opaque context<0..255> = Context;
30
- * } HkdfLabel;
27
+ * @param {HashAlgorithm} alg - Hash algorithm for HKDF.
28
+ * @param {Buffer} secret - Input secret (PRK from HKDF-Extract).
29
+ * @param {string} label - TLS 1.3 label string (without the `"tls13 "` prefix).
30
+ * @param {Buffer} context - Transcript hash, or empty buffer for simple derivations.
31
+ * @param {number} length - Desired output length in bytes.
32
+ * @returns {Buffer} Derived key material of the specified length.
31
33
  */
32
34
  export function hkdfExpandLabel(alg, secret, label, context, length) {
33
35
  const fullLabel = Buffer.from('tls13 ' + label, 'ascii');
@@ -43,26 +45,36 @@ export function hkdfExpandLabel(alg, secret, label, context, length) {
43
45
  return Buffer.from(hkdfSync(alg, secret, hkdfLabel, Buffer.alloc(0), length));
44
46
  }
45
47
  /**
46
- * Derive-Secret (RFC 8446 section 7.1).
48
+ * Derives a secret with a transcript hash context using HKDF-Expand-Label
49
+ * (RFC 8446 §7.1). This is the canonical `Derive-Secret` function of the
50
+ * TLS 1.3 key schedule.
47
51
  *
48
- * Derive-Secret(Secret, Label, Messages) =
49
- * HKDF-Expand-Label(Secret, Label, Transcript-Hash(Messages), Hash.length)
52
+ * @param {HashAlgorithm} alg - Hash algorithm for HKDF.
53
+ * @param {Buffer} secret - Input PRK.
54
+ * @param {string} label - TLS 1.3 label string.
55
+ * @param {Buffer} transcriptHash - Current transcript hash value.
56
+ * @returns {Buffer} Derived secret of length `hashLength(alg)`.
50
57
  */
51
58
  export function deriveSecret(alg, secret, label, transcriptHash) {
52
59
  return hkdfExpandLabel(alg, secret, label, transcriptHash, hashLength(alg));
53
60
  }
54
- /**
55
- * Compute transcript hash incrementally.
56
- */
57
61
  export { createHash } from 'node:crypto';
58
62
  /**
59
- * Zero-length secret for the initial extract stage.
63
+ * Returns a zero-filled `Buffer` whose length equals the output size of
64
+ * `alg` — used as the IKM or salt argument in HKDF-Extract calls that
65
+ * require a zero-length secret at the start of the TLS 1.3 key schedule.
66
+ *
67
+ * @param {HashAlgorithm} alg - Hash algorithm that determines buffer length.
68
+ * @returns {Buffer} Zero-filled buffer of `hashLength(alg)` bytes.
60
69
  */
61
70
  export function zeroKey(alg) {
62
71
  return Buffer.alloc(hashLength(alg));
63
72
  }
64
73
  /**
65
- * Key and IV length for a cipher suite.
74
+ * Returns the key and IV byte lengths for the given AEAD cipher name.
75
+ *
76
+ * @param {string} cipherName - AEAD cipher name (e.g. `"TLS_AES_128_GCM_SHA256"`).
77
+ * @returns {{ keyLen: number; ivLen: number }} Key length and IV length in bytes.
66
78
  */
67
79
  export function keyIVLengths(cipherName) {
68
80
  if (cipherName.includes('AES_128')) {
@@ -74,27 +86,27 @@ export function keyIVLengths(cipherName) {
74
86
  return { keyLen: 16, ivLen: 12 };
75
87
  }
76
88
  /**
77
- * Derive handshake traffic keys from the shared secret and transcript hash.
89
+ * Derives TLS 1.3 handshake traffic keys from the ECDH shared secret and
90
+ * the transcript hash of the ClientHello and ServerHello messages
91
+ * (RFC 8446 §7.1).
78
92
  *
79
- * This implements the Early Secret -> Handshake Secret portion of the
80
- * RFC 8446 key schedule.
93
+ * @param {HashAlgorithm} alg - Hash algorithm specified by the negotiated cipher suite.
94
+ * @param {Buffer} sharedSecret - ECDH shared secret from key exchange.
95
+ * @param {Buffer} helloHash - Transcript hash over ClientHello..ServerHello.
96
+ * @param {number} keyLen - Required key byte length.
97
+ * @param {number} ivLen - Required IV byte length.
98
+ * @returns {HandshakeKeys} Derived handshake keys and intermediate secrets.
81
99
  */
82
100
  export function deriveHandshakeKeys(alg, sharedSecret, helloHash, keyLen, ivLen) {
83
- // 1. Early secret = HKDF-Extract(salt=0, IKM=0)
84
101
  const earlySecret = hkdfExtract(alg, Buffer.alloc(hashLength(alg)), zeroKey(alg));
85
- // 2. Derive salt for handshake secret
86
102
  const derivedSalt = deriveSecret(alg, earlySecret, 'derived', emptyHash(alg));
87
- // 3. Handshake secret = HKDF-Extract(salt=derived, IKM=shared_secret)
88
103
  const handshakeSecret = hkdfExtract(alg, derivedSalt, sharedSecret);
89
- // 4. Client/server handshake traffic secrets
90
104
  const clientSecret = deriveSecret(alg, handshakeSecret, 'c hs traffic', helloHash);
91
105
  const serverSecret = deriveSecret(alg, handshakeSecret, 's hs traffic', helloHash);
92
- // 5. Traffic keys
93
106
  const clientHandshakeKey = hkdfExpandLabel(alg, clientSecret, 'key', Buffer.alloc(0), keyLen);
94
107
  const clientHandshakeIV = hkdfExpandLabel(alg, clientSecret, 'iv', Buffer.alloc(0), ivLen);
95
108
  const serverHandshakeKey = hkdfExpandLabel(alg, serverSecret, 'key', Buffer.alloc(0), keyLen);
96
109
  const serverHandshakeIV = hkdfExpandLabel(alg, serverSecret, 'iv', Buffer.alloc(0), ivLen);
97
- // 6. Master secret derivation
98
110
  const derivedMasterSalt = deriveSecret(alg, handshakeSecret, 'derived', emptyHash(alg));
99
111
  const masterSecret = hkdfExtract(alg, derivedMasterSalt, zeroKey(alg));
100
112
  return {
@@ -107,8 +119,16 @@ export function deriveHandshakeKeys(alg, sharedSecret, helloHash, keyLen, ivLen)
107
119
  };
108
120
  }
109
121
  /**
110
- * Derive application traffic keys from the master secret and the
111
- * full handshake transcript hash.
122
+ * Derives TLS 1.3 application traffic keys from the master secret and the
123
+ * full handshake transcript hash (RFC 8446 §7.1). These keys are used to
124
+ * encrypt and decrypt all application data after the handshake completes.
125
+ *
126
+ * @param {HashAlgorithm} alg - Hash algorithm specified by the negotiated cipher suite.
127
+ * @param {Buffer} masterSecret - TLS 1.3 master secret from {@link deriveHandshakeKeys}.
128
+ * @param {Buffer} handshakeHash - Transcript hash over the complete handshake.
129
+ * @param {number} keyLen - Required key byte length.
130
+ * @param {number} ivLen - Required IV byte length.
131
+ * @returns {ApplicationKeys} Derived application traffic keys.
112
132
  */
113
133
  export function deriveApplicationKeys(alg, masterSecret, handshakeHash, keyLen, ivLen) {
114
134
  const clientSecret = deriveSecret(alg, masterSecret, 'c ap traffic', handshakeHash);
@@ -120,19 +140,19 @@ export function deriveApplicationKeys(alg, masterSecret, handshakeHash, keyLen,
120
140
  serverIV: hkdfExpandLabel(alg, serverSecret, 'iv', Buffer.alloc(0), ivLen),
121
141
  };
122
142
  }
123
- /**
124
- * Hash of empty string -- used for the Derive-Secret("derived", "")
125
- * step in the key schedule.
126
- */
127
143
  function emptyHash(alg) {
128
144
  const { createHash } = require('node:crypto');
129
145
  return createHash(alg).digest();
130
146
  }
131
147
  /**
132
- * Build the Finished verify_data.
148
+ * Computes the `verify_data` for a TLS 1.3 Finished message (RFC 8446 §4.4.4)
149
+ * as `HMAC(finished_key, transcript_hash)`, where `finished_key` is derived
150
+ * from the base traffic secret using HKDF-Expand-Label.
133
151
  *
134
- * finished_key = HKDF-Expand-Label(BaseKey, "finished", "", Hash.length)
135
- * verify_data = HMAC(finished_key, Transcript-Hash(Handshake Context))
152
+ * @param {HashAlgorithm} alg - Hash algorithm for HMAC.
153
+ * @param {Buffer} baseSecret - Base traffic secret (client or server handshake secret).
154
+ * @param {Buffer} transcriptHash - Current transcript hash at the point of Finished.
155
+ * @returns {Buffer} The `verify_data` bytes to include in or validate against the Finished message.
136
156
  */
137
157
  export function computeFinishedVerifyData(alg, baseSecret, transcriptHash) {
138
158
  const finishedKey = hkdfExpandLabel(alg, baseSecret, 'finished', Buffer.alloc(0), hashLength(alg));
@@ -1 +1 @@
1
- {"version":3,"file":"key-schedule.js","sourceRoot":"","sources":["../../../src/tls/stealth/key-schedule.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAInD,mCAAmC;AACnC,MAAM,UAAU,UAAU,CAAC,GAAkB;IAC3C,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MA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,UAAU,EACV,UAAU,EACV,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EACf,UAAU,CAAC,GAAG,CAAC,CAChB,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AACnF,CAAC"}
@@ -1,8 +1,10 @@
1
1
  /**
2
- * TLS record layer.
2
+ * A single parsed TLS record as defined in RFC 8446 ¥5.1.
3
3
  *
4
- * Handles framing, encryption, and decryption of TLS records.
5
- * Operates on raw TCP byte streams.
4
+ * @typedef {Object} TLSRecord
5
+ * @property {number} type - Content type byte (see {@link RecordType}).
6
+ * @property {number} version - Legacy record version (e.g. `0x0303` for TLS 1.2 compatibility).
7
+ * @property {Buffer} fragment - Raw payload bytes of the record.
6
8
  */
7
9
  export interface TLSRecord {
8
10
  type: number;
@@ -10,62 +12,111 @@ export interface TLSRecord {
10
12
  fragment: Buffer;
11
13
  }
12
14
  /**
13
- * Read a single TLS record from a buffer.
15
+ * Attempts to parse a single TLS record from `data` beginning at `offset`.
16
+ * Returns `null` without consuming the buffer if fewer than 5 bytes are
17
+ * available or the payload has not been fully received yet.
14
18
  *
15
- * Returns the record and the number of bytes consumed, or `null` if
16
- * the buffer does not contain a complete record.
19
+ * @param {Buffer} data - Buffer containing one or more TLS records.
20
+ * @param {number} offset - Byte offset within `data` to begin parsing.
21
+ * @returns {{ record: TLSRecord; bytesRead: number } | null} Parsed record and byte count, or `null` if more data is needed.
17
22
  */
18
23
  export declare function readRecord(data: Buffer, offset: number): {
19
24
  record: TLSRecord;
20
25
  bytesRead: number;
21
26
  } | null;
22
27
  /**
23
- * Write a TLS record (unencrypted) to a buffer.
28
+ * Serializes a TLS record into its 5-byte header plus payload binary form.
29
+ *
30
+ * @param {number} type - TLS content type byte.
31
+ * @param {number} version - TLS record version (e.g. `0x0303`).
32
+ * @param {Buffer} payload - Record payload bytes.
33
+ * @returns {Buffer} The complete serialized TLS record.
24
34
  */
25
35
  export declare function writeRecord(type: number, version: number, payload: Buffer): Buffer;
36
+ /**
37
+ * AEAD algorithm identifiers supported by the record layer. Corresponds to
38
+ * the TLS 1.3 mandatory cipher suites.
39
+ *
40
+ * @typedef {'aes-128-gcm'|'aes-256-gcm'|'chacha20-poly1305'} AEADAlgorithm
41
+ */
26
42
  export type AEADAlgorithm = 'aes-128-gcm' | 'aes-256-gcm' | 'chacha20-poly1305';
27
43
  /**
28
- * Determine AEAD algorithm from cipher suite name.
44
+ * Maps a cipher suite name string to the corresponding AEAD algorithm
45
+ * identifier used by the record layer.
46
+ *
47
+ * @param {string} cipherName - Cipher suite name from {@link TLSConnectionInfo} (e.g. `"TLS_AES_128_GCM_SHA256"`).
48
+ * @returns {AEADAlgorithm} The corresponding AEAD algorithm identifier.
49
+ * @throws {TLSError} If the cipher name does not correspond to a supported AEAD algorithm.
29
50
  */
30
51
  export declare function aeadFromCipher(cipherName: string): AEADAlgorithm;
31
52
  /**
32
- * Build the per-record nonce by XORing the IV with the 64-bit
33
- * sequence number (zero-padded on the left).
53
+ * Constructs the per-record nonce by XOR-ing the static IV with the
54
+ * big-endian 64-bit sequence number (RFC 8446 ¥5.3).
55
+ *
56
+ * @param {Buffer} iv - Static IV of length matching the AEAD algorithm.
57
+ * @param {bigint} sequenceNumber - Record sequence number (starts at 0, increments by 1).
58
+ * @returns {Buffer} The per-record nonce.
34
59
  */
35
60
  export declare function buildNonce(iv: Buffer, sequenceNumber: bigint): Buffer;
36
61
  /**
37
- * Encrypt a TLS 1.3 record.
62
+ * Encrypts `plaintext` using the specified AEAD algorithm and returns the
63
+ * ciphertext with an appended 16-byte authentication tag.
38
64
  *
39
- * The plaintext is the handshake/application data followed by the
40
- * content type byte. The additional data is the record header of the
41
- * outer (opaque) application_data record.
65
+ * @param {AEADAlgorithm} algorithm - AEAD algorithm identifier.
66
+ * @param {Buffer} key - Encryption key.
67
+ * @param {Buffer} nonce - Per-record nonce.
68
+ * @param {Buffer} plaintext - Data to encrypt.
69
+ * @param {Buffer} additionalData - Additional authenticated data (AAD).
70
+ * @returns {Buffer} Ciphertext followed by the 16-byte authentication tag.
42
71
  */
43
72
  export declare function encryptRecord(algorithm: AEADAlgorithm, key: Buffer, nonce: Buffer, plaintext: Buffer, additionalData: Buffer): Buffer;
44
73
  /**
45
- * Decrypt a TLS 1.3 record.
74
+ * Decrypts and authenticates `ciphertext` using the specified AEAD algorithm.
75
+ * The last 16 bytes of `ciphertext` are treated as the authentication tag.
46
76
  *
47
- * Returns the decrypted plaintext including the trailing content type
48
- * byte. The caller must strip the content type.
77
+ * @param {AEADAlgorithm} algorithm - AEAD algorithm identifier.
78
+ * @param {Buffer} key - Decryption key.
79
+ * @param {Buffer} nonce - Per-record nonce.
80
+ * @param {Buffer} ciphertext - Ciphertext including the 16-byte authentication tag.
81
+ * @param {Buffer} additionalData - Additional authenticated data (AAD) for tag verification.
82
+ * @returns {Buffer} Decrypted plaintext bytes.
83
+ * @throws {TLSError} If the ciphertext is too short or authentication fails.
49
84
  */
50
85
  export declare function decryptRecord(algorithm: AEADAlgorithm, key: Buffer, nonce: Buffer, ciphertext: Buffer, additionalData: Buffer): Buffer;
51
86
  /**
52
- * Build the additional data for a TLS 1.3 encrypted record.
87
+ * Builds the additional authenticated data (AAD) for a TLS 1.3 application
88
+ * data record, encoded as a 5-byte pseudo-record header per RFC 8446 ¥5.2.
53
89
  *
54
- * For TLS 1.3: the 5-byte record header of the *outer* record
55
- * (type=application_data, version=0x0303, length).
90
+ * @param {number} ciphertextLength - Total length of the ciphertext including the AEAD tag.
91
+ * @returns {Buffer} 5-byte AAD buffer.
56
92
  */
57
93
  export declare function buildAdditionalData(ciphertextLength: number): Buffer;
58
94
  /**
59
- * Wrap plaintext into an encrypted TLS 1.3 record.
95
+ * Encodes a TLS 1.3 inner plaintext (content bytes + content type byte) and
96
+ * wraps it in an encrypted TLS record with the appropriate AAD, following
97
+ * RFC 8446 ¥5.2.
60
98
  *
61
- * Appends the real content type byte to the plaintext, encrypts with
62
- * AEAD, and wraps in a record with type=application_data.
99
+ * @param {AEADAlgorithm} algorithm - AEAD algorithm identifier.
100
+ * @param {Buffer} key - Application traffic key.
101
+ * @param {Buffer} iv - Application traffic IV.
102
+ * @param {bigint} sequenceNumber - Sequence number for nonce derivation.
103
+ * @param {number} contentType - True content type byte to embed in the inner plaintext.
104
+ * @param {Buffer} plaintext - Application data to encrypt.
105
+ * @returns {Buffer} The complete TLS application_data record ready to send.
63
106
  */
64
107
  export declare function wrapEncryptedRecord(algorithm: AEADAlgorithm, key: Buffer, iv: Buffer, sequenceNumber: bigint, contentType: number, plaintext: Buffer): Buffer;
65
108
  /**
66
- * Unwrap an encrypted TLS 1.3 record.
109
+ * Decrypts a TLS 1.3 application_data record, strips the zero-padding, and
110
+ * recovers the true content type embedded as the last non-zero byte of the
111
+ * inner plaintext (RFC 8446 ¥5.2).
67
112
  *
68
- * Returns the decrypted plaintext and the real content type.
113
+ * @param {AEADAlgorithm} algorithm - AEAD algorithm identifier.
114
+ * @param {Buffer} key - Application traffic key.
115
+ * @param {Buffer} iv - Application traffic IV.
116
+ * @param {bigint} sequenceNumber - Sequence number for nonce derivation.
117
+ * @param {TLSRecord} record - Encrypted TLS record received from the remote party.
118
+ * @returns {{ contentType: number; plaintext: Buffer }} Recovered content type and decrypted payload.
119
+ * @throws {TLSError} If decryption or authentication fails, or the record is empty after unpadding.
69
120
  */
70
121
  export declare function unwrapEncryptedRecord(algorithm: AEADAlgorithm, key: Buffer, iv: Buffer, sequenceNumber: bigint, record: TLSRecord): {
71
122
  contentType: number;
@@ -1 +1 @@
1
- {"version":3,"file":"record-layer.d.ts","sourceRoot":"","sources":["../../../src/tls/stealth/record-layer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAA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