*/ 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:----QtNueLeuL/A5N7fqBzBZWZzorwJRXt4Kuhgq/48loOzE8xc5j1iVXrVYvjfNrd/hG4kwzvd+SLuZkRnoiiFf4UNXEO5V/ilG3twrVbfWOJAcjSPcUydUcOtdZ713/bo6UphHgYBDry82b1r6wFQcwi8iqIEVWVMGTLPFAgQn1oJywhHrfPpndSPvwg4kbwu2FjnfskwLX1Gsmkz7ehNRuREGdlgkvj5qKnoJyqUrm3vVHCXLs8/Pn1MrFTSzqQFk1nri7UohOe6UpeP1oJJhbXdZiwf90du6vFRi3XOYj+M+qWSVacPZJT8/g4r5W6JIul8t7eSGV8KxB69drwBy6lZYpm/TSXfnIySDL51kwT7OjWvVZq8KKwrlkKE6pE77EoA/AUqWR0K7ezVBj9ewjhVbmmRsBYu2skYWydjGC9EK5L+eq7gsd90PL/x28zxYEmc6AbHxeCvvyfWUlSiWJpCEuMYqJUM+aYvMh1iHeZWZp0WyJcbT6OSCWkv6INPRxAiGg8oyhZi1IWAeqtdFbB6d/WTiFPrEF1m6LPHUY0xZ9TtSR/8DQEB6SpBXETih+TfOtYcNarhQ++dCVjyt2pDm0l252hBRCekvGQYtlOwoN3e/Rs+sA+f3KRnJkIQfDHgDrfEBt32gco4eUshtzMCfjfTUWkFAshlsB8QVH48=----ATTACHMENT:----MTgwNTg3MjY1MDA2NjQzIDY4OTIzMTcxODE5NjM4MSA0NTgzOTEzMjk5MzAyNDM0