@@ -10,6 +10,5 @@ |
||
| 10 | 10 | * @class WebauthnException |
| 11 | 11 | * @package Platine\Webauthn\Exception |
| 12 | 12 | */ |
| 13 | -class WebauthnException extends Exception |
|
| 14 | -{ |
|
| 13 | +class WebauthnException extends Exception { |
|
| 15 | 14 | } |
@@ -11,8 +11,8 @@ |
||
| 11 | 11 | class None extends BaseFormat |
| 12 | 12 | { |
| 13 | 13 | /** |
| 14 | - * {@inheritdoc} |
|
| 15 | - */ |
|
| 14 | + * {@inheritdoc} |
|
| 15 | + */ |
|
| 16 | 16 | public function validateAttestation(string $clientData): bool |
| 17 | 17 | { |
| 18 | 18 | return true; |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | * @class None |
| 9 | 9 | * @package Platine\Webauthn\Attestation\Format |
| 10 | 10 | */ |
| 11 | -class None extends BaseFormat |
|
| 12 | -{ |
|
| 11 | +class None extends BaseFormat { |
|
| 13 | 12 | /** |
| 14 | 13 | * {@inheritdoc} |
| 15 | 14 | */ |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | - * {@inheritdoc} |
|
| 83 | - */ |
|
| 82 | + * {@inheritdoc} |
|
| 83 | + */ |
|
| 84 | 84 | public function getCertificatePem(): string |
| 85 | 85 | { |
| 86 | 86 | $pem = '-----BEGIN CERTIFICATE-----' . "\n"; |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | - * {@inheritdoc} |
|
| 95 | - */ |
|
| 94 | + * {@inheritdoc} |
|
| 95 | + */ |
|
| 96 | 96 | public function validateAttestation(string $clientData): bool |
| 97 | 97 | { |
| 98 | 98 | $publicKey = openssl_pkey_get_public($this->getCertificatePem()); |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * {@inheritdoc} |
|
| 133 | - */ |
|
| 132 | + * {@inheritdoc} |
|
| 133 | + */ |
|
| 134 | 134 | public function validateRootCertificate(array $rootCertificates): bool |
| 135 | 135 | { |
| 136 | 136 | $chain = $this->createX5cChainFile(); |
@@ -12,8 +12,7 @@ |
||
| 12 | 12 | * @class FidoU2F |
| 13 | 13 | * @package Platine\Webauthn\Attestation\Format |
| 14 | 14 | */ |
| 15 | -class FidoU2F extends BaseFormat |
|
| 16 | -{ |
|
| 15 | +class FidoU2F extends BaseFormat { |
|
| 17 | 16 | /** |
| 18 | 17 | * The algorithm used |
| 19 | 18 | * @var int |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | - * {@inheritdoc} |
|
| 92 | - */ |
|
| 91 | + * {@inheritdoc} |
|
| 92 | + */ |
|
| 93 | 93 | public function getCertificatePem(): ?string |
| 94 | 94 | { |
| 95 | 95 | if (empty($this->x5c)) { |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | - * {@inheritdoc} |
|
| 104 | - */ |
|
| 103 | + * {@inheritdoc} |
|
| 104 | + */ |
|
| 105 | 105 | public function validateAttestation(string $clientData): bool |
| 106 | 106 | { |
| 107 | 107 | if (! empty($this->x5c)) { |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | - * {@inheritdoc} |
|
| 116 | - */ |
|
| 115 | + * {@inheritdoc} |
|
| 116 | + */ |
|
| 117 | 117 | public function validateRootCertificate(array $rootCertificates): bool |
| 118 | 118 | { |
| 119 | 119 | if (empty($this->x5c)) { |
@@ -12,8 +12,7 @@ |
||
| 12 | 12 | * @class Packed |
| 13 | 13 | * @package Platine\Webauthn\Attestation\Format |
| 14 | 14 | */ |
| 15 | -class Packed extends BaseFormat |
|
| 16 | -{ |
|
| 15 | +class Packed extends BaseFormat { |
|
| 17 | 16 | /** |
| 18 | 17 | * The algorithm used |
| 19 | 18 | * @var int |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | - * {@inheritdoc} |
|
| 136 | - */ |
|
| 135 | + * {@inheritdoc} |
|
| 136 | + */ |
|
| 137 | 137 | public function getCertificatePem(): ?string |
| 138 | 138 | { |
| 139 | 139 | if (empty($this->x5c)) { |
@@ -144,16 +144,16 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | - * {@inheritdoc} |
|
| 148 | - */ |
|
| 147 | + * {@inheritdoc} |
|
| 148 | + */ |
|
| 149 | 149 | public function validateAttestation(string $clientData): bool |
| 150 | 150 | { |
| 151 | 151 | return $this->validateOverX5C($clientData); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | - * {@inheritdoc} |
|
| 156 | - */ |
|
| 155 | + * {@inheritdoc} |
|
| 156 | + */ |
|
| 157 | 157 | public function validateRootCertificate(array $rootCertificates): bool |
| 158 | 158 | { |
| 159 | 159 | if (empty($this->x5c)) { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $dataToVerify = $this->authenticatorData->getBinary(); |
| 207 | 207 | $dataToVerify .= $clientData; |
| 208 | 208 | |
| 209 | - // Verify that magic is set to TPM_GENERATED_VALUE. |
|
| 209 | + // Verify that magic is set to TPM_GENERATED_VALUE. |
|
| 210 | 210 | if ($this->certInfo->getBytes(0, 4) !== self::TPM_GENERATED_VALUE) { |
| 211 | 211 | throw new WebauthnException('TPM magic value not the same TPM_GENERATED_VALUE'); |
| 212 | 212 | } |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | * @class Tpm |
| 42 | 42 | * @package Platine\Webauthn\Attestation\Format |
| 43 | 43 | */ |
| 44 | -class Tpm extends BaseFormat |
|
| 45 | -{ |
|
| 44 | +class Tpm extends BaseFormat { |
|
| 46 | 45 | public const TPM_GENERATED_VALUE = "\xFF\x54\x43\x47"; |
| 47 | 46 | public const TPM_ST_ATTEST_CERTIFY = "\x80\x17"; |
| 48 | 47 | |
@@ -10,8 +10,7 @@ |
||
| 10 | 10 | * @class WebauthnConfiguration |
| 11 | 11 | * @package Platine\Webauthn |
| 12 | 12 | */ |
| 13 | -class WebauthnConfiguration extends AbstractConfiguration |
|
| 14 | -{ |
|
| 13 | +class WebauthnConfiguration extends AbstractConfiguration { |
|
| 15 | 14 | /** |
| 16 | 15 | * {@inheritdoc} |
| 17 | 16 | */ |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @class Webauthn |
| 26 | 26 | * @package Platine\Webauthn |
| 27 | 27 | */ |
| 28 | -class Webauthn |
|
| 29 | -{ |
|
| 28 | +class Webauthn { |
|
| 30 | 29 | /** |
| 31 | 30 | * The attestation data formats |
| 32 | 31 | * @var array<string> |
@@ -68,8 +67,7 @@ discard block |
||
| 68 | 67 | * @param WebauthnConfiguration $config |
| 69 | 68 | * @param array<string> $allowedFormats |
| 70 | 69 | */ |
| 71 | - public function __construct(WebauthnConfiguration $config, array $allowedFormats = []) |
|
| 72 | - { |
|
| 70 | + public function __construct(WebauthnConfiguration $config, array $allowedFormats = []) { |
|
| 73 | 71 | if (! function_exists('openssl_open')) { |
| 74 | 72 | throw new WebauthnException('OpenSSL module not installed in this platform'); |
| 75 | 73 | } |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | ); |
| 179 | 179 | |
| 180 | 180 | $publicKey = (new PublicKey()) |
| 181 | - ->setUserInfo($userInfo) |
|
| 182 | - ->setRelyingParty($relyingParty) |
|
| 183 | - ->setAuthenticatorSelection($authenticatorSelection) |
|
| 184 | - ->setExcludeCredentials($excludeCredentials) |
|
| 185 | - ->setChallenge($this->createChallenge()) |
|
| 186 | - ->setTimeout($this->config->get('timeout')) |
|
| 187 | - ->setExtensions() |
|
| 188 | - ->addPublicKeys() |
|
| 189 | - ->setAttestation($attestation); |
|
| 181 | + ->setUserInfo($userInfo) |
|
| 182 | + ->setRelyingParty($relyingParty) |
|
| 183 | + ->setAuthenticatorSelection($authenticatorSelection) |
|
| 184 | + ->setExcludeCredentials($excludeCredentials) |
|
| 185 | + ->setChallenge($this->createChallenge()) |
|
| 186 | + ->setTimeout($this->config->get('timeout')) |
|
| 187 | + ->setExtensions() |
|
| 188 | + ->addPublicKeys() |
|
| 189 | + ->setAttestation($attestation); |
|
| 190 | 190 | |
| 191 | 191 | return $publicKey; |
| 192 | 192 | } |
@@ -215,11 +215,11 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $publicKey = (new PublicKey()) |
| 218 | - ->setRelyingPartyId($this->relyingParty->getId()) |
|
| 219 | - ->setAllowCredentials($allowedCredentials) |
|
| 220 | - ->setChallenge($this->createChallenge()) |
|
| 221 | - ->setTimeout($this->config->get('timeout')) |
|
| 222 | - ->setUserVerificationType($userVerificationType); |
|
| 218 | + ->setRelyingPartyId($this->relyingParty->getId()) |
|
| 219 | + ->setAllowCredentials($allowedCredentials) |
|
| 220 | + ->setChallenge($this->createChallenge()) |
|
| 221 | + ->setTimeout($this->config->get('timeout')) |
|
| 222 | + ->setUserVerificationType($userVerificationType); |
|
| 223 | 223 | |
| 224 | 224 | return $publicKey; |
| 225 | 225 | } |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | * @class KeyFormat |
| 9 | 9 | * @package Platine\Webauthn\Enum |
| 10 | 10 | */ |
| 11 | -class KeyFormat extends BaseEnum |
|
| 12 | -{ |
|
| 11 | +class KeyFormat extends BaseEnum { |
|
| 13 | 12 | public const ANDROID_KEY = 'android-key'; |
| 14 | 13 | public const ANDROID_SAFETYNET = 'android-safetynet'; |
| 15 | 14 | public const APPLE = 'apple'; |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | * @class UserVerificationType |
| 9 | 9 | * @package Platine\Webauthn\Enum |
| 10 | 10 | */ |
| 11 | -class UserVerificationType extends BaseEnum |
|
| 12 | -{ |
|
| 11 | +class UserVerificationType extends BaseEnum { |
|
| 13 | 12 | public const REQUIRED = 'required'; |
| 14 | 13 | public const PREFERRED = 'preferred'; |
| 15 | 14 | public const DISCOURAGED = 'discouraged'; |