Mac hosting guide

Real-Hardware Safari WebAuthn Passkey Testing

Use Playwright 1.61's browserContext.credentials virtual authenticator to test Safari and WebKit passkey registration and assertion without CDP. Real Touch ID tests need a physical Mac you control, not a Figment plan.

Figment editorial teamPublished Updated Facts checked November 10, 2026

Figment Mac plans

US East. Pay before use. Hourly and daily too.

Intel Mac VM4 shared vCPUs, 4GB RAM, 80GB SSD$25per monthApple Silicon Mac VM4 shared vCPUs, 4GB RAM, 65GB SSD$39per monthDedicated M4 Pro12-core CPU, 24GB RAM, 512GB SSD$199per month

Minimum first purchase: $25 of account credit, used for your rental.

Use Playwright 1.61's browserContext.credentials virtual authenticator for Safari and WebKit passkey tests. It works cross-browser without CDP and needs no biometric hardware. Tests that need the real Secure Enclave and Touch ID need a physical Mac with a Touch ID sensor that you control. Apple's platform-authenticator reference is the primary source for what Safari delegates to the OS.

What is Safari's platform authenticator?

Safari's platform authenticator on macOS is the device itself: Touch ID on Macs that have it, backed by the Secure Enclave. When a page calls navigator.credentials.create({ publicKey: { authenticatorSelection: { authenticatorAttachment: "platform" } } }), Safari delegates to the OS passkey provider documented in Apple's ASAuthorizationPlatformPublicKeyCredentialProvider reference. Confirm the minimum macOS and Safari pair you support against the current Safari release notes, because passkey behavior and UI have changed across releases.

For automated CI there are two separate questions:

  1. Protocol-level tests. Does the ceremony complete, is the credential ID non-empty, does the server verify the assertion?
  2. Hardware-level tests. Does the real Touch ID prompt render, can a failed biometric read be observed, does the Secure Enclave hold the key?

Only the second kind needs a physical Mac. The first runs on a virtual authenticator.

Why can't a CDP virtual authenticator cover Safari?

The older Playwright pattern used the Chrome DevTools Protocol method WebAuthn.addVirtualAuthenticator through a CDPSession. That protocol only exists in Chromium. Point it at WebKit and there is no CDP endpoint to attach to, so the call cannot land. This is a protocol limitation, not a configuration one, so a project that relies on CDP for passkey tests gets no Safari coverage.

How does the Playwright 1.61 virtual authenticator work?

Playwright 1.61 shipped a first-class virtual authenticator on browserContext.credentials that works in Chromium, Firefox and WebKit without CDP. The Credentials API has four methods: create(rpId, options?) seeds a credential, install() intercepts navigator.credentials.create() and get(), get(options?) reads back everything the authenticator holds, and delete(id) removes one.

Install Playwright 1.61 or newer and the WebKit browser:

npm install -D @playwright/test@^1.61
npx playwright install webkit

How do I test registration?

Call install() before any page script touches WebAuthn, then let the app drive registration:

// passkey-register.spec.ts
import { test, expect, webkit } from '@playwright/test';

test('WebKit: registers a passkey and returns a non-empty credentialId', async () => {
  const browser = await webkit.launch();
  const context = await browser.newContext();

  // Intercept navigator.credentials.create/get before any page loads.
  await context.credentials.install();

  const page = await context.newPage();
  await page.goto('http://localhost:3000/register');
  await page.getByRole('button', { name: 'Register passkey' }).click();

  // The app renders the returned credentialId after a successful ceremony.
  const credentialIdEl = page.locator('[data-testid="credential-id"]');
  await expect(credentialIdEl).toBeVisible({ timeout: 8000 });
  const credentialId = (await credentialIdEl.textContent())?.trim() ?? '';
  expect(credentialId.length).toBeGreaterThan(20);

  // Read the credential back for later specs via a JSON fixture (not env vars,
  // which do not cross spec/worker boundaries).
  const stored = await context.credentials.get({ rpId: 'localhost' });
  await require('node:fs/promises').writeFile(
    'test-fixtures/passkey.json',
    JSON.stringify(stored, null, 2),
  );

  await browser.close();
});

How do I test an assertion and verify it on the server?

Seed the saved credential, call install(), run the assertion flow, and verify the response against your own @simplewebauthn/server relying party:

// passkey-assert.spec.ts
import { test, expect, webkit } from '@playwright/test';
import { verifyAuthenticationResponse } from '@simplewebauthn/server';
import { readFile } from 'node:fs/promises';

test('WebKit: assertion verifies with @simplewebauthn/server', async () => {
  const [stored] = JSON.parse(await readFile('test-fixtures/passkey.json', 'utf8'));

  const browser = await webkit.launch();
  const context = await browser.newContext();

  // Re-seed the exact credential the registration step produced.
  await context.credentials.create(stored.rpId, {
    id: stored.id,
    userHandle: stored.userHandle,
    privateKey: stored.privateKey,
    publicKey: stored.publicKey,
    signCount: stored.signCount,
  });
  await context.credentials.install();

  const page = await context.newPage();
  await page.goto('http://localhost:3000/login');

  // Capture the challenge your server issued for this attempt, then let the
  // app drive navigator.credentials.get().
  const expectedChallenge = await page.getAttribute('[data-challenge]', 'data-value');
  await page.getByRole('button', { name: 'Sign in with passkey' }).click();

  const assertionResponse = await page.evaluate(
    () => (window as any).__lastAssertionResponse,
  );
  expect(assertionResponse?.id).toBeTruthy();

  const verification = await verifyAuthenticationResponse({
    response: assertionResponse,
    expectedChallenge: expectedChallenge!,
    expectedOrigin: 'http://localhost:3000',
    expectedRPID: 'localhost',
    authenticator: {
      credentialID: Buffer.from(stored.id, 'base64url'),
      credentialPublicKey: Buffer.from(stored.publicKey, 'base64url'),
      counter: stored.signCount ?? 0,
    },
  });
  expect(verification.verified).toBe(true);

  await browser.close();
});

The code is an example, not a measured benchmark. Run it against your own routes, your own challenge issuer and the exact @simplewebauthn/server version you deploy. Keep any real keys in your CI secret manager, never export the full shell environment to a shared file, and never commit private keys to the repo.

When do I need real Touch ID hardware?

You need it when your acceptance criteria include the system Touch ID sheet rendering, a cancelled biometric returning NotAllowedError, or a passkey synced through iCloud Keychain being offered. The virtual authenticator answers the ceremony correctly, but it does not exercise the Secure Enclave, the Touch ID sensor or the macOS Keychain's passkey storage. Those paths require a Mac with a Secure Enclave and a Touch ID sensor. The OS draws the system sheet, so you cannot script it from inside the browser process. UI automation at that layer is manual or uses an accessibility tool that can tap the OS prompt, not Playwright.

Can a Figment Mac run Touch ID passkey tests?

Touch ID and security-key hardware are not available or measured on any Figment plan, so a Figment Mac runs the virtual-authenticator tests only. The Intel Mac VM ($25 a month, $2 a day, macOS Sequoia) is enough for Playwright WebKit with Node 20. The Apple Silicon Mac VM ($39 a month, $6 a day) fits if the same machine also builds with Xcode 26.4 or later. Real Touch ID runs need a physical Mac you control. See the Mac hosting plans.

For market context, CloudMac publishes an M4/16 GB/256 GB plan at $99.99/month, and its home page advertises a $999/year option, about $83.25/month effective. Twelve months of the Apple Silicon Mac VM is 12 × $39 = $468, and of the Dedicated M4 Pro 48 GB $3,228 paid up front, or 12 × $299 = $3,588 on a 12-month term. CloudMac's 512 GB and 1 TB rows were listed as fully reserved as of 2026-11-10, so availability depends on the row you need. MacStadium lists M2.S at $109 (8 GB/256 GB), M4.S at $149 (16 GB/256 GB), and M4.M at $249 (24 GB/512 GB), with support and a 99.99% uptime claim included. Figment's Dedicated M4 Pro 48 GB (whole Mac, 48GB, 512GB SSD) has twice the memory of MacStadium's M4.M.

Related guides:

Which Figment Mac fits this work?

Intel Mac VM from $25 a month, Apple Silicon Mac VM from $39, or a Dedicated M4 Pro for $199. Hourly and daily plans too. You pay before use, starting with at least $25 of account credit.

Choose a Mac plan