Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Core\Security\Mfa; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | /** |
| 12 | * Interface for Local Vector SVG QR Code Renderer. |
| 13 | * |
| 14 | * Generates local, self-contained SVG QR codes without external CDN dependencies, |
| 15 | * adhering to strict Content-Security-Policy (CSP) and OWASP ASVS guidelines. |
| 16 | * |
| 17 | * @package App\Core\Security\Mfa |
| 18 | */ |
| 19 | interface QrCodeSvgRendererInterface |
| 20 | { |
| 21 | /** |
| 22 | * Renders payload into an inline SVG QR code markup. |
| 23 | * |
| 24 | * @param string $payload Data payload to encode (e.g. otpauth URI). |
| 25 | * @param int $pixelSize Target display width and height in pixels (default 240). |
| 26 | * @param string $foregroundColor Hex or CSS color for modules (default #000000). |
| 27 | * @param string $backgroundColor Hex or CSS color for background (default #ffffff). |
| 28 | * @return string Valid SVG markup. |
| 29 | */ |
| 30 | public function renderSvg( |
| 31 | string $payload, |
| 32 | int $pixelSize = 240, |
| 33 | string $foregroundColor = '#000000', |
| 34 | string $backgroundColor = '#ffffff' |
| 35 | ): string; |
| 36 | |
| 37 | /** |
| 38 | * Generates a base64-encoded Data URL of the SVG QR code for direct HTML img src embedding. |
| 39 | * |
| 40 | * @param string $payload Data payload to encode. |
| 41 | * @param int $pixelSize Target display size. |
| 42 | * @return string data:image/svg+xml;base64,... URI. |
| 43 | */ |
| 44 | public function renderDataUri(string $payload, int $pixelSize = 240): string; |
| 45 | } |