lthn.io/app/Mod/Chain/Boot.php
Claude 994fa0733f
feat(names): API auth + rate limiting on write endpoints
- Bearer token auth middleware on POST /register and /records
- Throttle: 10 registrations/min, 20 DNS updates/min
- Token configurable via API_TOKEN env var (disabled when empty)
- Daemon alias validation: a-z 0-9 . - up to 255 chars

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 03:44:53 +01:00

26 lines
611 B
PHP

<?php
declare(strict_types=1);
namespace Mod\Chain;
use Core\Events\WebRoutesRegistering;
use Mod\Chain\Services\DaemonRpc;
use Mod\Chain\Services\WalletRpc;
class Boot
{
public static array $listens = [
WebRoutesRegistering::class => 'onBoot',
];
public function onBoot(): void
{
app('config')->set('chain', require __DIR__ . '/config.php');
app()->singleton(DaemonRpc::class);
app()->singleton(WalletRpc::class);
// Register API auth middleware
app('router')->aliasMiddleware('auth.api', \App\Http\Middleware\ApiTokenAuth::class);
}
}