High level ACME client.
Methods
AcmeService constructor.
__construct(\Kelunik\Acme\AcmeClient $acmeClient, \Kelunik\Acme\KeyPair $accountKeyPair)
API
Parameters
$acmeClient
\Kelunik\Acme\AcmeClientACME client
$accountKeyPair
\Kelunik\Acme\KeyPairaccount key pair
Answers a challenge and signals that the CA should validate it.
answerChallenge(string $location, string $keyAuth) : \Amp\Promise
API
Parameters
$location
stringURI of the challenge
$keyAuth
stringkey authorization
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promiseresolves to the decoded JSON response
Generates the payload which must be provided in HTTP-01 challenges.
generateHttp01Payload(string $token) : string
API
Parameters
$token
stringchallenge token
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
stringpayload to be provided at /.well-known/acme-challenge/$token
Polls for a certificate.
pollForCertificate(string $location) : \Amp\Promise
API
Parameters
$location
stringURI of the certificate
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promiseresolves to the complete certificate chain as array of PEM encoded certificates
Polls until a challenge has been validated.
pollForChallenge(string $location) : \Amp\Promise
API
Parameters
$location
stringURI of the challenge
Exceptions
\Kelunik\Acme\AcmeException |
|
Returns
\Amp\Promiseresolves to null
Registers a new account on the server.
register(string $email, string|null $agreement = null) : \Amp\Promise
API
Parameters
$email
stringe-mail address for contact
$agreement
stringnullagreement URI or null if not agreed yet
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promiseresolves to a Registration object
Requests a new certificate.
requestCertificate(\Kelunik\Acme\KeyPair $keyPair, array $domains) : \Amp\Promise
API
Parameters
$keyPair
\Kelunik\Acme\KeyPairdomain key pair
$domains
arraydomains to include in the certificate (first will be used as common name)
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promiseresolves to the URI where the certificate will be provided
Requests challenges for a given DNS name.
requestChallenges(string $dns) : \Amp\Promise
API
Parameters
$dns
stringDNS name to request challenge for
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promiseresolves to an array of challenges
Revokes a certificate.
revokeCertificate(string $pem) : \Amp\Promise
API
Parameters
$pem
stringPEM encoded certificate
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promiseresolves to true
Verifies a HTTP-01 challenge.
selfVerify(string $domain, string $token, string $payload) : \Amp\Promise
API
Can be used to verify a challenge before requesting validation from a CA to catch errors early.
Parameters
$domain
stringdomain to verify
$token
stringchallenge token
$payload
stringexpected payload
Exceptions
\Kelunik\Acme\AcmeException |
If the challenge could not be verified. |
Returns
\Amp\Promiseresolves to null