| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Webauthn\CeremonyStep; |
| 6 |
|
| 7 |
use function trigger_deprecation; |
| 8 |
use Webauthn\AuthenticatorAssertionResponse; |
| 9 |
use Webauthn\AuthenticatorAttestationResponse; |
| 10 |
use Webauthn\CredentialRecord; |
| 11 |
use Webauthn\PublicKeyCredentialCreationOptions; |
| 12 |
use Webauthn\PublicKeyCredentialRequestOptions; |
| 13 |
use Webauthn\PublicKeyCredentialSource; |
| 14 |
|
| 15 |
final readonly class CeremonyStepManager |
| 16 |
{ |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
public function __construct( |
| 21 |
private array $steps |
| 22 |
) { |
| 23 |
} |
| 24 |
|
| 25 |
public function process( |
| 26 |
CredentialRecord $credentialRecord, |
| 27 |
AuthenticatorAssertionResponse|AuthenticatorAttestationResponse $authenticatorResponse, |
| 28 |
PublicKeyCredentialRequestOptions|PublicKeyCredentialCreationOptions $publicKeyCredentialOptions, |
| 29 |
?string $userHandle, |
| 30 |
string $host |
| 31 |
): void { |
| 32 |
if ($credentialRecord instanceof PublicKeyCredentialSource) { |
| 33 |
trigger_deprecation( |
| 34 |
'web-auth/webauthn-lib', |
| 35 |
'5.3', |
| 36 |
'Passing a PublicKeyCredentialSource to "%s::process()" is deprecated, pass a CredentialRecord instead.', |
| 37 |
self::class |
| 38 |
); |
| 39 |
} |
| 40 |
|
| 41 |
foreach ($this->steps as $step) { |
| 42 |
$step->process( |
| 43 |
$credentialRecord, |
| 44 |
$authenticatorResponse, |
| 45 |
$publicKeyCredentialOptions, |
| 46 |
$userHandle, |
| 47 |
$host |
| 48 |
); |
| 49 |
} |
| 50 |
} |
| 51 |
} |