From b9812ba06ac16899df2a25f0abf25962ae3273f2 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 30 May 2023 08:36:17 +0000 Subject: update composer libs --- vendor/spomky-labs/otphp/src/HOTP.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'vendor/spomky-labs/otphp/src/HOTP.php') 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 + * @return array */ 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); -- cgit v1.2.3