From ee200fc0e97e05fe1287bbd672229664d1cd0477 Mon Sep 17 00:00:00 2001 From: Christian Scheb Date: Tue, 18 Jun 2024 19:29:00 +0200 Subject: [PATCH] Add compatibility note --- .../Security/TwoFactor/Provider/Google/GoogleTotpFactory.php | 1 + src/totp/Security/TwoFactor/Provider/Totp/TotpFactory.php | 1 + 2 files changed, 2 insertions(+) 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(