Documentation
¶
Index ¶
- type Account
- type Authorization
- type Certificate
- type Challenge
- type Client
- func (c *Client) AcceptChallenge(ctx context.Context, challenge *acme.Challenge) (*Challenge, error)
- func (c *Client) DeactivateAccount(ctx context.Context, url string) (*Account, error)
- func (c *Client) DeactivateAuthorization(ctx context.Context, url string) (*Authorization, error)
- func (c *Client) FinalizeOrder(ctx context.Context, o *Order) (*Order, error)
- func (c *Client) GetAuthorization(ctx context.Context, url string) (*Authorization, error)
- func (c *Client) GetChallenge(ctx context.Context, url string) (*Challenge, error)
- func (c *Client) GetDirectory(ctx context.Context) (*Directory, error)
- func (c *Client) GetOrder(ctx context.Context, url string) (*Order, error)
- func (c *Client) NewAccount(ctx context.Context, contact ...string) (*Account, error)
- func (c *Client) NewOrder(ctx context.Context, identifiers ...acme.Identifier) (*Order, error)
- func (c *Client) RequestCertificate(ctx context.Context, url string) (*Certificate, error)
- func (c *Client) WithOptions(options ...Optional) (*Client, error)
- type Directory
- type Optional
- type Order
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
Account holds information about the ACME account. The URL field is the key ID to use in privileged order requests.
type Authorization ¶
type Authorization struct { acme.Authorization URL string }
Authorization holds information about an ACME authorization.
type Certificate ¶
type Certificate struct { Certificate *x509.Certificate Chain []*x509.Certificate }
Certificate holds a certificate chain in x509 DER format.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client executes requests to the ACME server.
func NewClient ¶
func NewClient(directoryURL, algorithm string, signer crypto.Signer, options ...Optional) (*Client, error)
NewClient creates a new Client with a specific directory. The new client requires the algorithm and private key to use to sign requests.
Example ¶
pk, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { log.Fatal(err) } dirURL := "https://acme-staging-v02.api.letsencrypt.org/directory" client, err := NewClient(dirURL, "RS256", pk) if err != nil { log.Fatal(err) } client.GetDirectory(context.Background())
Output:
Example (WithAccountKey) ¶
pk, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { log.Fatal(err) } dirURL := "https://acme-staging-v02.api.letsencrypt.org/directory" accountKey := "https://acme-staging-v02.api.letsencrypt.org/my-account/96f7fbfaf92c1625a8f4073f3f890b3fc73bc61809753ea60bca687cd417b6f6" client, err := NewClient(dirURL, "RS256", pk, NewOptionalAccountKey(accountKey)) if err != nil { log.Fatal(err) } client.GetDirectory(context.Background())
Output:
Example (WithHttpClient) ¶
pk, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { log.Fatal(err) } dirURL := "https://acme-staging-v02.api.letsencrypt.org/directory" accountKey := "https://acme-staging-v02.api.letsencrypt.org/my-account/96f7fbfaf92c1625a8f4073f3f890b3fc73bc61809753ea60bca687cd417b6f6" client, err := NewClient(dirURL, "RS256", pk, NewOptionalAccountKey(accountKey), NewOptionalHTTPClient(http.DefaultClient)) if err != nil { log.Fatal(err) } client.GetDirectory(context.Background())
Output:
func (*Client) AcceptChallenge ¶
func (c *Client) AcceptChallenge(ctx context.Context, challenge *acme.Challenge) (*Challenge, error)
AcceptChallenge requests a challenge verification from the ACME server.
func (*Client) DeactivateAccount ¶
DeactivateAccount changes an account status to deactivated. This ensures that a pending authorization can be ignored in a safe way.
func (*Client) DeactivateAuthorization ¶
DeactivateAuthorization changes the authorization status to deactivated. This ensures that a pending authorization can be ignored in a safe way.
func (*Client) FinalizeOrder ¶
FinalizeOrder changes the order status to finalized.
func (*Client) GetAuthorization ¶
GetAuthorization fetches an ACME authorization. This method can be used to check the status after a certificate challenge has been requested.
func (*Client) GetChallenge ¶
GetChallenge requests an existent challenge object from the ACME server.
func (*Client) GetDirectory ¶
GetDirectory fetches the directory payload from the ACME server.
func (*Client) NewAccount ¶
NewAccount creates a new ACME account. It forces the client to accept the terms of service.
func (*Client) RequestCertificate ¶
RequestCertificate fetches the final ACME certificate.
type Directory ¶
type Directory struct { NewNonce string `json:"newNonce"` NewAccount string `json:"newAccount"` NewOrder string `json:"newOrder"` NewAuthz string `json:"newAuthz"` RevokeCerts string `json:"revokeCerts"` KeyExchange string `json:"keyExchange"` Meta map[string]interface{} `json:"meta,omitempty"` }
Directory holds the ACME directory information fetched from a server.
type Optional ¶
Optional is a function interface to set optional client settings.
func NewOptionalAccountKey ¶
NewOptionalAccountKey allows you to set the ACME account key for privileged requests. You can get this key from the Account object.
func NewOptionalHTTPClient ¶
NewOptionalHTTPClient allows to use a given http client rather than the default http client. Use this if you want your http client to handle retries, network partitions, and server outages.