|
14 | 14 | use RobThree\Auth\Providers\Time\ITimeProvider;
|
15 | 15 | use RobThree\Auth\Providers\Time\LocalMachineTimeProvider;
|
16 | 16 | use RobThree\Auth\Providers\Time\NTPTimeProvider;
|
| 17 | +use SensitiveParameter; |
17 | 18 |
|
18 | 19 | // Based on / inspired by: https://github.com/PHPGangsta/GoogleAuthenticator
|
19 | 20 | // 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):
|
69 | 70 | /**
|
70 | 71 | * Calculate the code with given secret and point in time
|
71 | 72 | */
|
72 |
| - public function getCode(#[\SensitiveParameter] string $secret, ?int $time = null): string |
| 73 | + public function getCode(#[SensitiveParameter] string $secret, ?int $time = null): string |
73 | 74 | {
|
74 | 75 | $secretkey = $this->base32Decode($secret);
|
75 | 76 |
|
@@ -107,7 +108,7 @@ public function verifyCode(string $secret, string $code, int $discrepancy = 1, ?
|
107 | 108 | /**
|
108 | 109 | * Get data-uri of QRCode
|
109 | 110 | */
|
110 |
| - public function getQRCodeImageAsDataUri(string $label, #[\SensitiveParameter] string $secret, int $size = 200): string |
| 111 | + public function getQRCodeImageAsDataUri(string $label, #[SensitiveParameter] string $secret, int $size = 200): string |
111 | 112 | {
|
112 | 113 | if ($size <= 0) {
|
113 | 114 | throw new TwoFactorAuthException('Size must be > 0');
|
@@ -153,7 +154,7 @@ public function ensureCorrectTime(?array $timeproviders = null, int $leniency =
|
153 | 154 | /**
|
154 | 155 | * Builds a string to be encoded in a QR code
|
155 | 156 | */
|
156 |
| - public function getQRText(string $label, #[\SensitiveParameter] string $secret): string |
| 157 | + public function getQRText(string $label, #[SensitiveParameter] string $secret): string |
157 | 158 | {
|
158 | 159 | return 'otpauth://totp/' . rawurlencode($label)
|
159 | 160 | . '?secret=' . rawurlencode($secret)
|
|
0 commit comments