applied getOption

psr2 formatting
This commit is contained in:
peterbakker
2022-02-18 16:09:56 +01:00
parent d5827cb970
commit 1d1797ded5

View File

@@ -138,11 +138,6 @@ class Client
$this->init(); $this->init();
} }
public function getKeyLength(): int
{
return $this->config['key_length'] ?? 4096;
}
/** /**
* Get an existing order by ID * Get an existing order by ID
* *
@@ -287,7 +282,7 @@ class Client
* @return bool * @return bool
* @throws \Exception * @throws \Exception
*/ */
public function validate(Challenge $challenge, $maxAttempts = 15): bool public function validate(Challenge $challenge, int $maxAttempts = 15): bool
{ {
$this->request( $this->request(
$challenge->getUrl(), $challenge->getUrl(),
@@ -321,7 +316,7 @@ class Client
*/ */
public function getCertificate(Order $order): Certificate public function getCertificate(Order $order): Certificate
{ {
$privateKey = Helper::getNewKey($this->getKeyLength()); $privateKey = Helper::getNewKey($this->getOption('key_length', 4096));
$csr = Helper::getCsr($order->getDomains(), $privateKey); $csr = Helper::getCsr($order->getDomains(), $privateKey);
$der = Helper::toDer($csr); $der = Helper::toDer($csr);
@@ -498,7 +493,10 @@ class Client
{ {
//Make sure a private key is in place //Make sure a private key is in place
if ($this->getFilesystem()->has($this->getPath('account.pem')) === false) { if ($this->getFilesystem()->has($this->getPath('account.pem')) === false) {
$this->getFilesystem()->write($this->getPath('account.pem'), Helper::getNewKey($this->getKeyLength())); $this->getFilesystem()->write(
$this->getPath('account.pem'),
Helper::getNewKey($this->getOption('key_length', 4096))
);
} }
$privateKey = $this->getFilesystem()->read($this->getPath('account.pem')); $privateKey = $this->getFilesystem()->read($this->getPath('account.pem'));
$privateKey = openssl_pkey_get_private($privateKey); $privateKey = openssl_pkey_get_private($privateKey);