yubikey-u2f

Introduction

Installation & Setup

{note} yubikey-u2f has been archived and is no longer maintained. Use caution when installing in your apps.

yubikey-u2f can be installed via composer:

composer require rawilk/yubikey-u2f

You may publish the config file like this:

php artisan vendor:publish --tag="yubikey-u2f-config"

See the default configuration values here.

You will need to provide your Yubico API credentials for this package to work. You can either enter your credentials in your .env file, or directly in the config file (not recommended).

Add the following to your .env file:

YUBIKEY_CLIENT_ID=your-client-id
YUBIKEY_SECRET_KEY="your-secret-key"

{tip} See the requirements page for generating an API key.

If you plan to use the table and model provided by this package, you will need to publish and run the package's migrations.

php artisan vendor:publish --tag="yubikey-u2f-migrations"
php artisan migrate

The package provides a model for representing a tied security key with a user account. You may extend our model or use your own model by specifying it in the configuration.

<?php

return [
    ...

    'database' => [
        ...

        'model' => \Rawilk\Yubikey\Models\YubikeyIdentity::class,
    ],
];

{note} If you use your own model, it must implement the \Rawilk\Yubikey\Contracts\YubikeyIdentity interface!

To associate and verify security keys with your user model, you need to add the \Rawilk\Yubikey\Models\HasYubikeys trait to your user model. Be sure to also run the migrations for this package.

When using the provided model from the package, exceptions may be thrown with language lines in them when users try to add the same security key twice to their account. You may publish and modify the language files with this command:

php artisan vendor:publish --tag="yubikey-u2f-translations"
Previous
Requirements