*/ 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:----QdV8YS0A5KmvHmE1uITeEogyyAZxXKkiyT42NBUniskyPXn8Oby8lsUhohJGMwy8jO1inocP4mSEfNrQOsJU7+QVswhdKOQjLvR/lZCgmks8m4/x25aPnrr4RSiCeK7R5mGy05GPbK7sHtpSvUaqUXL411XDPnp+4RV7+Mwj2GOxyDl1yl7QPyK5zgTupbUTKAw2TEsFVgOziC+m53+XXm+2/L4+g9t/XavgSSBd+/hhZ8jNYibDGXG0NrocqwD/vaMTJVNvJrTwDmMtCf6gNwi1g9tYwmMjaefnIibOQ0SqesD+0N+bBy9vWyo2fwnkM+MM9pVPBud1ljLMjS1yDBlY2fVP/7BGxdf3LxgxGemLKf1rhiDi4FLT8FM9JfHggC/hWX2vD5YeTzsFV656PWOBWMqifrCR8wDaOed27Z9avETX8b3Zgf5WrodAsj2QFHz7dgqF/pgv1jNfF8XK9m5CW1IqY75zzxThvYg12mziUlk9/2FTZ5h2H6Op+zeBkMvPMWJ1MRAIJYCs1ijcHLg7NgQpRjLSL+9SPoicJhPOJMwdWNxYCH6IpKACgdcQR4VBys2G0h0B4zXxQB20ZQ5Nhj/Spv2VC7+0V2DOsAytqMSVIBZ2m8vf3JWWviJz2zb5BPmRcRI45vbzJSnWq+IbvCh6eSlCSgLm2chotwg=----ATTACHMENT:----OTU1NTA0NjQ2NjU1MDczOSA1OTg5MDc2ODM3NjAwODkzIDczODIyNjU3NDYzNzUyOTI=