Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Finish deprecation of all U2F-specific classes #36

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
More test updates
  • Loading branch information
Firehed committed Oct 27, 2021
commit d5ac233b0c64b25ab9f82b7daa07ac5f84d962db
26 changes: 20 additions & 6 deletions tests/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,24 @@ public function testRegisterDefaultsToTryingEmptyCAList(): void

public function testRegisterThrowsIfChallengeDoesNotMatch(): void
{
// This would have come from a session, database, etc.
$request = (new RegisterRequest())
->setAppId('https://u2f.ericstern.com')
->setChallenge('some-other-challenge');
$challenge = $this->getDefaultRegistrationChallenge();
$response = $this->getDefaultRegistrationResponse([
'getChallenge' => 'some-other-challenge',
]);

$this->expectException(SecurityException::class);
$this->expectExceptionCode(SecurityException::CHALLENGE_MISMATCH);
$this->server->validateRegistration($challenge, $response);
}

public function testRegisterThrowsIfChallengeDoesNotMatchInverse(): void
{
$challenge = new Challenge('some-other-challenge');
$response = $this->getDefaultRegistrationResponse();

$this->expectException(SecurityException::class);
$this->expectExceptionCode(SecurityException::CHALLENGE_MISMATCH);
$this->server->validateRegistration($request, $response);
$this->server->validateRegistration($challenge, $response);
}

public function testRegisterThrowsWithUntrustedDeviceIssuerCertificate(): void
Expand Down Expand Up @@ -345,7 +354,6 @@ public function testRegisterWorksWithCAList(): void
public function testRegisterThrowsWithChangedApplicationParameter(): void
{
$challenge = $this->getDefaultRegistrationChallenge();

$response = $this->getDefaultRegistrationResponse([
'getRpIdHash' => hash('sha256', 'https://some.otherdomain.com', true),
]);
Expand Down Expand Up @@ -655,6 +663,9 @@ public function testRegistrationWithoutCidPubkeyBug14Case2(): void

// -( Helpers )------------------------------------------------------------

/**
* @deprecated
*/
private function getDefaultRegisterRequest(): RegisterRequest
{
// This would have come from a session, database, etc.
Expand Down Expand Up @@ -737,6 +748,9 @@ private function getDefaultRegistrationResponse(array $overrides = []): Registra
return $mock;
}

/**
* @deprecated
*/
private function getDefaultSignRequest(): SignRequest
{
// This would have come from a session, database, etc
Expand Down