Skip to content

Commit

Permalink
use global import
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasCARPi committed Apr 15, 2024
1 parent 061a2a3 commit bba4c20
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/TwoFactorAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use RobThree\Auth\Providers\Time\ITimeProvider;
use RobThree\Auth\Providers\Time\LocalMachineTimeProvider;
use RobThree\Auth\Providers\Time\NTPTimeProvider;
use SensitiveParameter;

// Based on / inspired by: https://github.com/PHPGangsta/GoogleAuthenticator
// Algorithms, digits, period etc. explained: https://github.com/google/google-authenticator/wiki/Key-Uri-Format
Expand Down Expand Up @@ -69,7 +70,7 @@ public function createSecret(int $bits = 80, bool $requirecryptosecure = true):
/**
* Calculate the code with given secret and point in time
*/
public function getCode(#[\SensitiveParameter] string $secret, ?int $time = null): string
public function getCode(#[SensitiveParameter] string $secret, ?int $time = null): string
{
$secretkey = $this->base32Decode($secret);

Expand Down Expand Up @@ -107,7 +108,7 @@ public function verifyCode(string $secret, string $code, int $discrepancy = 1, ?
/**
* Get data-uri of QRCode
*/
public function getQRCodeImageAsDataUri(string $label, #[\SensitiveParameter] string $secret, int $size = 200): string
public function getQRCodeImageAsDataUri(string $label, #[SensitiveParameter] string $secret, int $size = 200): string
{
if ($size <= 0) {
throw new TwoFactorAuthException('Size must be > 0');
Expand Down Expand Up @@ -153,7 +154,7 @@ public function ensureCorrectTime(?array $timeproviders = null, int $leniency =
/**
* Builds a string to be encoded in a QR code
*/
public function getQRText(string $label, #[\SensitiveParameter] string $secret): string
public function getQRText(string $label, #[SensitiveParameter] string $secret): string
{
return 'otpauth://totp/' . rawurlencode($label)
. '?secret=' . rawurlencode($secret)
Expand Down

0 comments on commit bba4c20

Please sign in to comment.