Version 0.7.0 #1

Merged
kor-elf merged 90 commits from develop into main 2023-12-08 21:18:23 +06:00
3 changed files with 32 additions and 0 deletions
Showing only changes of commit c3e4c68a41 - Show all commits

View File

@ -0,0 +1,9 @@
<?php declare(strict_types=1);
namespace App\Contracts;
interface CryptographyContract
{
public function encrypt(string $text): string;
public function decrypt(string $encryptedText): string;
}

View File

@ -10,8 +10,10 @@ use App\Captcha\Images\Body;
use App\Captcha\Images\Head;
use App\Captcha\Images\ImageManager;
use App\Captcha\Images\Lines;
use App\Contracts\CryptographyContract;
use App\Services\Api\V1\CaptchaGenerateService;
use App\Services\CaptchaToken\CaptchaTokenHandler;
use App\Services\CryptographyString;
use App\Services\GenerateTokenCommand\GenerateTokenUlidCommand;
use App\Services\GenerateTokenCommand\GenerateTokenUuidCommand;
use App\Services\Search\CreateSearchInstanceCommand;
@ -35,6 +37,8 @@ final class AppServiceProvider extends ServiceProvider
$this->app->bind(ImageBody::class, Body::class);
$this->app->bind(ImageLines::class, Lines::class);
$this->app->bind(CryptographyContract::class, CryptographyString::class);
$this->app->bind(CreateSearchInstanceCommand::class, function () {
return new CreateSearchInstanceCommand(Search::class);
});

View File

@ -0,0 +1,19 @@
<?php declare(strict_types=1);
namespace App\Services;
use App\Contracts\CryptographyContract;
use Illuminate\Support\Facades\Crypt;
final class CryptographyString implements CryptographyContract
{
public function encrypt(string $text): string
{
return Crypt::encryptString($text);
}
public function decrypt(string $encryptedText): string
{
return Crypt::decryptString($encryptedText);
}
}