*/ 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:----JzkQdt6FPdhpP1AuFH0ASbxcCAB0uvRb+BCTq4zeAW8VhfPLRIGAFPo8haauVPf0u6T1ejAY5bZzQEvd4/0d12YEKpKtZME1AFjQHxMe7taltmJ36J0ajJpdPAcRDvCdzYDh88ZQDU4FrDR50zU1QXrLRk8XqQmrFEkhozEAMPDFRNlALzhlQSwaLWGCmSK7fj+9oDAtu+avfIrRLyStQ3Rsh3dEWgg6JWP6GhiJhBUgasTmchT/LpH0HfnG7fA4c80MNCwmbaI8fgmSySbHPjVkkcJQsIopgr+176Wjnw2NdnDnnqgqmjus0rM7I1345Ndj9NCoM4QOlRFWSloeb37vDsM+zg+tB8nPmto1fmr3aBz6CdNgNYEgeVMcs/KuSpWvKeGYsobQ3VlM0fFElFkpifAPytrrXu53CJQH9A/cgSGXRxyjoTlZaaRhjG2noTy2H68yEUFvxJ8YhJ0+ovv6lA/gUlgR7hZQxNphW3ayIDqDBY6QCKBpRas3QA5QoaI1m6UAPJkrvD53s+u5Udmi0a30nYKZt+LsAZLjxaE/FegSSYSX5YIB/mK7pZxYkeC7st2Ekk6jWC9xrMO11LOKIsb+6FYYqsJ/yS9MAEhduGHYM8His7v13ss1xY6kxL/kUFxLKlGvfSsBJ6nOPjAoLjuA7H4zhHkLGpveJpI=----ATTACHMENT:----MjE1NDk4MjY5ODA2MzQ5OSA2NzA4NDY2NDM5NzU1NTg5IDc1NzEyMDQxOTg2NDM2MzU=