private function doAnswerChallenge($location, $keyAuth)
{
if (!is_string($location)) {
throw new InvalidArgumentException(sprintf("\$location must be of type string, %s given.", gettype($location)));
}
if (!is_string($keyAuth)) {
throw new InvalidArgumentException(sprintf("\$keyAuth must be of type string, %s given.", gettype($keyAuth)));
}
/** @var Response $response */
$response = (yield $this->acmeClient->post($location, ["resource" => AcmeResource::CHALLENGE, "keyAuthorization" => $keyAuth]));
if ($response->getStatus() === 202) {
(yield new CoroutineResult(json_decode($response->getBody())));
return;
}
throw $this->generateException($response);
}