프로바이더 오류 수정

This commit is contained in:
sungro815 2026-02-06 18:58:21 +09:00
parent e1b7951f4c
commit 2b6e097fc1

View File

@ -2,6 +2,7 @@
namespace App\Providers;
use App\Support\LegacyCrypto\CiSeedCrypto;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
@ -17,11 +18,25 @@ class AppServiceProvider extends ServiceProvider
}
$this->app->singleton(CiSeedCrypto::class, function () {
$key = (string) config('legacy.seed_user_key_default', '');
$iv = (string) config('legacy.iv', '');
$key = config('legacy.seed_user_key_default', '');
$iv = config('legacy.iv', []);
if ($key === '' || $iv === '') {
throw new \RuntimeException('legacy crypto config missing (seed_user_key_default/iv)');
// key는 string
if (!is_string($key) || $key === '') {
throw new \RuntimeException('legacy crypto key missing (seed_user_key_default)');
}
// iv는 array (16 bytes)
if (!is_array($iv)) {
throw new \RuntimeException('legacy iv must be array');
}
if (count($iv) !== 16) {
throw new \RuntimeException('legacy iv array must be 16 bytes');
}
foreach ($iv as $b) {
if (!is_int($b) || $b < 0 || $b > 255) {
throw new \RuntimeException('legacy iv array values must be ints 0~255');
}
}
return new CiSeedCrypto($key, $iv);