-
Notifications
You must be signed in to change notification settings - Fork 2
PasskeyController
Viames Marino edited this page Feb 24, 2026
·
1 revision
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 call
requireAuth(). - Challenge creation/verification is delegated to
Pair\Services\PasskeyAuth. -
passkeyAction()routes by URL params and HTTP method; unknown combinations returnNOT_FOUND.
{ "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)
-
- Revoke success:
- HTTP
204 No Content
- HTTP
See also: API, ApiController, CrudController, PasskeyAuth, UserPasskey, PairPasskey.js.