Import std.net.acme_client
std.net.acme_client
An ACME client (RFC 8555), as Let's Encrypt's are: AcmeClient makes an account with a CA, from its directory's URL, and orders a certificate for names it proves it holds by HTTP-01, publishing each challenge's key authorization through AcmeTokens, which a server answers on port 80 at /.well-known/acme-challenge/. Each request is a JWS of the account's key, ES256, with a nonce from the CA, which a refused nonce is tried again with, once. Its requests are Async, as the server that answers the challenges runs Async code. A CA's refusal is a NetError of HTTP_STATUS that says what it said; a name it couldn't check, or an order it gave up on, is a NetError of OTHER.
std/net/acme_client.fb
Types
AcmeTokens
class
Public Shared Class AcmeTokens
The key authorizations of an ACME client's HTTP-01 challenges, by token, which a server gives for /.well-known/acme-challenge/, through Answer, from any thread.
std/net/acme_client.fb, line 32
-
A new AcmeTokens, with none published.
-
Gives
token's challenge itskeyAuthorization, which Answer gives until it's withdrawn. -
Takes
token's key authorization out, once its challenge is done. -
What a request for
pathis answered with: the key authorization for /.well-known/acme-challenge/, or Null for another path, or a token it hasn't.
AcmeClient
class
Public Class AcmeClient
A client of one ACME CA, with an account key, an ECDSA P-256 private key, which signs each request, and Http, which it sends them with, which can trust a test CA's roots.
std/net/acme_client.fb, line 61
-
A client of the CA whose directory is at
directory. Panics unlessaccountKeyis an ECDSA P-256 private key, of 32 bytes that are one. -
@PanicsAtCaller Public Static Method InFolder(directory: String, folder: Path): AcmeClient Throws IOError, ParseErrorstatic method #A client of the CA whose directory is at
directory, with the account keyfolderkeeps as account.pem, or a new ECDSA P-256 key, which it writes there atomically, making thefolder, for the runs after; automatic HTTPS's ListenAutoAsync keeps its certificate in the same folder. Throws an IOError when thefoldercan't be read or written, or a ParseError when its account.pem isn't a key's PEM. Panics as New does for a key it keeps that isn't an ECDSA P-256 private key. -
What its requests go through.
-
The account's URL, once Register or Obtain has made it or found it.
-
Public Async Method RegisterAsync(contact: String[] = []): String Throws NetError, TimeoutErrormethod #Makes the account, agreeing to the CA's terms of service, with
contact, mailto: URLs, or finds the one the key has, and gives its URL. -
@PanicsAtCaller Public Async Method ObtainAsync(names: String[], certificateKey: Key, tokens: AcmeTokens): String Throws NetError, TimeoutErrormethod #A certificate for
names, DNSnames, ofcertificateKey, an ECDSA P-256 private key, as PEM, its chain after it: it orders one, publishes each name's HTTP-01 key authorization throughtokenswhile the CA checks it, finalizes the order with a CSR, and gives what the CA issued. It registers first, with no contact, when Register hasn't. Panics as Acme.CertificateRequest does for the key andnames.
Report an issue with this page or with FutureBlitz on GitHub.