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

Commit

Permalink
Create ChallengeProviderInterface (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Firehed committed Oct 26, 2021
1 parent e2b7d9e commit d08126c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.0] - Unreleased

### Added
- ChallengeProviderInterface (will replace ChallengeProvider)

### Deprecated
- ChallengeProvider


## [1.2.0] - 2021-10-26
### Added
- Support for WebAuthn protocols and APIs
7 changes: 5 additions & 2 deletions src/ChallengeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

namespace Firehed\U2F;

interface ChallengeProvider
/**
* @deprecated This will be removed in the next major version. Use
* ChallengeProviderInterface instead.
*/
interface ChallengeProvider extends ChallengeProviderInterface
{
public function getChallenge(): string;
}
10 changes: 10 additions & 0 deletions src/ChallengeProviderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Firehed\U2F;

interface ChallengeProviderInterface
{
public function getChallenge(): string;
}
6 changes: 3 additions & 3 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,11 @@ private function validateRelyingParty(string $rpIdHash): void
* user-provided value. A mismatch will throw a SE. Future
* versions may also enforce a timing window.
*
* @param ChallengeProvider $from source of known challenge
* @param ChallengeProvider $to user-provided value
* @param ChallengeProviderInterface $from source of known challenge
* @param ChallengeProviderInterface $to user-provided value
* @throws SE on failure
*/
private function validateChallenge(ChallengeProvider $from, ChallengeProvider $to): void
private function validateChallenge(ChallengeProviderInterface $from, ChallengeProviderInterface $to): void
{
// Note: strictly speaking, this shouldn't even be targetable as
// a timing attack. However, this opts to be proactive, and also
Expand Down

0 comments on commit d08126c

Please sign in to comment.