From bba4c207c2af9009379e18922c50a2991953ac1c Mon Sep 17 00:00:00 2001 From: Nicolas CARPi Date: Mon, 15 Apr 2024 21:43:53 +0200 Subject: [PATCH] use global import --- lib/TwoFactorAuth.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/TwoFactorAuth.php b/lib/TwoFactorAuth.php index af917e3..0bc5685 100644 --- a/lib/TwoFactorAuth.php +++ b/lib/TwoFactorAuth.php @@ -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 @@ -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); @@ -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'); @@ -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)