diff --git a/doc/UPGRADE_v10-v11.md b/doc/UPGRADE_v10-v11.md index 08b102746f88e6311f3b8dca790e34a27d489301..df08eda04206783bc413f9fc3fecb5f7758fd296 100644 --- a/doc/UPGRADE_v10-v11.md +++ b/doc/UPGRADE_v10-v11.md @@ -1 +1,3 @@ # Upgrade from `v10.x` to `v11.x` + +Congratulation, you have nothing to do! \ No newline at end of file diff --git a/doc/index.md b/doc/index.md index eb10280b4bb015505debc90e925b7df946494193..1b0001122556d60d75c214690bb43af4c44955d6 100644 --- a/doc/index.md +++ b/doc/index.md @@ -18,10 +18,8 @@ Support for the version 9 will end when PHP 7.1 will not be maintained (1 Dec 20 # Prerequisites -This library needs at least `PHP 7.1` for v9.0 and `PHP 7.2` for v10.0. -It has been successfully tested using `PHP 7.1`, `PHP 7.2`, `PHP 7.3`. - -Nightly branch (`PHP 8.0`) fails as dependencies are not yet compatible. +This library needs at least `PHP 8.0`. +It has been successfully tested using `PHP 8.0` and `PHP 8.1`. # Installation @@ -31,13 +29,6 @@ The preferred way to install this library is to rely on Composer: composer require spomky-labs/otphp ``` -By default, documentation and test environment are excluded. -If you want to test the library or get the documentation, please add `--prefer-source` option: - -```sh -composer require spomky-labs/otphp --prefer-source -``` - # TOTP or HOTP? This library supports both `TOTP` and `HOTP`. @@ -107,3 +98,4 @@ $otp->verify($input); // Returns true if the input is verified, otherwise false. * [From `v8.3` to `v9.x`](UPGRADE_v8-v9.md) * [From `v9.x` to `v10.x`](UPGRADE_v9-v10.md) +* [From `v10.x` to `v11.x`](UPGRADE_v10-v11.md) diff --git a/src/HOTP.php b/src/HOTP.php index 7c941877223dfb28c082e1329e39f5f559d03350..573ae463fe677d014c2c41a6785af9ac4059e7d9 100644 --- a/src/HOTP.php +++ b/src/HOTP.php @@ -41,7 +41,7 @@ final class HOTP extends OTP implements HOTPInterface /** * If the counter is not provided, the OTP is verified at the actual counter. */ - public function verify(string $otp, null|int $counter = null, null|int|float $window = null): bool + public function verify(string $otp, null|int $counter = null, null|int $window = null): bool { Assertion::greaterOrEqualThan($counter, 0, 'The counter must be at least 0.'); @@ -81,12 +81,12 @@ final class HOTP extends OTP implements HOTPInterface $this->setCounter($counter); } - private function getWindow(null|int|float $window): int|float + private function getWindow(null|int $window): int { return abs($window ?? 0); } - private function verifyOtpWithWindow(string $otp, int $counter, null|int|float $window): bool + private function verifyOtpWithWindow(string $otp, int $counter, null|int $window): bool { $window = $this->getWindow($window); diff --git a/src/OTPInterface.php b/src/OTPInterface.php index 0d8d888d82b4f7245a71800fe3b6fdcbd22069b4..38f1db4a229fb871f65b4a1ea265e1227d478dea 100644 --- a/src/OTPInterface.php +++ b/src/OTPInterface.php @@ -15,7 +15,7 @@ interface OTPInterface * Verify that the OTP is valid with the specified input. If no input is provided, the input is set to a default * value or false is returned. */ - public function verify(string $otp, null|int $input = null, null|int|float $window = null): bool; + public function verify(string $otp, null|int $input = null, null|int $window = null): bool; /** * @return string The secret of the OTP diff --git a/src/TOTP.php b/src/TOTP.php index 2adf41f6a37a5dab6d4392e47a58b075a2364158..bba3f436becf3b332487636f81c0814fe17ce909 100644 --- a/src/TOTP.php +++ b/src/TOTP.php @@ -55,7 +55,7 @@ final class TOTP extends OTP implements TOTPInterface /** * If no timestamp is provided, the OTP is verified at the actual timestamp. */ - public function verify(string $otp, null|int $timestamp = null, null|int|float $window = null): bool + public function verify(string $otp, null|int $timestamp = null, null|int $window = null): bool { $timestamp = $this->getTimestamp($timestamp); @@ -126,7 +126,7 @@ final class TOTP extends OTP implements TOTPInterface $this->setParameter('epoch', $epoch); } - private function verifyOtpWithWindow(string $otp, int $timestamp, int|float $window): bool + private function verifyOtpWithWindow(string $otp, int $timestamp, int $window): bool { $window = abs($window);