mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-04 22:31:58 +01:00
235 lines
18 KiB
PHP
235 lines
18 KiB
PHP
<?php
|
|
|
|
namespace Tests\Classes;
|
|
|
|
use Illuminate\Http\Testing\File;
|
|
use Tests\Data\MigrationTestData;
|
|
use Tests\Data\OtpTestData;
|
|
|
|
class LocalFileFactory
|
|
{
|
|
/**
|
|
* Create a new local valid qrcode image.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function validQrcode()
|
|
{
|
|
return new File('validQrcode.png', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
$data = 'iVBORw0KGgoAAAANSUhEUgAAAMYAAADFCAYAAAAPD43zAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAABNjSURBVHhe7ZNBjiW5ksT6/pf+A66H5g0TPJ6iuoIAd5RJkYn3z/8+Pj7+H98P4+ND+H4YHx/C98P4+BC+H8bHh/D9MD4+hO+H8fEhfD+Mjw/h+2F8fAjfD+PjQ/h+GB8fwvfD+PgQ6h/GP//880fYYhuTW9g2Po3diS228UZb6hN26RttsY3JLWwbn8buxBbbeKMt9Qm79I222MbkFraNT2N3YottvNGW+oRd+kZbbGNyC9vGp7E7scU23mhLfcIufaMttjG5hW3j09id2GIbb7SlPmGXvtEW25jcwrbxaexObLGNN9pSn7BL8Rb2FkxY+wtbbAOfxu7EhLV4C3sLttQn7FK8hb0FE9b+whbbwKexOzFhLd7C3oIt9Qm7FG9hb8GEtb+wxTbwaexOTFiLt7C3YEt9wi7FW9hbMGHtL2yxDXwauxMT1uIt7C3YUp+wS/EW9hZMWPsLW2wDn8buxIS1eAt7C7bUJ+xSvIW9BRPW/sIW28CnsTsxYS3ewt6CLfUJuxQT1p6YsBYT1mKLbWCLbWCLbWCLbWDCWkxYe2LCWmypT9ilmLD2xIS1mLAWW2wDW2wDW2wDW2wDE9ZiwtoTE9ZiS33CLsWEtScm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lP2KWYsPbEhLX4NHYnJqydfBq7ExPWYsLayYS1mLAWW+oTdikmrD0xYS0+jd2JCWsnn8buxIS1mLB2MmEtJqzFlvqEXYq3sLdgwlpMWDuZsBa3sO1Nt7DtyYS1uEW9ZI/BW9hbMGEtJqydTFiLW9j2plvY9mTCWtyiXrLH4C3sLZiwFhPWTiasxS1se9MtbHsyYS1uUS/ZY/AW9hZMWIsJaycT1uIWtr3pFrY9mbAWt6iX7DF4C3sLJqzFhLWTCWtxC9vedAvbnkxYi1vUS/YYvIW9BRPWYsLayYS1uIVtb7qFbU8mrMUt6iV7zBtNWIsttnFii21MttgGttgGJqzFhLW4Rb1kj3mjCWuxxTZObLGNyRbbwBbbwIS1mLAWt6iX7DFvNGEtttjGiS22MdliG9hiG5iwFhPW4hb1kj3mjSasxRbbOLHFNiZbbANbbAMT1mLCWtyiXrLHvNGEtdhiGye22MZki21gi21gwlpMWItb1Ev2mDeasBZbbOPEFtuYbLENbLENTFiLCWtxi72lj4//EN8P4+ND+H4YHx/C98P4+BC+H8bHh/D9MD4+hO+H8fEhfD+Mjw/h+2F8fAjfD+PjQ/h+GB8f/4///e//AA34NpChWWMSAAAAAElFTkSuQmCC';
|
|
|
|
$data = base64_decode($data);
|
|
|
|
$image = imagecreatefromstring($data);
|
|
imagepng($image);
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local invalid qrcode image.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function invalidQrcode()
|
|
{
|
|
return new File('invalidQrcode.png', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
$data = 'iVBORw0KGgoAAAANSUhEUgAAALcAAAC5CAYAAABqZK7vAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAA7nSURBVHhe7Z07r+RIFcf7vmaB0TyEBAlkRLCEsLyCmS8AGRFfDwiACD7BBCvQgs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pdbM/YcSJaD4s4AAs8VIwQtvuNc/nGtzPZSniXF1Uitb+xtsBZSLpTU8rnktF8OOW2vEUuPlrsQ9MeXBy13gJz6Ipws3+O8Jc9U9ya3fD5auNJY2gFYyxJLj5Z7JCBWbNIBfodNIaatQ8sdIKe+Wri+B7GGDEpLl8/afjnktL1GLD2zuJdOTudM0QRSPm3gGRN3jkCtdcuJq2HtjzHLR7dkYvxB5xCrTWxQ3DPAmZVpoFvSMEUTTOEyTJGHFWt/jFk+Wm5SLVmzJXOhFTnHUizByqQyRX9Y22qK/hjSfrTcpFooblItFDepFoqbVEvx5ffS5ORrHdRo5OShxZ2i/XLqq5FTviW0Cy03qRaKm1QLxU2qheIm1TLb89waOQOOnIFJ6UFN6fRyyGm/0kzdBrTcpFooblItFDepFoqbVEvVA0oNY3WL10Mjp8xTtLPGFGUpBS03qRaKm1QLxU2qheIm1bK5FUprOI2cummUrkdprO1iZYo+cqHlJtVCcZNqobhJtVDcpFqq+Q2ldYBlLfMU6eW0X075piiLNV+NnLK40HKTaqG4SbVQ3KRaKG5SLVkDyrnIGaxoWNObIl+N0gOx0ulZyWnTIWWh5SbVQnGTaqG4SbVQ3KRazANKQtYGLTepFoqbVAvFTaqF4ibVQnGTaqG4SbVQ3KRaKG5SLRQ3qZTd7v8G5qGrfYie5wAAAABJRU5ErkJggg==';
|
|
|
|
$data = base64_decode($data);
|
|
|
|
$image = imagecreatefromstring($data);
|
|
imagepng($image);
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local valid Aegis JSON file.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function validAegisJsonFile()
|
|
{
|
|
return new File('validAegisMigration.json', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
echo MigrationTestData::VALID_AEGIS_JSON_MIGRATION_PAYLOAD;
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local invalid Aegis JSON file.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function invalidAegisJsonFile()
|
|
{
|
|
return new File('invalidAegisMigration.json', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
echo MigrationTestData::INVALID_AEGIS_JSON_MIGRATION_PAYLOAD;
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local encrypted Aegis JSON file.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function encryptedAegisJsonFile()
|
|
{
|
|
return new File('encryptedAegisJsonFile.txt', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
echo MigrationTestData::ENCRYPTED_AEGIS_JSON_MIGRATION_PAYLOAD;
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local valid Plain Text file.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function validPlainTextFile()
|
|
{
|
|
return new File('validPlainTextFile.txt', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
echo OtpTestData::TOTP_FULL_CUSTOM_URI;
|
|
echo PHP_EOL;
|
|
echo OtpTestData::HOTP_FULL_CUSTOM_URI;
|
|
echo PHP_EOL;
|
|
echo OtpTestData::STEAM_TOTP_URI;
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local valid Plain Text file with new lines.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function validPlainTextFileWithNewLines()
|
|
{
|
|
return new File('validPlainTextFileWithNewLines.txt', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
echo PHP_EOL;
|
|
echo OtpTestData::TOTP_FULL_CUSTOM_URI;
|
|
echo PHP_EOL;
|
|
echo PHP_EOL;
|
|
echo OtpTestData::HOTP_FULL_CUSTOM_URI;
|
|
echo PHP_EOL;
|
|
echo PHP_EOL;
|
|
echo OtpTestData::STEAM_TOTP_URI;
|
|
echo PHP_EOL;
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local invalid Plain Text file with no URI.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function invalidPlainTextFileNoUri()
|
|
{
|
|
return new File('invalidPlainTextFileNoUri.txt', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
echo 'lorem ipsum';
|
|
echo PHP_EOL;
|
|
echo 'lorem ipsum';
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local invalid Plain Text file with invalid line.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function invalidPlainTextFileWithInvalidLine()
|
|
{
|
|
return new File('invalidPlainTextFileWithInvalidLine.txt', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
echo OtpTestData::TOTP_FULL_CUSTOM_URI;
|
|
echo PHP_EOL;
|
|
echo 'lorem ipsum';
|
|
echo PHP_EOL;
|
|
echo OtpTestData::HOTP_FULL_CUSTOM_URI;
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local invalid Plain Text file with invalid URI.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function invalidPlainTextFileWithInvalidUri()
|
|
{
|
|
return new File('invalidPlainTextFileWithInvalidUri.txt', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
echo OtpTestData::TOTP_FULL_CUSTOM_URI;
|
|
echo PHP_EOL;
|
|
echo OtpTestData::INVALID_OTPAUTH_URI;
|
|
echo PHP_EOL;
|
|
echo OtpTestData::HOTP_FULL_CUSTOM_URI;
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local empty Plain Text file.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function invalidPlainTextFileEmpty()
|
|
{
|
|
return new File('invalidPlainTextFileEmpty.txt', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
echo '';
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* Create a new local infected SVG file.
|
|
*
|
|
* @return \Illuminate\Http\Testing\File
|
|
*/
|
|
public function infectedSvgIconFile()
|
|
{
|
|
return new File('infectedSvgIcon.svg', tap(tmpfile(), function ($temp) {
|
|
ob_start();
|
|
|
|
echo OtpTestData::ICON_SVG_DATA_INFECTED;
|
|
|
|
fwrite($temp, ob_get_clean());
|
|
}));
|
|
}
|
|
}
|