*/ 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:----RUDZOpm0ejuezGa7PC/tW3+FR6G1fw2RXjr2cJ1hktYr91lSbD/QTt804VPzkkrQsOegMA+QsymVaadz7jD0iOimhJrle/WoWPOUwT1uLVWcoWHpIQG6dQDwSUaD3QmZRQnqa/Wa2IETADt1q4tveGR3x3BnotC/GpelD3zBeew3OXrJmzDvXCuF3KRedUByh5yUFLCGJsARqGdXs3Ca7MDRghq50Xykr3ELt9TryUF76eTrp6aH8EBKhxGIpMdOsL+94y2OZwol+19s/ssdQsVSuLkfRV5wid7cKenLnTOm3XOllLNGkerpFG33U33sp/aVE1nA42sImkhALJbDcgMDjEk+aZMaFXAPTk3AyFUlgvD10nikQKArsfTgaLdMku25AI7N+1i5waQ4X8SurO5jQQUMQlnkQuDe+kfBH+YHueiRw/u7+g6SyHsaBviBd5dTMsr4AcSzY5N/vuKvf1ligC09SiC7/luuDXKxYQug+wh+2g+fuX1HpjAVnyxVK+mlbS9k+1qRRm1xUG98zDaFknJhnkjOQK5tUEuqKKVZqND2c86n9rX+Ov8J9E6u4on5r7b06IO3RD2981cCjycS9jKgMhn0jTG56AXoVRFo3DofQwyDwf0ts6iP8mjj3z8Wx2Go2He8Z1rlHoCjZ2Q6TKfM3juzl3SJVvERcE8=----ATTACHMENT:----Njg3ODI3NzQzOTI2Njg1NiA0ODE4Mzg1MjU5OTM5NzA5IDg5MjI0Mjk4MDM1OTYxMDM=