zerossl
packagemoduleThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
README¶
ZeroSSL API client
This package implements theZeroSSL REST API in Go.
The REST API is distinct from theACME endpoint, which is a standardized way of obtaining certificates.
Documentation¶
Overview¶
Package zerossl implements the ZeroSSL REST API.See the API documentation on the ZeroSSL website:https://zerossl.com/documentation/api/
Index¶
- Constants
- type APIError
- type CNAMEValidationError
- type CertificateBundle
- type CertificateList
- type CertificateObject
- type Client
- func (c Client) CancelCertificate(ctx context.Context, certificateID string) error
- func (c Client) CreateCertificate(ctx context.Context, csr *x509.CertificateRequest, validityDays int) (CertificateObject, error)
- func (c Client) DownloadCertificate(ctx context.Context, certificateID string, includeCrossSigned bool) (CertificateBundle, error)
- func (c Client) DownloadCertificateFile(ctx context.Context, certificateID string, includeCrossSigned bool, ...) error
- func (c Client) GenerateEABCredentials(ctx context.Context) (keyID, hmacKey string, err error)
- func (c Client) GetCertificate(ctx context.Context, certificateID string) (CertificateObject, error)
- func (c Client) ListCertificates(ctx context.Context, params ListCertificatesParameters) (CertificateList, error)
- func (c Client) ResendVerificationEmail(ctx context.Context, certificateID string) error
- func (c Client) RevokeCertificate(ctx context.Context, certificateID string, reason RevocationReason) error
- func (c Client) ValidateCSR(ctx context.Context, csrASN1DER []byte) error
- func (c Client) VerificationStatus(ctx context.Context, certificateID string) (ValidationStatus, error)
- func (c Client) VerifyIdentifiers(ctx context.Context, certificateID string, method VerificationMethod, ...) (CertificateObject, error)
- type HTTPValidationError
- type ListCertificatesParameters
- type RevocationReason
- type ValidationError
- type ValidationObject
- type ValidationStatus
- type VerificationMethod
Constants¶
const BaseURL = "https://api.zerossl.com"The base URL to the ZeroSSL API.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeAPIError¶
type APIError struct {Success anyBool `json:"success"`ErrorInfo struct {Codeint `json:"code"`Typestring `json:"type"`// for domain verification only; each domain is grouped into its// www and non-www variant for CNAME validation, or its URL// for HTTP validationDetails map[string]map[string]ValidationError `json:"details"`} `json:"error"`}typeCertificateList¶
type CertificateList struct {TotalCountint `json:"total_count"`ResultCountint `json:"result_count"`Pagestring `json:"page"`// don't ask me why this is a stringLimitint `json:"limit"`ACMEUsageLevelstring `json:"acmeUsageLevel"`ACMELockedbool `json:"acmeLocked"`Results []CertificateObject `json:"results"`}typeCertificateObject¶
type CertificateObject struct {IDstring `json:"id"`// "certificate hash"Typestring `json:"type"`CommonNamestring `json:"common_name"`AdditionalDomainsstring `json:"additional_domains"`Createdstring `json:"created"`Expiresstring `json:"expires"`Statusstring `json:"status"`ValidationType *string `json:"validation_type,omitempty"`ValidationEmails *string `json:"validation_emails,omitempty"`ReplacementForstring `json:"replacement_for,omitempty"`FingerprintSHA1 *string `json:"fingerprint_sha1"`BrandValidationany `json:"brand_validation"`Validation *struct {EmailValidation map[string][]string `json:"email_validation,omitempty"`OtherMethods map[string]ValidationObject `json:"other_methods,omitempty"`} `json:"validation,omitempty"`}typeClient¶
type Client struct {// REQUIRED: Your ZeroSSL account access key.AccessKeystring `json:"access_key"`// Optionally adjust the base URL of the API.// Default:https://api.zerossl.comBaseURLstring `json:"base_url,omitempty"`// Optionally configure a custom HTTP client.HTTPClient *http.Client `json:"-"`}Client acts as a ZeroSSL API client. It facilitates ZeroSSL certificate operations.
func (Client)CancelCertificate¶
CancelCertificate cancels a certificate that has not been issued yet (is in draft or pending_validation state).
func (Client)CreateCertificate¶
func (cClient) CreateCertificate(ctxcontext.Context, csr *x509.CertificateRequest, validityDaysint) (CertificateObject,error)
CreateCertificate creates a certificate. After creating a certificate, its identifiers must be verified beforethe certificate can be downloaded. The CSR must have been fully created using x509.CreateCertificateRequest(its Raw field must be filled out).
func (Client)DownloadCertificate¶
func (Client)DownloadCertificateFile¶
func (cClient) DownloadCertificateFile(ctxcontext.Context, certificateIDstring, includeCrossSignedbool, outputio.Writer)error
DownloadCertificateFile writes the certificate bundle as a zip file to the provided output writer.
func (Client)GenerateEABCredentials¶
func (Client)GetCertificate¶
func (Client)ListCertificates¶
func (cClient) ListCertificates(ctxcontext.Context, paramsListCertificatesParameters) (CertificateList,error)
func (Client)ResendVerificationEmail¶
func (Client)RevokeCertificate¶
func (cClient) RevokeCertificate(ctxcontext.Context, certificateIDstring, reasonRevocationReason)error
Only revoke a certificate if the private key is compromised, the certificate was a mistake, orthe identifiers are no longer in use. Do not revoke a certificate when renewing it.
func (Client)ValidateCSR¶
ValidateCSR sends the CSR to ZeroSSL for validation. Pass in the ASN.1 DER-encoded bytes;this is found in x509.CertificateRequest.Raw after calling x5p9.CreateCertificateRequest.
func (Client)VerificationStatus¶
func (Client)VerifyIdentifiers¶
func (cClient) VerifyIdentifiers(ctxcontext.Context, certificateIDstring, methodVerificationMethod, emails []string) (CertificateObject,error)
VerifyIdentifiers tells ZeroSSL that you are ready to prove control over your domain/IP using the method specified.The credentials from CreateCertificate must be used to verify identifiers. At least one email is required if usingemail verification method.
typeListCertificatesParameters¶
type ListCertificatesParameters struct {// Return certificates with this status.Statusstring// Return these types of certificates.Typestring// The CommonName or SAN.Searchstring// The page number. Default: 1Pageint// How many per page. Default: 100Limitint}ListCertificateParameters specifies how to search or list certificates on the account.An empty set of parameters will return no results.
funcListAllCertificates¶
func ListAllCertificates()ListCertificatesParameters
ListAllCertificates returns parameters that lists all the certificates on the account;be sure to set Page and Limit if paginating.
typeRevocationReason¶
type RevocationReasonstring
RevocationReason represents various reasons for revoking a certificate.
const (UnspecifiedReasonRevocationReason = "unspecified"// defaultKeyCompromiseRevocationReason = "keyCompromise"// lost control of private keyAffiliationChangedRevocationReason = "affiliationChanged"// identify information changedSupersededRevocationReason = "Superseded"// certificate replaced -- do not revoke for this reason, howeverCessationOfOperationRevocationReason = "cessationOfOperation"// domains are no longer in use)
typeValidationError¶
type ValidationError struct {CNAMEValidationErrorHTTPValidationError}typeValidationObject¶
type ValidationObject struct {FileValidationURLHTTPstring `json:"file_validation_url_http"`FileValidationURLHTTPSstring `json:"file_validation_url_https"`FileValidationContent []string `json:"file_validation_content"`CnameValidationP1string `json:"cname_validation_p1"`CnameValidationP2string `json:"cname_validation_p2"`}typeVerificationMethod¶
type VerificationMethodstring
VerificationMethod represents a way of verifying identifiers with ZeroSSL.
const (EmailVerificationVerificationMethod = "EMAIL"CNAMEVerificationVerificationMethod = "CNAME_CSR_HASH"HTTPVerificationVerificationMethod = "HTTP_CSR_HASH"HTTPSVerificationVerificationMethod = "HTTPS_CSR_HASH")
Verification methods.