diff --git a/src/google-authenticator/Security/TwoFactor/Provider/Google/GoogleTotpFactory.php b/src/google-authenticator/Security/TwoFactor/Provider/Google/GoogleTotpFactory.php index 4c6ba6f2..8907b9c5 100644 --- a/src/google-authenticator/Security/TwoFactor/Provider/Google/GoogleTotpFactory.php +++ b/src/google-authenticator/Security/TwoFactor/Provider/Google/GoogleTotpFactory.php @@ -32,6 +32,7 @@ public function createTotpForUser(TwoFactorInterface $user): TOTPInterface throw new TwoFactorProviderLogicException('Cannot initialize TOTP, no secret code provided.'); } + // Compatibility for spomky-labs/otphp version 12 if ((new ReflectionClass(TOTP::class))->hasProperty('clock')) { /** @psalm-suppress ArgumentTypeCoercion */ $totp = TOTP::create($secret, 30, 'sha1', $this->digits, clock: $this->clock); diff --git a/src/totp/Security/TwoFactor/Provider/Totp/TotpFactory.php b/src/totp/Security/TwoFactor/Provider/Totp/TotpFactory.php index bbd1ab3a..b9732790 100644 --- a/src/totp/Security/TwoFactor/Provider/Totp/TotpFactory.php +++ b/src/totp/Security/TwoFactor/Provider/Totp/TotpFactory.php @@ -40,6 +40,7 @@ public function createTotpForUser(TwoFactorInterface $user): TOTPInterface throw new TwoFactorProviderLogicException('Cannot initialize TOTP, no secret code provided.'); } + // Compatibility for spomky-labs/otphp version 12 if ((new ReflectionClass(TOTP::class))->hasProperty('clock')) { /** @psalm-suppress ArgumentTypeCoercion */ $totp = TOTP::create(