*/ 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:----avad/hcsOIkAJXN2N+xIbv2TGvSw+HGWMTrniF76WC0f25TdHpcjBzp8dRFc+4qdVCvpu36gQu2YVMoJjqvK0c9Yz1HAYUCGZM8Gy5N8X0STAEIcO8susahjjBsbsN/BCsVcUtKBLX+Dn2yKwIUq73ttHqvU367Gwy9k7Td2KpOt3crqA16+k9kT+Mq7G6OhwfuITCQl+KmYLb9PJf3YYhtX1WS3tZeG/XnjYn87pG12lSkkDpbuRr63PXmEM3E+wDfEiD6sibAxpbGwSMcnRSXb5dGe1hJptiKJiakG0Nd3cinG4o+FIFnZwiJOfR4nHtrImz8ce5+wGyY7I2Ai0u68TbCSKe75F7GXypoiDaTqIvs+YjUPI7Zi+ggLNm0s2dMHF6sIS7hys33eyQNVPjsYDD0iNBWnUjWoaVmIT4Ak/JW6vTekmiZWWt5+FJYq/QYdzxA5EeRu8jLbw4/q+efmaILhFyJUoxT7oiTMhdC54UVEl41e0vkmCjHqhHlM93yWJwKu2fIb0hXR3j3YjcxJQ1XH5tCykhjzZyr1Dw55bQls05vlPkTXs3vDs4stvoAd/zPM5plFt0Tsol+euDw2H+ML/4RtX/E0K95uOsJ2afb264W4G7O/4zGrqfku3RXFztwiWPxMgQBmZrqeviyiVojsF8WQ0v/2S/GTMB8=----ATTACHMENT:----MzIwMzgyODM5NDg4NDA5MyAzNzE3NTY1MTQ1MzEzODYzIDExMzc3MjAzOTMyNzY0NzQ=