Server IP : 104.21.14.103 / Your IP : 3.144.17.193 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/giankuin/dietcontrungnhanh.com/wp-content/plugins/ithemes-security-pro/pro/webauthn/DTO/ |
Upload File : |
<?php namespace iThemesSecurity\WebAuthn\DTO; use iThemesSecurity\Strauss\Assert\Assert; /** * @template T of AuthenticatorResponse */ final class PublicKeyCredential implements \JsonSerializable { /** @var BinaryString */ protected $id; /** * A member of {@see PublicKeyCredentialType}. * * @var string */ protected $type; /** @var AuthenticatorResponse */ protected $response; public function __construct( BinaryString $id, string $type, AuthenticatorResponse $response ) { Assert::that( $type ) ->choice( PublicKeyCredentialType::ALL, 'type "%s" is not an element of the valid values: %s' ); $this->id = $id; $this->type = $type; $this->response = $response; } /** * Hydrates a Credential for an attestation response. * * @param array $data * * @return PublicKeyCredential<AuthenticatorAttestationResponse> */ public static function hydrateAttestation( array $data ): self { return self::hydrate( $data, AuthenticatorAttestationResponse::class ); } /** * Hydrates a Credential for an assertion response. * * @param array $data * * @return PublicKeyCredential<AuthenticatorAssertionResponse> */ public static function hydrateAssertion( array $data ): self { return self::hydrate( $data, AuthenticatorAssertionResponse::class ); } /** * Hydrates a Credential. * * @param array $data * @param class-string<AuthenticatorResponse> $response_type * * @return static */ protected static function hydrate( array $data, string $response_type ): self { Assert::that( $data, 'PublicKeyCredential hydration does not contain "%s".' ) ->keyExists( 'id' ) ->keyExists( 'type' ) ->keyExists( 'response' ); return new self( BinaryString::from_ascii_fast( $data['id'] ), $data['type'], $response_type::hydrate( $data['response'] ) ); } public function get_id(): BinaryString { return $this->id; } public function get_type(): string { return $this->type; } /** @return T */ public function get_response(): AuthenticatorResponse { return $this->response; } public function jsonSerialize(): array { return \ITSEC_Lib::recursively_json_serialize( get_object_vars( $this ) ); } }