Kelunik\Acme\AcmeService::pollForChallenge PHP Méthode

pollForChallenge() public méthode

Polls until a challenge has been validated.
public pollForChallenge ( string $location ) : Amp\Promise
$location string URI of the challenge
Résultat Amp\Promise resolves to null
    public function pollForChallenge($location)
    {
        return \Amp\resolve($this->doPollForChallenge($location));
    }

Usage Example

Exemple #1
0
 /**
  * @param AcmeService $acme
  * @param KeyPair $keyPair
  * @param $domain
  * @return \Generator
  * @throws AcmeException
  * @throws \Exception
  * @throws \Throwable
  */
 private function solveChallenge(AcmeService $acme, KeyPair $keyPair, $domain)
 {
     list($location, $challenges) = (yield $acme->requestChallenges($domain));
     $goodChallenges = $this->findSuitableCombination($challenges);
     if (empty($goodChallenges)) {
         throw new AcmeException("Couldn't find any combination of challenges which this client can solve!");
     }
     $challenge = $challenges->challenges[reset($goodChallenges)];
     $token = $challenge->token;
     if (!preg_match("#^[a-zA-Z0-9-_]+\$#", $token)) {
         throw new AcmeException("Protocol violation: Invalid Token!");
     }
     $payload = $acme->generateHttp01Payload($keyPair, $token);
     $challengeStore = $this->getChallengeStorage();
     try {
         $challengeStore->put($token, $payload);
         (yield $acme->verifyHttp01Challenge($domain, $token, $payload));
         (yield $acme->answerChallenge($challenge->uri, $payload));
         (yield $acme->pollForChallenge($location));
         $challengeStore->delete($token);
     } catch (\Exception $e) {
         // no finally because generators...
         $challengeStore->delete($token);
         throw $e;
     } catch (\Throwable $e) {
         // no finally because generators...
         $challengeStore->delete($token);
         throw $e;
     }
 }
All Usage Examples Of Kelunik\Acme\AcmeService::pollForChallenge