PHPackages                             livewirez/webauthn-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. livewirez/webauthn-laravel

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

livewirez/webauthn-laravel
==========================

A laravel package for authenticating with webauthn passkeys on laravel applications.

v0.1.61(4mo ago)194MITPHPPHP ^8.2

Since Feb 7Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/Livewirez/webauthn-laravel)[ Packagist](https://packagist.org/packages/livewirez/webauthn-laravel)[ RSS](/packages/livewirez-webauthn-laravel/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (21)Versions (28)Used By (0)

Webauthn - Laravel - Hello Passkeys, Bye-Bye Passwords
======================================================

[](#webauthn---laravel---hello-passkeys-bye-bye-passwords)

[![PHP Version](https://camo.githubusercontent.com/a4deb8874f24ca09b0ede15277170d0253e609299b567228d3acfa2b52d2b61e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c697665776972657a2f776562617574686e2d6c61726176656c)](https://camo.githubusercontent.com/a4deb8874f24ca09b0ede15277170d0253e609299b567228d3acfa2b52d2b61e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c697665776972657a2f776562617574686e2d6c61726176656c)[![Laravel Version](https://camo.githubusercontent.com/b3071a3c73b11e2062d2b8d29b8e822540b491af8ed64cf81c656ec1f6f45556/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6c697665776972657a2f776562617574686e2d6c61726176656c2f696c6c756d696e6174652f737570706f7274)](https://camo.githubusercontent.com/b3071a3c73b11e2062d2b8d29b8e822540b491af8ed64cf81c656ec1f6f45556/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6c697665776972657a2f776562617574686e2d6c61726176656c2f696c6c756d696e6174652f737570706f7274)[![License](https://camo.githubusercontent.com/cca2919af4bc33ce2ebd24b01dc3b34fdf34a57c3790acbaafd582a6b2ed3f48/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4c697665776972657a2f776562617574686e2d6c61726176656c)](https://camo.githubusercontent.com/cca2919af4bc33ce2ebd24b01dc3b34fdf34a57c3790acbaafd582a6b2ed3f48/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4c697665776972657a2f776562617574686e2d6c61726176656c)[![Downloads](https://camo.githubusercontent.com/a3b74c080f6548d6be59294a4eeabef62b571bed4026e98bae72aa495e04f722/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c697665776972657a2f776562617574686e2d6c61726176656c)](https://camo.githubusercontent.com/a3b74c080f6548d6be59294a4eeabef62b571bed4026e98bae72aa495e04f722/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c697665776972657a2f776562617574686e2d6c61726176656c)[![Stars](https://camo.githubusercontent.com/d7c2546430189ba186d29eb44457acc604513267fe57f77ece1895d7eb5b05ab/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f4c697665776972657a2f776562617574686e2d6c61726176656c)](https://camo.githubusercontent.com/d7c2546430189ba186d29eb44457acc604513267fe57f77ece1895d7eb5b05ab/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f4c697665776972657a2f776562617574686e2d6c61726176656c)

Webauthn defines an API enabling the creation and use of strong, attested, scoped, public key-based credentials by web applications, for the purpose of strongly authenticating users.

A laravel package for authenticating with webauthn passkeys on laravel applications. This makes it easier to integrate passkeys for authenticating users.

- [**Sources**](#sources)
- [**Info**](#info)
- [**Installation**](#installation)
- [**Usage**](#usage)
    - [***Basic Usage***](#basic-usage)
        - [**Retrieving a users' passkeys**](#retrieving-passkeys-for-user)
        - [**Creating a Passkey**](#creating-a-passkey)
        - [**Logging in with a Passkey**](#logging-in-with-a-passkey)
- [**Config**](#config)
- [**Events**](#events)
- [**License**](#license)

Sources
-------

[](#sources)

- [Web Authenitcation Guide](https://w3c.github.io/webauthn/#sctn-intro)
- [Web Authentication Api](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API)
- [Webauthn Guide](https://webauthn.guide/#about-webauthn)
- [Webauthn PHP](https://github.com/lbuchs/WebAuthn)

Info
----

[](#info)

- under the hood this package is a wrapper for [Webauthn PHP package](https://github.com/web-auth/webauthn-framework) using [This Documentation](https://webauthn-doc.spomky-labs.com)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require livewirez/webauthn-laravel
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="webauthn-laravel-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="webauthn-laravel-config"
```

Add the `Livewirez\Webauthn\PasskeyAuthenticatable` and `Livewirez\Webauthn\PasskeyAuthenticatableTrait` to any `User` model that implements the `Illuminate\Contracts\Auth\Authenticatable` interface.

Add this package from [Simple Webauthn](https://simplewebauthn.dev/docs/packages/browser)

```
npm install @simplewebauthn/browser
```

which provides to the front end a specific collection of values that the hardware authenticator will understand for "registration" and "authentication".

Usage
-----

[](#usage)

### `Livewirez\Webauthn\PasskeyAuthenticatable` interface

[](#livewirezwebauthnpasskeyauthenticatable-interface)

This interface has methods used to configure the [user entity](https://w3c.github.io/webauthn/#dictionary-user-credential-params)—which is used to generate a pass key during the [`Attestation` phase](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API/Attestation_and_Assertion#attestation).

```
