-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TOTP: introduce new interface that prevents code reuse
- Loading branch information
Showing
3 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OTPHP; | ||
|
||
interface OTPWithPreviousTimestampInterface extends OTPInterface | ||
{ | ||
/** | ||
* Verify method which prevents previously used codes from being used again. The passed values are in seconds. | ||
* | ||
* @param non-empty-string $otp | ||
* @param null|0|positive-int $timestamp | ||
* @param null|0|positive-int $leeway | ||
* @param null|0|positive-int $previousTimestamp | ||
* @return int|false the timestamp matching the otp on success, and false on error | ||
*/ | ||
public function verifyWithPreviousTimestamp(string $otp, null|int $timestamp = null, null|int $leeway = null, null|int $previousTimestamp = null): int|false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters