| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Webauthn; |
| 6 | |
| 7 | /** |
| 8 | * Represents the Passkey Endpoints response as defined in the W3C Passkey Endpoints specification. |
| 9 | * |
| 10 | * @see https://w3c.github.io/webappsec-passkey-endpoints/ |
| 11 | */ |
| 12 | final readonly class PasskeyEndpointsResponse |
| 13 | { |
| 14 | /** |
| 15 | * @param null|Url $enroll URL to the passkey enrollment/creation interface |
| 16 | * @param null|Url $manage URL to the passkey management interface |
| 17 | * @param null|Url $prfUsageDetails URL to informational page about PRF (Pseudo-Random Function) extension usage |
| 18 | */ |
| 19 | public function __construct( |
| 20 | public null|Url $enroll = null, |
| 21 | public null|Url $manage = null, |
| 22 | public null|Url $prfUsageDetails = null, |
| 23 | ) { |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * @param null|Url $enroll URL to the passkey enrollment/creation interface |
| 28 | * @param null|Url $manage URL to the passkey management interface |
| 29 | * @param null|Url $prfUsageDetails URL to informational page about PRF extension usage |
| 30 | */ |
| 31 | public static function create( |
| 32 | null|Url $enroll = null, |
| 33 | null|Url $manage = null, |
| 34 | null|Url $prfUsageDetails = null, |
| 35 | ): self { |
| 36 | return new self($enroll, $manage, $prfUsageDetails); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Creates an empty response indicating passkey support without exposing specific endpoints. |
| 41 | */ |
| 42 | public static function createEmpty(): self |
| 43 | { |
| 44 | return new self(); |
| 45 | } |
| 46 | } |