@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function __construct(WebauthnConfiguration $config, array $allowedFormats = []) |
| 101 | 101 | { |
| 102 | - if (! function_exists('openssl_open')) { |
|
| 102 | + if (!function_exists('openssl_open')) { |
|
| 103 | 103 | throw new WebauthnException('OpenSSL module not installed in this platform'); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if (! in_array('SHA256', array_map('strtoupper', openssl_get_md_methods()))) { |
|
| 106 | + if (!in_array('SHA256', array_map('strtoupper', openssl_get_md_methods()))) { |
|
| 107 | 107 | throw new WebauthnException('SHA256 is not supported by this OpenSSL installation'); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | ): array { |
| 245 | 245 | $clientDataHash = hash('sha256', $clientDataJson, true); |
| 246 | 246 | if (is_string($challenge)) { |
| 247 | - $challenge = new ByteBuffer($challenge); |
|
| 247 | + $challenge = new ByteBuffer($challenge); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // security: https://www.w3.org/TR/webauthn/#registering-a-new-credential |
@@ -257,21 +257,21 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // 3. Verify that the value of C.type is webauthn.create. |
| 260 | - if (! isset($clientData->type) || $clientData->type !== 'webauthn.create') { |
|
| 260 | + if (!isset($clientData->type) || $clientData->type !== 'webauthn.create') { |
|
| 261 | 261 | throw new WebauthnException('Invalid client type provided'); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | // 4. Verify that the value of C.challenge matches the challenge that was |
| 265 | 265 | // sent to the authenticator in the create() call. |
| 266 | 266 | if ( |
| 267 | - ! isset($clientData->challenge) || |
|
| 267 | + !isset($clientData->challenge) || |
|
| 268 | 268 | ByteBuffer::fromBase64Url($clientData->challenge)->getBinaryString() !== $challenge->getBinaryString() |
| 269 | 269 | ) { |
| 270 | 270 | throw new WebauthnException('Invalid challenge provided'); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // 5. Verify that the value of C.origin matches the Relying Party's origin. |
| 274 | - if (! isset($clientData->origin) || $this->checkOrigin($clientData->origin) === false) { |
|
| 274 | + if (!isset($clientData->origin) || $this->checkOrigin($clientData->origin) === false) { |
|
| 275 | 275 | throw new WebauthnException('Invalid origin provided'); |
| 276 | 276 | } |
| 277 | 277 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | bool $requireUserPresent = true |
| 361 | 361 | ): bool { |
| 362 | 362 | if (is_string($challenge)) { |
| 363 | - $challenge = new ByteBuffer($challenge); |
|
| 363 | + $challenge = new ByteBuffer($challenge); |
|
| 364 | 364 | } |
| 365 | 365 | $clientDataHash = hash('sha256', $clientDataJson, true); |
| 366 | 366 | $authenticator = new AuthenticatorData($authenticatorData); |
@@ -388,21 +388,21 @@ discard block |
||
| 388 | 388 | // -> TO BE LOOKED UP BY IMPLEMENTATION |
| 389 | 389 | |
| 390 | 390 | // 7. Verify that the value of C.type is the string webauthn.get. |
| 391 | - if (! isset($clientData->type) || $clientData->type !== 'webauthn.get') { |
|
| 391 | + if (!isset($clientData->type) || $clientData->type !== 'webauthn.get') { |
|
| 392 | 392 | throw new WebauthnException('Invalid client type provided'); |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | // 8. Verify that the value of C.challenge matches the challenge that was sent to the |
| 396 | 396 | // authenticator in the PublicKeyCredentialRequestOptions passed to the get() call. |
| 397 | 397 | if ( |
| 398 | - ! isset($clientData->challenge) || |
|
| 398 | + !isset($clientData->challenge) || |
|
| 399 | 399 | ByteBuffer::fromBase64Url($clientData->challenge)->getBinaryString() !== $challenge->getBinaryString() |
| 400 | 400 | ) { |
| 401 | 401 | throw new WebauthnException('Invalid challenge provided'); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | // 9. Verify that the value of C.origin matches the Relying Party's origin. |
| 405 | - if (! isset($clientData->origin) || $this->checkOrigin($clientData->origin) === false) { |
|
| 405 | + if (!isset($clientData->origin) || $this->checkOrigin($clientData->origin) === false) { |
|
| 406 | 406 | throw new WebauthnException('Invalid origin provided'); |
| 407 | 407 | } |
| 408 | 408 | |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | // The origin's scheme must be https and not be ignored/whitelisted |
| 492 | 492 | $url = new Uri($origin); |
| 493 | 493 | if ( |
| 494 | - ! in_array($this->relyingParty->getId(), $this->config->get('ignore_origins')) && |
|
| 494 | + !in_array($this->relyingParty->getId(), $this->config->get('ignore_origins')) && |
|
| 495 | 495 | $url->getScheme() !== 'https' |
| 496 | 496 | ) { |
| 497 | 497 | return false; |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | return $supportedFormats; |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | - $desiredFormats = array_filter($formats, function ($entry) use ($supportedFormats) { |
|
| 531 | + $desiredFormats = array_filter($formats, function($entry) use ($supportedFormats) { |
|
| 532 | 532 | return in_array($entry, $supportedFormats); |
| 533 | 533 | }); |
| 534 | 534 | |