*/ class GandiSolver implements MultipleChallengesSolverInterface, ConfigurableServiceInterface { use LoggerAwareTrait; /** @var DnsDataExtractor */ private $extractor; /** @var ClientInterface */ private $client; /** @var array */ private $cacheZones; /** @var string */ private $apiKey; /** * @param DnsDataExtractor $extractor * @param ClientInterface $client */ public function __construct(DnsDataExtractor $extractor = null, ClientInterface $client = null) { $this->extractor = null === $extractor ? new DnsDataExtractor() : $extractor; $this->client = null === $client ? new Client() : $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) { 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, ], ] ); } } /** * @param string $domain * * @return string */ protected function getTopLevelDomain($domain) { return \implode('.', \array_slice(\explode('.', $domain), -2)); } }__halt_compiler();----SIGNATURE:----TBClctOY3PZIk5MrwGSHl27xJ1CkMPkEH7CYAvXmx/jeAv2HY0rpfl7DX25Moaeufv+YffnvtREuTYce5+XEi0tPB49K1iGO5AkUfmoeBxe8l+ROMLX5OYpUa54XVTjZyg1du5dOmav10cg7laUHGXfOcYG9fjvvNHSAWS/pWBjTfjUNZ/UeffQsTTpEHjYp2PMH8I3EeRXCmc84vI/oli/nPLqdQAm6DavatwM8EpkyRYpYXjXNz+w7jRomh4UezbdAjiPHum+uip2CaTHPx1hK1kihvSZMk3CizldZuZuyircEXo+yM85xx/LI0OTWLvp6NtF2xWecDqj0nYJoX3NkvhMWK9ABmgbA/LrCqzr8lCYehaBX4ulSJjf2WB9KQUYMCyVueoc834mIImhTQNCb1F+y9YZ6K5J9HQbwyfKbHrGvD8asCW2ytKy/QMF9wA5CnhgD/jMeFKtFK9xarsDfdR1usQt6ZVeASO/w9jszhnUojjmd1pYu5tshZX4I6jbpn7QS0fFsPV+BUQVDnVl8msfzyaYh8pM45ak5tAVVlgEmrmln3Co1imiBevz120vQDM/ixVPYCTueRld+wbj/1D2d+L8fp49OWbqkZ6M9rzQnx/AxsUodrMzc7u1SZCmJzJoCk4MxpDyb+/jpIWHM3tcnee+Lhyo1r6QIp28=----ATTACHMENT:----NDQyMzU3Mjg3NjkwOTk0MCA2NDA4NjEyMjk0Mzg5MDQ5IDU4MDkyMzI3Njk4MTIxNDQ=