From 87e9c615400958681f798bbe71a808e7ed98c790 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 19 Aug 2024 09:06:48 +0200 Subject: [PATCH] use Buffer everywhere --- docs/src/api/params.md | 4 ++-- packages/playwright-core/src/client/types.ts | 4 ++-- packages/playwright-core/types/types.d.ts | 16 ++++++++-------- tests/library/client-certificates.spec.ts | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/src/api/params.md b/docs/src/api/params.md index 14d236a344..5aa9c6a5ab 100644 --- a/docs/src/api/params.md +++ b/docs/src/api/params.md @@ -531,9 +531,9 @@ Does not enforce fixed viewport, allows resizing window in the headed mode. - `clientCertificates` <[Array]<[Object]>> - `origin` <[string]> Exact origin that the certificate is valid for. Origin includes `https` protocol, a hostname and optionally a port. - `certPath` ?<[path]> Path to the file with the certificate in PEM format. - - `cert` ?<[string]> Direct value of the certificate in PEM format. + - `cert` ?<[Buffer]> Direct value of the certificate in PEM format. - `keyPath` ?<[path]> Path to the file with the private key in PEM format. - - `key` ?<[string]> Direct value of the private key in PEM format. + - `key` ?<[Buffer]> Direct value of the private key in PEM format. - `pfxPath` ?<[path]> Path to the PFX or PKCS12 encoded private key and certificate chain. - `pfx` ?<[Buffer]> Direct value of the PFX or PKCS12 encoded private key and certificate chain. - `passphrase` ?<[string]> Passphrase for the private key (PEM or PFX). diff --git a/packages/playwright-core/src/client/types.ts b/packages/playwright-core/src/client/types.ts index 68de78ba2f..37d374e3ec 100644 --- a/packages/playwright-core/src/client/types.ts +++ b/packages/playwright-core/src/client/types.ts @@ -49,9 +49,9 @@ export const kLifecycleEvents: Set = new Set(['load', 'domconten export type ClientCertificate = { origin: string; - cert?: string; + cert?: Buffer; certPath?: string; - key?: string; + key?: Buffer; keyPath?: string; pfx?: Buffer; pfxPath?: string; diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index ecf9dad96d..a4bf9fa812 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -9162,7 +9162,7 @@ export interface Browser { /** * Direct value of the certificate in PEM format. */ - cert?: string; + cert?: Buffer; /** * Path to the file with the private key in PEM format. @@ -9172,7 +9172,7 @@ export interface Browser { /** * Direct value of the private key in PEM format. */ - key?: string; + key?: Buffer; /** * Path to the PFX or PKCS12 encoded private key and certificate chain. @@ -13889,7 +13889,7 @@ export interface BrowserType { /** * Direct value of the certificate in PEM format. */ - cert?: string; + cert?: Buffer; /** * Path to the file with the private key in PEM format. @@ -13899,7 +13899,7 @@ export interface BrowserType { /** * Direct value of the private key in PEM format. */ - key?: string; + key?: Buffer; /** * Path to the PFX or PKCS12 encoded private key and certificate chain. @@ -16313,7 +16313,7 @@ export interface APIRequest { /** * Direct value of the certificate in PEM format. */ - cert?: string; + cert?: Buffer; /** * Path to the file with the private key in PEM format. @@ -16323,7 +16323,7 @@ export interface APIRequest { /** * Direct value of the private key in PEM format. */ - key?: string; + key?: Buffer; /** * Path to the PFX or PKCS12 encoded private key and certificate chain. @@ -20669,7 +20669,7 @@ export interface BrowserContextOptions { /** * Direct value of the certificate in PEM format. */ - cert?: string; + cert?: Buffer; /** * Path to the file with the private key in PEM format. @@ -20679,7 +20679,7 @@ export interface BrowserContextOptions { /** * Direct value of the private key in PEM format. */ - key?: string; + key?: Buffer; /** * Path to the PFX or PKCS12 encoded private key and certificate chain. diff --git a/tests/library/client-certificates.spec.ts b/tests/library/client-certificates.spec.ts index 0c3386e661..87f0f09ba7 100644 --- a/tests/library/client-certificates.spec.ts +++ b/tests/library/client-certificates.spec.ts @@ -309,8 +309,8 @@ test.describe('browser', () => { ignoreHTTPSErrors: true, clientCertificates: [{ origin: new URL(serverURL).origin, - cert: (await fs.promises.readFile(asset('client-certificates/client/trusted/cert.pem'))).toString(), - key: (await fs.promises.readFile(asset('client-certificates/client/trusted/key.pem'))).toString(), + cert: await fs.promises.readFile(asset('client-certificates/client/trusted/cert.pem')), + key: await fs.promises.readFile(asset('client-certificates/client/trusted/key.pem')), }], }); await page.goto(serverURL);