diff options
author | Mario <mario@mariovavti.com> | 2023-05-30 08:36:17 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-05-30 08:36:17 +0000 |
commit | b9812ba06ac16899df2a25f0abf25962ae3273f2 (patch) | |
tree | 35762d0183f5b0c6d866b00cdeebfbae595cfa56 /vendor/spomky-labs/otphp/src/HOTP.php | |
parent | bc6aded074156ec81084334a4d6aa58bc0f37a68 (diff) | |
download | volse-hubzilla-b9812ba06ac16899df2a25f0abf25962ae3273f2.tar.gz volse-hubzilla-b9812ba06ac16899df2a25f0abf25962ae3273f2.tar.bz2 volse-hubzilla-b9812ba06ac16899df2a25f0abf25962ae3273f2.zip |
update composer libs
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); |