madwizard-org / webauthn-server

WebAuthn Relying Party server library for PHP
MIT License
51 stars 12 forks source link
2fa fido fido-u2f fido2 php relying-party two-factor-authentication u2f webauthn

WebAuthn Relying Party server library for PHP

Scrutinizer Code Quality Code Coverage Build Status License: MIT

Current state

Pretty stable but the API may still change slightly until the 1.0 release.

Goal

This library aims to implement the relying party server of the WebAuthn specification in PHP. Important goals are:

Installation

Installation via composer:

composer require madwizard/webauthn

Supported features

Usage

The library is still in development so documentation is limited. The general pattern to follow is:

  1. Implement CredentialStoreInterface (you will need UserCredential or your own implementation of UserCredentialInterface)
  2. Create an instance of RelyingParty and use the ServerBuilder class to build a server object:
    $server = (new ServerBuilder())
    ->setRelyingParty($rp)
    ->setCredentialStore($store)
    ->build();
  3. Use startRegistration/finishRegistration to register credentials. Be sure to store the temporary AttestationContext server side!
  4. and startAuthentication/finishAuthentication to authenticate. Be sure to store the temporary AssertionContext server side!

Resources

WebAuthn specification