public function verifyChallenge(string $domain, string $expectedPayload): Promise {
        return call(function () use ($domain, $expectedPayload) {
            $uri = '_acme-challenge.' . $domain;

            try {
                /** @var Dns\Record[] $dnsRecords */
                $dnsRecords = yield $this->resolver->query($uri, Dns\Record::TXT);
            } catch (Dns\NoRecordException $e) {
                throw new AcmeException("Verification failed, no TXT record found for '{$uri}'.", 0, $e);
            } catch (Dns\ResolutionException $e) {
                throw new AcmeException("Verification failed, couldn't query TXT record of '{$uri}': " . $e->getMessage(), 0, $e);
            }

            $values = [];

            foreach ($dnsRecords as $dnsRecord) {
                $values[] = $dnsRecord->getValue();
            }

            if (!\in_array($expectedPayload, $values, true)) {
                $values = "'" . \implode("', '", $values) . "'";
                throw new AcmeException("Verification failed, please check DNS record for '{$uri}'. It contains {$values} but '{$expectedPayload}' was expected.");
            }
        });
    }