Credentials

Playwright\Credentials\CredentialsInterface

Virtual WebAuthn authenticator for a browser context. Lets a test register passkeys and answer the page's navigator.credentials.create() and navigator.credentials.get() calls without a real authenticator. Every id and key is base64url encoded.

Methods

create()

array

Seeds a discoverable credential and returns it, private key included, so it can be stored and seeded again later. Any key material left out is generated. To import a known credential, pass id, userHandle, privateKey and publicKey together.

function create(string $rpId, array $options = []): array

delete()

void

Removes the credential with that id, whether it was seeded or registered by the page itself.

function delete(string $id): void

get()

array

Returns the credentials the authenticator holds, private keys included, narrowed by the given filters. Covers both seeded credentials and the ones the page registered itself.

function get(array $options = []): array

install()

void

Starts intercepting WebAuthn in every page of the context; until this runs the page sees none of the seeded credentials.

function install(): void