Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Lescript.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class Lescript
public $license = 'https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf';
public $countryCode = 'CZ';
public $state = "Czech Republic";

public $challenge = 'http-01';

private $certificatesDir;
private $webRootDir;
Expand Down Expand Up @@ -72,9 +74,8 @@ public function signDomains(array $domains, $reuseCsr = false)
throw new \RuntimeException("HTTP Challenge for $domain is not available. Whole response: ".json_encode($response));
}

// choose http-01 challange only
$challenge = array_reduce($response['challenges'], function ($v, $w) {
return $v ? $v : ($w['type'] == 'http-01' ? $w : false);
return $v ? $v : ($w['type'] == $this->challenge ? $w : false);
});
if (!$challenge) throw new \RuntimeException("HTTP Challenge for $domain is not available. Whole response: " . json_encode($response));

Expand Down Expand Up @@ -123,7 +124,7 @@ public function signDomains(array $domains, $reuseCsr = false)
$challenge['uri'],
array(
"resource" => "challenge",
"type" => "http-01",
"type" => $this->challenge,
"keyAuthorization" => $payload,
"token" => $challenge['token']
)
Expand Down