address remarks made by MasterOdin

This commit is contained in:
Nicolas CARPi
2023-02-22 18:08:19 +01:00
parent ab76ac71a4
commit 30248a8fb5
3 changed files with 5 additions and 17 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ PHP library for [two-factor (or multi-factor) authentication](http://en.wikipedi
## Requirements
* Requires PHP version >8.1
* Requires PHP version >=8.1
* [cURL](http://php.net/manual/en/book.curl.php) when using the provided `QRServerProvider` (default), `ImageChartsQRCodeProvider` or `QRicketProvider` but you can also provide your own QR-code provider.
* [random_bytes()](http://php.net/manual/en/function.random-bytes.php), [OpenSSL](http://php.net/manual/en/book.openssl.php) or [Hash](http://php.net/manual/en/book.hash.php) depending on which built-in RNG you use (TwoFactorAuth will try to 'autodetect' and use the best available); however: feel free to provide your own (CS)RNG.
-4
View File
@@ -28,10 +28,6 @@ class BaconQrCodeProvider implements IQRCodeProvider
private string|array $foregroundColour = '#000000',
private string $format = 'png',
) {
if (!class_exists(ImagickImageBackEnd::class)) {
throw new RuntimeException('Make sure you are using version 2 of Bacon QR Code');
}
$this->backgroundColour = $this->handleColour($this->backgroundColour);
$this->foregroundColour = $this->handleColour($this->foregroundColour);
$this->format = strtolower($this->format);
+4 -12
View File
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace TestsDependency;
use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
use PHPUnit\Framework\TestCase;
use RobThree\Auth\Algorithm;
use RobThree\Auth\Providers\Qr\BaconQrCodeProvider;
@@ -18,19 +17,12 @@ class BaconQRCodeTest extends TestCase
public function testDependency(): void
{
// php < 7.1 will install an older Bacon QR Code
if (!class_exists(ImagickImageBackEnd::class)) {
$this->expectException(RuntimeException::class);
$qr = new BaconQrCodeProvider(1, '#000', '#FFF', 'svg');
$qr = new BaconQrCodeProvider(1, '#000', '#FFF', 'svg');
} else {
$qr = new BaconQrCodeProvider(1, '#000', '#FFF', 'svg');
$tfa = new TwoFactorAuth('Test&Issuer', 6, 30, Algorithm::Sha1, $qr);
$tfa = new TwoFactorAuth('Test&Issuer', 6, 30, Algorithm::Sha1, $qr);
$data = $this->DecodeDataUri($tfa->getQRCodeImageAsDataUri('Test&Label', 'VMR466AB62ZBOKHE'));
$this->assertEquals('image/svg+xml', $data['mimetype']);
}
$data = $this->DecodeDataUri($tfa->getQRCodeImageAsDataUri('Test&Label', 'VMR466AB62ZBOKHE'));
$this->assertEquals('image/svg+xml', $data['mimetype']);
}
public function testBadTextColour(): void