agent/php/Actions/Auth/RevokeAgentKey.php
Snider ecd47fe3db revert fcb9c189e5
revert fix(agentic): harden TODO workspace write

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-18 11:22:27 +00:00

32 lines
660 B
PHP

<?php
declare(strict_types=1);
namespace Core\Mod\Agentic\Actions\Auth;
use Core\Actions\Action;
use Core\Mod\Agentic\Models\AgentApiKey;
use Core\Mod\Agentic\Services\AgentApiKeyService;
class RevokeAgentKey
{
use Action;
/**
* @throws \InvalidArgumentException
*/
public function handle(int $workspaceId, int $keyId): bool
{
$key = AgentApiKey::query()
->where('workspace_id', $workspaceId)
->find($keyId);
if (! $key) {
throw new \InvalidArgumentException('API key not found');
}
app(AgentApiKeyService::class)->revoke($key);
return true;
}
}