sebastiancx / webauthn
PHP的Web Authentication API服务器
v0.0.1
2023-06-24 09:54 UTC
Requires
- php: ^8.1
- ext-json: *
- ext-openssl: *
- ext-sodium: *
- guzzlehttp/guzzle: ^6.5|^7.0
- kevinrob/guzzle-cache-middleware: ^3.3
- psr/cache: ^1.0|^2.0|^3.0
- psr/log: ^1.1|^2.0|^3.0
- sop/asn1: ^4.1
- sop/crypto-bridge: ^0.3.1
- sop/crypto-encoding: ^0.3.0
- sop/crypto-types: ^0.3.0
- sop/x501: ^0.6.1
- sop/x509: ^0.7.0
- symfony/cache: ^4.4|^5.2|^6.0
Requires (Dev)
- phpseclib/phpseclib: ^3.0.1
- phpstan/phpstan: ^0.12.64
- phpunit/phpunit: ^8.5.29
- sebastian/comparator: ^3.0.5
- symfony/console: ^5.2
- symfony/dotenv: ^5.2
- symfony/var-dumper: ^5.2
This package is auto-updated.
Last update: 2024-09-24 12:32:20 UTC
README
当前状态
相对稳定,但API在1.0版本发布前可能还会略有变动。
目标
这个库旨在使用PHP实现WebAuthn规范的依赖方服务器。重要目标包括
- 实现WebAuthn 1级规范
- 高质量的、安全的、可维护的代码
- 对最终用户友好
安装
通过composer安装
composer require sebastiancx/webauthn
支持的功能
-
PHP 8.1
- FIDO兼容的库
- 认证类型
- FIDO U2F
- 打包
- TPM
- Android SafetyNet
- Android Key
- Apple
- 无
- 可选的'不支持'类型,用于处理未来的类型
- 元数据服务支持
- 验证元数据
- 扩展
- appid
用法
由于该库仍在开发中,因此文档有限。遵循的一般模式是
- 实现
CredentialStoreInterface
(您需要UserCredential
或您自己的UserCredentialInterface
实现) - 创建一个
RelyingParty
实例,并使用ServerBuilder
类构建服务器对象
$server = (new ServerBuilder()) ->setRelyingParty($rp) ->setCredentialStore($store) ->build();
- 使用
startRegistration
/finishRegistration
来注册凭证。务必在服务器端存储临时的AttestationContext
! - 以及
startAuthentication
/finishAuthentication
进行认证。务必在服务器端存储临时的AssertionContext
!