Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
W

WebAuthn

> 安全
Open source

A simple PHP WebAuthn (FIDO2/Passkey) server library

590 stars0 likes3 views
WebsiteGitHub

About

A simple PHP WebAuthn (FIDO2/Passkey) server library

WebAuthn

A simple PHP WebAuthn (FIDO2) server library

The goal of this project is to provide a small, lightweight, understandable library to protect logins with passkeys, security keys like Yubico or Solo, fingerprint on Android, or Windows Hello.

Manual

See /_test for a simple usage of this library. Check webauthn.lubu.ch for a working example.

Supported attestation statement formats

  • android-key ✅
  • android-safetynet ✅
  • apple ✅
  • fido-u2f ✅
  • none ✅
  • packed ✅
  • tpm ✅

[!NOTE] This library supports authenticators that are signed with an X.509 certificate or that are self-attested. ECDAA is not supported.

Workflow

         JAVASCRIPT            |          SERVER
------------------------------------------------------------
                         REGISTRATION

   window.fetch  ----------------->     getCreateArgs
                                             |
navigator.credentials.create        processCreate
                                             |
      alert ok or fail            getGetArgs
                                             |
navigator.credentials.get         processGet
                                             |
      alert ok or fail       [!TIP]

This is probably what you want to use if you want secure login for a public website.

Indirect attestation

The browser may replace the AAGUID and attestation statement with a more privacy-friendly and/or more easily verifiable version of the same data (for example, by employing an anonymization CA). You cannot validate against any root CA if the browser uses an anonymization certificate. This library sets attestation to indirect if you select multiple formats but don't provide any root CA.

[!TIP] A hybrid solution. Clients may be discouraged by browser warnings, but then you know what device they're using (statistics rulez!).

Direct attestation

The browser provides data about the identificator device, which can be identified uniquely. Users could be tracked across multiple sites. Because of this, the browser may show a warning message about providing this data during registration. This library sets attestation to direct if you select multiple formats and provide root CAs.

[!TIP] This is probably what you want if you know what devices your clients are using and want to ensure that only these devices are used.

Passkeys / Client-side discoverable Credentials

A Client-side discoverable Credential Source is a public key credential source whose credential private key is stored in the authenticator, client, or client device. Such client-side storage requires a resident credential-capable authenticator. This is only supported by FIDO2 hardware, not older U2F hardware.

[!NOTE] Passkeys is a technique that allows sharing credentials stored on the device with other devices. So from a technical standpoint of the server, there is no difference from client-side discoverable credentials. The difference is only that the phone or computer system automatically syncs the credentials between the user’s devices via a cloud service. The cross-device sync of passkeys is managed transparently by the OS.

How does it work?

In a typical server-side key management process, a user initiates a request by entering their username and, in some cases, their password. The server validates the user's credentials and, upon successful authentication, retrieves a list of all public key identifiers associated with that user account. This list is then returned to the authenticator, which selects the first credential identifier it issued and responds with a signature that can be verified using the public key registered during the registration process.

In a client-side key process, the user does not need to provide a username or password. Instead, the authenticator searches its own memory to see if it has saved a key for the relying party (domain). If a key is found, the authentication process proceeds in the same way as it would if the server had sent a list of identifiers. There is no difference in the verification process.

How can I use it with this library?

On registration

When calling WebAuthn\WebAuthn->getCreateArgs, set $requireResidentKey to true to notify the authenticator that it should save the registration in its memory.

On login

When calling WebAuthn\WebAuthn->getGetArgs, don't provide any $credentialIds (the authenticator will look up the IDs in its own memory and return the user ID as userHandle). Set the type of authenticator to hybrid (Passkey scanned via QR Code) and internal (Passkey stored on the device itself).

Disadvantage

The RP ID (= domain) is saved on the authenticator. If an authenticator is lost, it is theoretically possible to find the services it was used against and login there.

Device support

Availability of built-in passkeys that automatically synchronize to all of a user’s devices: (see also passkeys.dev/device-support)

  • Apple iOS 16+ / iPadOS 16+ / macOS Ventura+
  • Android 9+
  • Microsoft Windows 11 23H2+

Requirements

  • PHP >= 8.0 with OpenSSL and Multibyte String
  • Browser with WebAuthn support (Firefox 60+, Chrome 67+, Edge 18+, Safari 13+)
  • PHP Sodium (or Sodium Compat ) for Ed25519 support

Infos about WebAuthn

  • Wikipedia
  • W3C
  • MDN
  • dev.yubico
  • FIDO Alliance
  • passkeys

FIDO2 Hardware

  • Yubico
  • Solo Open Source!
  • Nitrokey
  • Feitan
  • TrustKey
  • Google Titan
  • Egis
  • OneSpan
  • Hypersecu
  • Kensington VeriMark™
  • Token2

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHP2faapple-authenticatorfidofido2

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category安全
PricingOpen source

> Related tools

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.