| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Jose\Component\Console; |
| 6 | |
| 7 | use Jose\Component\KeyManagement\JWKFactory; |
| 8 | use Symfony\Component\Console\Attribute\AsCommand; |
| 9 | use Symfony\Component\Console\Input\InputInterface; |
| 10 | use Symfony\Component\Console\Output\OutputInterface; |
| 11 | |
| 12 | #[AsCommand( |
| 13 | name: 'key:generate:none', |
| 14 | description: 'Generate a none key (JWK format). This key type is only supposed to be used with the "none" algorithm.', |
| 15 | )] |
| 16 | final class NoneKeyGeneratorCommand extends GeneratorCommand |
| 17 | { |
| 18 | protected static $defaultName = 'key:generate:none'; |
| 19 | |
| 20 | protected static $defaultDescription = 'Generate a none key (JWK format). This key type is only supposed to be used with the "none" algorithm.'; |
| 21 | |
| 22 | protected function configure(): void |
| 23 | { |
| 24 | parent::configure(); |
| 25 | } |
| 26 | |
| 27 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 28 | { |
| 29 | $args = $this->getOptions($input); |
| 30 | |
| 31 | $jwk = JWKFactory::createNoneKey($args); |
| 32 | $this->prepareJsonOutput($input, $output, $jwk); |
| 33 | |
| 34 | return self::SUCCESS; |
| 35 | } |
| 36 | } |