High level ACME client.
Methods
AcmeService constructor.
__construct(\Kelunik\Acme\AcmeClient $acmeClient, \Kelunik\Acme\KeyPair $accountKeyPair)
API
Parameters
$acmeClient
\Kelunik\Acme\AcmeClient
ACME client
$accountKeyPair
\Kelunik\Acme\KeyPair
account key pair
Answers a challenge and signals that the CA should validate it.
answerChallenge(string $location, string $keyAuth) : \Amp\Promise
API
Parameters
$location
string
URI of the challenge
$keyAuth
string
key authorization
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promise
resolves to the decoded JSON response
Generates the payload which must be provided in HTTP-01 challenges.
generateHttp01Payload(string $token) : string
API
Parameters
$token
string
challenge token
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
string
payload to be provided at /.well-known/acme-challenge/$token
Polls for a certificate.
pollForCertificate(string $location) : \Amp\Promise
API
Parameters
$location
string
URI of the certificate
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promise
resolves 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
string
URI of the challenge
Exceptions
\Kelunik\Acme\AcmeException |
|
Returns
\Amp\Promise
resolves to null
Registers a new account on the server.
register(string $email, string|null $agreement = null
) : \Amp\Promise
API
Parameters
$email
string
e-mail address for contact
$agreement
string
null
agreement URI or null if not agreed yet
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promise
resolves to a Registration object
Requests a new certificate.
requestCertificate(\Kelunik\Acme\KeyPair $keyPair, array $domains) : \Amp\Promise
API
Parameters
$keyPair
\Kelunik\Acme\KeyPair
domain key pair
$domains
array
domains to include in the certificate (first will be used as common name)
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promise
resolves to the URI where the certificate will be provided
Requests challenges for a given DNS name.
requestChallenges(string $dns) : \Amp\Promise
API
Parameters
$dns
string
DNS name to request challenge for
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promise
resolves to an array of challenges
Revokes a certificate.
revokeCertificate(string $pem) : \Amp\Promise
API
Parameters
$pem
string
PEM encoded certificate
Exceptions
\Kelunik\Acme\AcmeException |
If something went wrong. |
Returns
\Amp\Promise
resolves 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
string
domain to verify
$token
string
challenge token
$payload
string
expected payload
Exceptions
\Kelunik\Acme\AcmeException |
If the challenge could not be verified. |
Returns
\Amp\Promise
resolves to null