| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Webauthn\Event; |
| 6 |
|
| 7 |
use LogicException; |
| 8 |
use function sprintf; |
| 9 |
use Webauthn\AuthenticatorAttestationResponse; |
| 10 |
use Webauthn\CredentialRecord; |
| 11 |
use Webauthn\PublicKeyCredentialCreationOptions; |
| 12 |
use Webauthn\PublicKeyCredentialSource; |
| 13 |
|
| 14 |
class AuthenticatorAttestationResponseValidationSucceededEvent |
| 15 |
{ |
| 16 |
public function __construct( |
| 17 |
public readonly AuthenticatorAttestationResponse $authenticatorAttestationResponse, |
| 18 |
public readonly PublicKeyCredentialCreationOptions $publicKeyCredentialCreationOptions, |
| 19 |
public readonly string $host, |
| 20 |
public readonly CredentialRecord $credentialRecord |
| 21 |
) { |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public function __get(string $name): mixed |
| 28 |
{ |
| 29 |
if ($name === 'publicKeyCredentialSource') { |
| 30 |
return $this->getPublicKeyCredentialSource(); |
| 31 |
} |
| 32 |
|
| 33 |
throw new LogicException(sprintf('Undefined property: %s::$%s', self::class, $name)); |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
public function getPublicKeyCredentialSource(): PublicKeyCredentialSource |
| 40 |
{ |
| 41 |
if ($this->credentialRecord instanceof PublicKeyCredentialSource) { |
| 42 |
return $this->credentialRecord; |
| 43 |
} |
| 44 |
|
| 45 |
return new PublicKeyCredentialSource( |
| 46 |
$this->credentialRecord->publicKeyCredentialId, |
| 47 |
$this->credentialRecord->type, |
| 48 |
$this->credentialRecord->transports, |
| 49 |
$this->credentialRecord->attestationType, |
| 50 |
$this->credentialRecord->trustPath, |
| 51 |
$this->credentialRecord->aaguid, |
| 52 |
$this->credentialRecord->credentialPublicKey, |
| 53 |
$this->credentialRecord->userHandle, |
| 54 |
$this->credentialRecord->counter, |
| 55 |
$this->credentialRecord->otherUI, |
| 56 |
$this->credentialRecord->backupEligible, |
| 57 |
$this->credentialRecord->backupStatus, |
| 58 |
$this->credentialRecord->uvInitialized, |
| 59 |
); |
| 60 |
} |
| 61 |
} |