Repository navigation
feat: Add BrowserContext wrappers for virtual WebAuthn credentials - #111
Open
oliverandrich wants to merge 1 commit into
Open
oliverandrich wants to merge 1 commit into
oliverandrich wants to merge 1 commit into
Conversation
Playwright 1.63 added a virtual WebAuthn authenticator per browser context. These functions wrap its install, create, get and delete methods.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Playwright 1.63 added
context.credentials, a virtual WebAuthn authenticator per browser context.playwright_ex already carries these credentials in the storage state, but has no wrapper for the API itself.
This adds four functions to
PlaywrightEx.BrowserContext, one per protocol method:credentials_install/2installs the authenticator into the context.credentials_create/3seeds a credential for a relying party, generated or imported.credentials_get/2lists the credentials, optionally filtered by:idor:rp_id.credentials_delete/3removes a credential by id.They follow the existing channel functions: NimbleOptions schemas, typespecs and links to the Playwright docs.
Returned credentials have the same shape as those in
storage_state/2.Why
I maintain Ithibati, a passkey library for Phoenix.
Its browser tests add a virtual authenticator over a raw CDP session today.
With these wrappers they can use Playwright's own authenticator instead.
Tests
Five tests in
browser_context_test.exs:credentials_install/2navigator.credentials.get(), with the sign count incrementedcredentials_install/2keeping the browser's own WebAuthnmix checkpasses.