Skip to content

Commit

Permalink
Add compatibility note
Browse files Browse the repository at this point in the history
  • Loading branch information
scheb committed Jun 18, 2024
1 parent 45b730b commit ee200fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/totp/Security/TwoFactor/Provider/Totp/TotpFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ee200fc

Please sign in to comment.