PHP Class Kelunik\Acme\AcmeService

Author: Niklas Keller ([email protected])
Show file Open project: kelunik/acme Class Usage Examples

Public Methods

Method Description
__construct ( AcmeClient $acmeClient ) AcmeService constructor.
answerChallenge ( string $location, string $keyAuth ) : Amp\Promise Answers a challenge and signals that the CA should validate it.
pollForCertificate ( string $location ) : Amp\Promise Polls for a certificate.
pollForChallenge ( string $location ) : Amp\Promise Polls until a challenge has been validated.
register ( string $email, string | null $agreement = null ) : Amp\Promise Registers a new account on the server.
requestCertificate ( string $csr ) : Amp\Promise Requests a new certificate.
requestChallenges ( string $dns ) : Amp\Promise Requests challenges for a given DNS name.
revokeCertificate ( string $pem ) : Amp\Promise Revokes a certificate.

Private Methods

Method Description
doAnswerChallenge ( string $location, string $keyAuth ) : Generator Answers a challenge and signals that the CA should validate it.
doPollForCertificate ( string $location ) : Generator Polls for a certificate.
doPollForChallenge ( string $location ) : Generator Polls until a challenge has been validated.
doRegister ( string $email, string | null $agreement = null ) : Generator Registers a new account on the server.
doRequestCertificate ( string $csr ) : Generator Requests a new certificate.
doRequestChallenges ( string $dns ) : Generator Requests challenges for a given DNS name.
doRevokeCertificate ( string $pem ) : Generator Revokes a certificate.
generateException ( Amp\Artax\Response $response ) : AcmeException Generates a new exception using the response to provide details.
parseRetryAfter ( string $header ) : integer Parses a retry header into seconds to wait until a request should be retried.

Method Details

__construct() public method

AcmeService constructor.
public __construct ( AcmeClient $acmeClient )
$acmeClient AcmeClient ACME client

answerChallenge() public method

Answers a challenge and signals that the CA should validate it.
public answerChallenge ( string $location, string $keyAuth ) : Amp\Promise
$location string URI of the challenge
$keyAuth string key authorization
return Amp\Promise resolves to the decoded JSON response

pollForCertificate() public method

Polls for a certificate.
public pollForCertificate ( string $location ) : Amp\Promise
$location string URI of the certificate
return Amp\Promise resolves to the complete certificate chain as array of PEM encoded certificates

pollForChallenge() public method

Polls until a challenge has been validated.
public pollForChallenge ( string $location ) : Amp\Promise
$location string URI of the challenge
return Amp\Promise resolves to null

register() public method

Registers a new account on the server.
public register ( string $email, string | null $agreement = null ) : Amp\Promise
$email string e-mail address for contact
$agreement string | null agreement URI or null if not agreed yet
return Amp\Promise resolves to a Registration object

requestCertificate() public method

Requests a new certificate.
public requestCertificate ( string $csr ) : Amp\Promise
$csr string certificate signing request
return Amp\Promise resolves to the URI where the certificate will be provided

requestChallenges() public method

Requests challenges for a given DNS name.
public requestChallenges ( string $dns ) : Amp\Promise
$dns string DNS name to request challenge for
return Amp\Promise resolves to an array of challenges

revokeCertificate() public method

Revokes a certificate.
public revokeCertificate ( string $pem ) : Amp\Promise
$pem string PEM encoded certificate
return Amp\Promise resolves to true