*/ 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:----T6bY6NthsWrfoYT+fAgChLsk9l5YGn9Drsln1vatrUdgq0ZcrnjrlgVq6afiLUeIWhnmUZSzmjnrZ5Stw1mT8C1HpW/al8s2mdGGnVXxl90NLsjstUttJdSi/piEy2YKgAV7d9dYgptC+ZVktHHlwVDWaEMlPeJERYSi4jMWAX7SOgHGodzLsGI6ObvN7n60TsCtYlmBvz5suJwxzUVtVb4S8NqCzpIa8/XJXeVnxJBpHLdo0F2gouitnachxwRwaGWq88i2Tv1wLPchYh3I7g73atvqwYVMbiQuMKapWbvM54iyiFWZt6t84aWla4TT4sHDG4XaESuhO9JImDK1dvHnex54F/eNYrp1DAGA4tmftn5RDRQKrXUj/h1simnLBcsLGhUOj3pq/alcg8yV78lF55BwbKxs1I7bFFCP8xR7D/3qUVQsQa5VJuP9MvtA30+NPrvqLaKLKLPMNVHaagQ/U3ySm+1WWWps7oFXsYtzL945eLo5jSZyt+HwcEQsphvHyXLlu31Xx96ifbbSZhInOhl0qXHZfXqejOsV9ZK7Eee1RySP66vN7HEB91iIsNaEDEyg/s3LyMlwQQdpJ6sGAb4G5gnPPN/0VP6Uj7gdx56pgtDMc43ebiuih3HwYT4DT7PUTdJbsu7IDnpHP0e+tYSTxB+3tUtpw/7uccI=----ATTACHMENT:----NDUyMjA2MjM1NzM3NTAgODcyMTk2MTk4MTA1NDk4OCAxMDY2NzgwNjYyMTg2NzMx