diff options
author | Mario <mario@mariovavti.com> | 2023-07-11 18:57:18 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-07-11 18:57:18 +0000 |
commit | 63fb8d03929189bfc8cbf53d23cb79984fe2c3cd (patch) | |
tree | b9f74bd8c7721dca7ece251fdbb9a7c4fe9b949a /vendor/spomky-labs/otphp/src/HOTP.php | |
parent | 57796a2f962d045445cbf69237bb3d6786e4d0d4 (diff) | |
parent | 384de0925e502cfa8fe6ca287530ef5529fdff10 (diff) | |
download | volse-hubzilla-63fb8d03929189bfc8cbf53d23cb79984fe2c3cd.tar.gz volse-hubzilla-63fb8d03929189bfc8cbf53d23cb79984fe2c3cd.tar.bz2 volse-hubzilla-63fb8d03929189bfc8cbf53d23cb79984fe2c3cd.zip |
Merge branch '8.6RC'8.6
Diffstat (limited to 'vendor/spomky-labs/otphp/src/HOTP.php')
-rw-r--r-- | vendor/spomky-labs/otphp/src/HOTP.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/vendor/spomky-labs/otphp/src/HOTP.php b/vendor/spomky-labs/otphp/src/HOTP.php index aa5a22754..1588d48aa 100644 --- a/vendor/spomky-labs/otphp/src/HOTP.php +++ b/vendor/spomky-labs/otphp/src/HOTP.php @@ -49,7 +49,7 @@ final class HOTP extends OTP implements HOTPInterface public function getCounter(): int { $value = $this->getParameter('counter'); - is_int($value) || throw new InvalidArgumentException('Invalid "counter" parameter.'); + (is_int($value) && $value >= 0) || throw new InvalidArgumentException('Invalid "counter" parameter.'); return $value; } @@ -83,7 +83,7 @@ final class HOTP extends OTP implements HOTPInterface } /** - * @return array<string, callable> + * @return array<non-empty-string, callable> */ protected function getParameterMap(): array { @@ -97,16 +97,27 @@ final class HOTP extends OTP implements HOTPInterface ]]; } + /** + * @param positive-int $counter + */ private function updateCounter(int $counter): void { $this->setCounter($counter); } + /** + * @param null|0|positive-int $window + */ private function getWindow(null|int $window): int { return abs($window ?? self::DEFAULT_WINDOW); } + /** + * @param non-empty-string $otp + * @param 0|positive-int $counter + * @param null|0|positive-int $window + */ private function verifyOtpWithWindow(string $otp, int $counter, null|int $window): bool { $window = $this->getWindow($window); |