Kelunik\Acme\Verifiers\Http01::doVerifyChallenge PHP Method

doVerifyChallenge() private method

Can be used to verify a challenge before requesting validation from a CA to catch errors early.
private doVerifyChallenge ( string $domain, string $token, string $payload ) : Generator
$domain string domain to verify
$token string challenge token
$payload string expected payload
return Generator coroutine resolved by Amp returning null
    private function doVerifyChallenge($domain, $token, $payload)
    {
        if (!is_string($domain)) {
            throw new InvalidArgumentException(sprintf("\$domain must be of type string, %s given.", gettype($domain)));
        }
        if (!is_string($token)) {
            throw new InvalidArgumentException(sprintf("\$token must be of type string, %s given.", gettype($token)));
        }
        if (!is_string($payload)) {
            throw new InvalidArgumentException(sprintf("\$payload must be of type string, %s given.", gettype($payload)));
        }
        $uri = "http://{$domain}/.well-known/acme-challenge/{$token}";
        /** @var Response $response */
        $response = (yield $this->client->request($uri, [Client::OP_CRYPTO => ["verify_peer" => false, "verify_peer_name" => false]]));
        if (rtrim($payload) !== rtrim($response->getBody())) {
            throw new AcmeException("selfVerify failed, please check {$uri}.");
        }
    }