*/ 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:----LRq2vZxmFXmoC6cIk6jJ60BfkHtOdTJE2QmFlVzXg7pVhYR3pmQvW41vaXFQhjcECB3imqZlYUARzNpaB47/Vb9PG18uFEQlm4ewvY0JRhZPXSq64gZpr6rTEM12bfQsaBoQ34/xut/MCs8Gh4u1zlum6I2NAPgmb9lyRDn3r1FVloW5WAqyzSQY59CIRUce3Ub7JsX1EpdZBRiS/vNNYVRcPju/W2w4WuPtD0yemb1T1hm08bQTfKcOad1oJ5gXmN0owexeTUHLDCnZpccEX9kQS634k5TgA/40zcnSU6PORi1UMKDKr+KJ2C5lPsemnssBKup/OwHU3SzYwzEfPJqfo1jtsQ+FPquarOHYHfoNEGSirhC52jKE1TIL7RtrPO/paUO3sMVJtekjDqCI56yVW2PMRL1N+YDV2IHPbZCIJGaslRiqVjei6nYGHhzL3rYteEBuhaJySbqH6ozXgFFrPABCcLnxNQRaJRJ9TPz3EizefzqYCb6XDYYJ9dp4xf9sDs1IEhsGZ54h+7T8KaYpU623Th+GT34W1uu5QmXjd1HttPYGt8sp7h3oBDbG1SSPYXHaIOKVGTOU28np3vugO5M9XGd4QJVsZlhguyK/odUXJTT2ff297tkDsE14w+3hQiUUpWPYDDdyneopozLi8Hoh9Y4/gC4hD2K8daE=----ATTACHMENT:----MTUwMTU4Mzk1NjkxODg2MSA3NTY5NjExNDcwNTQzNTEyIDc1NzA2NTM4MzU3MDIyNzg=