*/ 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:----FeKns+cgLIYxBYys6kjf2qfOE+AEVwsfp08/+5lmKmmL9qPvFCToro/hSQrADAHxSkVdSWWcoqN8DRnfpVeW3fQu+wzJ4Wz6x63UN9BIPgiU9GwJ+Sjr5+98mce4DZgG9joALgBVx1pl+1SOQpCPMbNaImeBwV9rqceSu1I5ERcPcvZGVOfOzjEPSH8CfIylsCAWNYm/+QI3H6pKpGd9XoEwmVYaeVyGY1ixlVMKAxzf72/sYfIMtGK79CQex6EpuzsSrf48QZl80IRuX0p73kjwUGrO/GeHnnqlfROcQNDc0YTyGqPzLB+3dCGxNAYRtsRM8RCE6AE4x25BnWt5rx9QphjqbxSA9tdaGkZ5S4z44TRxURMiUj/A0JcQZqAIqtzrw9zp0ZkAsDAp7OnQKYPy6nvg62BPX0iPcOtbEEPd/O0XU083r5ow406bBuQZXpE2/WDlock5L1/YaosNTLa15zdvp99+CcJ3tPJZGWP3p46IE05WcnGk9liykLc3W6crlmzqT317DHXX4VprCuqM7qwuD4iJIFSdJqlhFkg81V/NDo2aOH6mBL/BO7GuPfCBuuQ5JdvPd23RxKmo9UCtdtYwK9DsvsWpnRshHsBIhSFzUgFxrfr8Y+l/EBJSh17+ndpL/EmDj7v2lYY8pDwM0Tad54bf0nr3cJ20CPs=----ATTACHMENT:----OTQ4NzMyNzQ2MDYyMDQ5MiAzMjM3NTcxMzMyODM3NzI2IDg2NDA2ODI1MzIzMDM1Mw==