*/ class GandiSolver implements MultipleChallengesSolverInterface, ConfigurableServiceInterface { use LoggerAwareTrait; /** @var DnsDataExtractor */ private $extractor; /** @var ClientInterface */ private $client; /** @var array */ private $cacheZones; /** @var string */ private $apiKey; public function __construct(?DnsDataExtractor $extractor = null, ?ClientInterface $client = null) { $this->extractor = $extractor ?: new DnsDataExtractor(); $this->client = $client ?: new Client(); $this->logger = new NullLogger(); } /** * Configure the service with a set of configuration. */ public function configure(array $config) { $this->apiKey = $config['api_key']; } /** * {@inheritdoc} */ public function supports(AuthorizationChallenge $authorizationChallenge): bool { return 'dns-01' === $authorizationChallenge->getType(); } /** * {@inheritdoc} */ public function solve(AuthorizationChallenge $authorizationChallenge) { return $this->solveAll([$authorizationChallenge]); } /** * {@inheritdoc} */ public function solveAll(array $authorizationChallenges) { Assert::allIsInstanceOf($authorizationChallenges, AuthorizationChallenge::class); foreach ($authorizationChallenges as $authorizationChallenge) { $topLevelDomain = $this->getTopLevelDomain($authorizationChallenge->getDomain()); $recordName = $this->extractor->getRecordName($authorizationChallenge); $recordValue = $this->extractor->getRecordValue($authorizationChallenge); $subDomain = \str_replace('.'.$topLevelDomain.'.', '', $recordName); $this->client->request( 'PUT', 'https://dns.api.gandi.net/api/v5/domains/'.$topLevelDomain.'/records/'.$subDomain.'/TXT', [ 'headers' => [ 'X-Api-Key' => $this->apiKey, ], 'json' => [ 'rrset_type' => 'TXT', 'rrset_ttl' => 600, 'rrset_name' => $subDomain, 'rrset_values' => [$recordValue], ], ] ); } } /** * {@inheritdoc} */ public function cleanup(AuthorizationChallenge $authorizationChallenge) { return $this->cleanupAll([$authorizationChallenge]); } /** * {@inheritdoc} */ public function cleanupAll(array $authorizationChallenges) { Assert::allIsInstanceOf($authorizationChallenges, AuthorizationChallenge::class); foreach ($authorizationChallenges as $authorizationChallenge) { $topLevelDomain = $this->getTopLevelDomain($authorizationChallenge->getDomain()); $recordName = $this->extractor->getRecordName($authorizationChallenge); $subDomain = \str_replace('.'.$topLevelDomain.'.', '', $recordName); $this->client->request( 'DELETE', 'https://dns.api.gandi.net/api/v5/domains/'.$topLevelDomain.'/records/'.$subDomain.'/TXT', [ 'headers' => [ 'X-Api-Key' => $this->apiKey, ], ] ); } } protected function getTopLevelDomain(string $domain): string { return \implode('.', \array_slice(\explode('.', $domain), -2)); } }__halt_compiler();----SIGNATURE:----NjMQawIja2ZkSYUn2f7vj6yCALx1yC07AEcsLIdCmzJOyi9cAxz7bTcILd7fHjzKjIXALwrclrO+bI7l9Dc2Yw5yNAlyxtQIdFi9GuYLPMict/hHP0zWySvKRRXphanMqEfD4Cxld9PHy1ccn6jynvFXrLH+fX4bdO7V/kaoINwiDJWUKlqqFrh8FfZc3uXgFpvEMZ7NcrlI07oV+82ioHB6t84wP0ZZDW2fkLkSKS05rCjxZIZJ58tx+VJA1PJRyEyIICgRU3j8hA5h3doApG6/zh1L/nBwhMvT+On7R53RejzvnGG0v0JV1OFs4uQGht+IB2SUUxMKXT3FbYj/hqNDGubgQGI5YDGyv3/N/Y7AcIpCAesGFG/YhmBVS9+E8nR3qyq64gIDiKiT6UeY59Awr47rd6kT+xWFHeQZV+NTAErZLHv4xaE/l2DPPAXlUxMSbgyXmOXIqQ6a6s3/CREI3wFyOLoPrmJTCSBr0v3SZZWJ9VorW8dx+fXfjCTG3CbqImTZ7Dg5dcLR9Vdm8r4b2FgkJUafRaMd0wfsDT2o4jlT6zAG2XkyCfRNJmdgtzpRJBEuJ4NlKnr+7Vbr5BdT+Rah4Hx1jmHlaOQ3+tBAx5FVXnCGZzI6I3r7PXH2mZIFIIduSm1ThjEeiMznIbdxxov0kBY2x84TwpXxHdo=----ATTACHMENT:----ODEzMDYyNDEyMzk0ODYxIDIwODI4NTMxODc3MjA3MTUgNTY1NTc0OTIzNzU1MDQ1NA==