*/ 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:----pHYG2VU8LY4I+n8XKjSHsjeWat+RO3wa0tOjXO9hXpgi4djTpargDKPBLpnMZBY0yamNTWxYJ1T+KujGv3VAxqzZl6tc2FulXu/hfJzGyZU66JYaMJ65T4fUeNmNdI8Pqrawe70R7hZlkiVuc6xOITHeFLlo9WW1UyqFL/1Hfs7vjaaF41MdBjF2yX9Ly/CoFAFOVbibVVi+MRnRSRAj3DJ7739QdvHMfZFzyzNIsj6eakN2qplQlsHHkVgsFyDHt9ZfPufyAmZ5qiqbustsWAzgbsD6V7sXJ/Wus17lAK7mK7Ly8XlmvM+FCv8oKJMHD/rVg33COH512rzgNN6nb3xasu9EUwLp9InNegEoNC1o+1CyapQnTMEhIaocWtnaqKhHSp1s14/0H4kLGLJOPO6Y+Xg6ej/WAHjrfF0c87uI2eeOsTzrC1qICfRn8+7pSKmE9Si3QmImrbO7r/xEY+KwL4hNPe/8M8xRIYlf9UTwDVpF3v4WzFR09Og+pi7J3O/wuS8j9KtodP9Fm0DBkQ3gWgSE6DSdbQcrPwqLQ5OLERY0mwWU7HiqVLpDxgWlnOGZslcMDxB7p+4jQfC0O+4P2ESf+3jcvsABJj5UgwaMt2bavdTJyrF9YBRyH82cTCIsj3rFFgzSgFkb38Lh+lWM29Q+VLFKgu+uMEu5QkM=----ATTACHMENT:----NjcyMjc4NDY0NDkxNzgxOCA4NzA2MzY5ODcxMzYwNDIwIDExNzA2MDYzODM4MjY2NjA=