-
Notifications
You must be signed in to change notification settings - Fork 2
PasskeyController
Viames Marino edited this page Apr 20, 2026
·
2 revisions
Pair\Api\PasskeyController is an API base controller that exposes ready-to-use Passkey/WebAuthn endpoints.
It extends CrudController, so you can use passkey endpoints and CRUD resources in the same API module.
<?php
namespace App\Modules\Api;
class ApiController extends \Pair\Api\PasskeyController {}POST /api/passkey/login/optionsPOST /api/passkey/login/verify-
POST /api/passkey/register/options(requires auth session) -
POST /api/passkey/register/verify(requires auth session) -
GET /api/passkey/list(requires auth session) -
DELETE /api/passkey/revoke/{id}(requires auth session)
- Login flows can be usernameless or can receive
usernamein payload. - Registration and management endpoints use the
ApiControllerauth guard and now bubbleUNAUTHORIZEDas an explicitApiErrorResponseon the migrated v4 path. - Challenge creation/verification is delegated to
Pair\Services\PasskeyAuth. -
passkeyAction()routes by URL params and HTTP method; unknown combinations now return an explicitApiErrorResponse. - All built-in passkey success endpoints now return explicit
JsonResponseobjects on the migrated v4 path, includingGET /api/passkey/listandDELETE /api/passkey/revoke/{id}. - Method, media-type, body-shape, credential, and revoke validation errors now bubble as explicit
ApiErrorResponseobjects on migrated passkey action paths.
{ "username": "john" }username is optional.
{
"credential": { "...": "serialized WebAuthn assertion" },
"username": "john",
"timezone": "Europe/Rome"
}username and timezone are optional (timezone defaults to UTC if invalid/missing).
{ "displayName": "John Doe" }displayName is optional.
{
"credential": { "...": "serialized WebAuthn attestation" },
"label": "My MacBook"
}label is optional.
- Login verify success:
-
message,userId,sessionId
-
- Register verify success (
201):-
message,passkeyobject (id,label,credentialId,createdAt)
-
- List success:
- array of passkeys (
id,label,credentialId,createdAt,lastUsedAt,transports)
- array of passkeys (
- Revoke success:
- HTTP
204 No Content
- HTTP
- Guard or payload failure:
- standard Pair API error payload with
codeanderror
- standard Pair API error payload with
See also: API, ApiController, CrudController, PasskeyAuth, UserPasskey, PairPasskey.js.