百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
W

WebAuthn

> 安全
开源

简单的 PHP WebAuthn (FIDO2/ Passkey) 服务器库

590 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

简单的 PHP WebAuthn (FIDO2/ Passkey) 服务器库

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHP2faapple-authenticatorfidofido2

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类安全
定价开源

> 相关工具

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.