class VerifyPasskey

Traits

Methods

void
dispatchIfListening(string $eventClass, Closure $event)

Dispatch the given event if listeners are registered.

__construct(ConnectionResolverInterface $database)

No description

__invoke(PublicKeyCredential $credential, PublicKeyCredentialRequestOptions $options, PasskeyUser|null $user = null)

Validate the passkey credential and return the passkey.

AuthenticatorAssertionResponse
getResponse(PublicKeyCredential $credential)

Get the authenticator assertion response from the credential.

getPasskey(PublicKeyCredential $credential, bool $lock = false, string|null $ownerType = null)

Get the passkey by credential ID.

void
ensurePasskeyBelongsToUser(Passkey $passkey, PasskeyUser|null $user)

Ensure the passkey belongs to the expected user.

resolvePasskeyOwner(Passkey $passkey, string $ownerType)

Resolve the passkey owner for passwordless login.

string
ownerMorphClassForGuard(StatefulGuard $guard)

Get the owner morph class supported by the selected guard.

CredentialRecord
validate(AuthenticatorAssertionResponse $response, Passkey $passkey, PublicKeyCredentialRequestOptions $options)

Validate the credential against the stored passkey.

string
hostFromOptions(PublicKeyCredentialRequestOptions $options)

Get the relying party ID stored in the verification options.

void
updatePasskey(Passkey $passkey, CredentialRecord $source)

Update the passkey with the latest credential data.

Details

in DispatchesEvents at line 16
protected void dispatchIfListening(string $eventClass, Closure $event)

Dispatch the given event if listeners are registered.

Parameters

string $eventClass
Closure $event

Return Value

void

at line 30
__construct(ConnectionResolverInterface $database)

No description

Parameters

ConnectionResolverInterface $database

at line 40
Passkey __invoke(PublicKeyCredential $credential, PublicKeyCredentialRequestOptions $options, PasskeyUser|null $user = null)

Validate the passkey credential and return the passkey.

Parameters

PublicKeyCredential $credential
PublicKeyCredentialRequestOptions $options
PasskeyUser|null $user

Return Value

Passkey

Exceptions

InvalidPasskeyException

at line 84
protected AuthenticatorAssertionResponse getResponse(PublicKeyCredential $credential)

Get the authenticator assertion response from the credential.

Parameters

PublicKeyCredential $credential

Return Value

AuthenticatorAssertionResponse

Exceptions

InvalidPasskeyException

at line 98
Passkey getPasskey(PublicKeyCredential $credential, bool $lock = false, string|null $ownerType = null)

Get the passkey by credential ID.

Parameters

PublicKeyCredential $credential
bool $lock
string|null $ownerType

Return Value

Passkey

Exceptions

InvalidPasskeyException

at line 132
void ensurePasskeyBelongsToUser(Passkey $passkey, PasskeyUser|null $user)

Ensure the passkey belongs to the expected user.

Parameters

Passkey $passkey
PasskeyUser|null $user

Return Value

void

Exceptions

InvalidPasskeyException

at line 152
protected PasskeyUser resolvePasskeyOwner(Passkey $passkey, string $ownerType)

Resolve the passkey owner for passwordless login.

Parameters

Passkey $passkey
string $ownerType

Return Value

PasskeyUser

Exceptions

InvalidPasskeyException

at line 166
protected string ownerMorphClassForGuard(StatefulGuard $guard)

Get the owner morph class supported by the selected guard.

Parameters

StatefulGuard $guard

Return Value

string

at line 187
protected CredentialRecord validate(AuthenticatorAssertionResponse $response, Passkey $passkey, PublicKeyCredentialRequestOptions $options)

Validate the credential against the stored passkey.

Parameters

AuthenticatorAssertionResponse $response
Passkey $passkey
PublicKeyCredentialRequestOptions $options

Return Value

CredentialRecord

at line 215
protected string hostFromOptions(PublicKeyCredentialRequestOptions $options)

Get the relying party ID stored in the verification options.

Parameters

PublicKeyCredentialRequestOptions $options

Return Value

string

at line 230
void updatePasskey(Passkey $passkey, CredentialRecord $source)

Update the passkey with the latest credential data.

The credential must be persisted after each use to store the updated signature counter, which is used to detect cloned authenticators.

Parameters

Passkey $passkey
CredentialRecord $source

Return Value

void