Skip to content

Commit a6f557b

Browse files
authored
fix: Add documentation and type definitions for the new event.client.* fields (#625)
1 parent 3cd6844 commit a6f557b

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

documentation/docs/globals/FetchEvent/FetchEvent.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ It provides the [`event.respondWith()`](./prototype/respondWith.mdx) method, whi
1818
- `FetchEvent.client.address` _**readonly**_
1919
- : A string representation of the IPv4 or IPv6 address of the downstream client.
2020
- `FetchEvent.client.geo` _**readonly**_
21-
- : A [geolocation dictionary](../../fastly:geolocation/getGeolocationForIpAddress.mdx) corresponding to the IP address of the downstream client.
21+
- : A [geolocation dictionary](../../fastly:geolocation/getGeolocationForIpAddress.mdx) corresponding to the IP address of the downstream client.
22+
- `FetchEvent.client.tlsJA3MD5` _**readonly**_
23+
- : A string representation of the JA3 hash of the TLS ClientHello message.
24+
- `FetchEvent.client.tlsCipherOpensslName` _**readonly**_
25+
- : A string representation of the cipher suite used to secure the client TLS connection.
26+
- `FetchEvent.client.tlsProtocol` _**readonly**_
27+
- : A string representation of the TLS protocol version used to secure the client TLS connection.
28+
- `FetchEvent.client.tlsClientCertificate` _**readonly**_
29+
- : An ArrayBuffer containing the raw client certificate in the mutual TLS handshake message. It is in PEM format. Returns an empty ArrayBuffer if this is not mTLS or available.
30+
- `FetchEvent.client.tlsClientHello` _**readonly**_
31+
- : An ArrayBuffer containing the raw bytes sent by the client in the TLS ClientHello message.
2232

2333
## Instance methods
2434

test-d/globals.test-d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,19 @@ import { expectError, expectType } from 'tsd';
208208
const client = {} as ClientInfo
209209
expectType<string>(client.address)
210210
expectType<Geolocation>(client.geo)
211+
expectType<string>(client.tlsJA3MD5)
212+
expectType<string>(client.tlsCipherOpensslName)
213+
expectType<string>(client.tlsProtocol)
214+
expectType<ArrayBuffer>(client.tlsClientCertificate)
215+
expectType<ArrayBuffer>(client.tlsClientHello)
211216
// They are readonly properties
212217
expectError(client.address = '')
213218
expectError(client.geo = {} as Geolocation)
219+
expectError(client.tlsJA3MD5 = '')
220+
expectError(client.tlsCipherOpensslName = '')
221+
expectError(client.tlsProtocol = '')
222+
expectError(client.tlsClientCertificate = '')
223+
expectError(client.tlsClientHello = '')
214224
}
215225

216226
// ConfigStore

types/globals.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ declare interface ClientInfo {
263263
*/
264264
readonly address: string;
265265
readonly geo: import('fastly:geolocation').Geolocation;
266+
readonly tlsJA3MD5: string;
267+
readonly tlsCipherOpensslName: string;
268+
readonly tlsProtocol: string;
269+
readonly tlsClientCertificate: ArrayBuffer;
270+
readonly tlsClientHello: ArrayBuffer;
266271
}
267272

268273
/**

0 commit comments

Comments
 (0)