Movatterモバイル変換


[0]ホーム

URL:


zerossl

packagemodule
v0.1.3Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License:MITImports:12Imported by:6

Details

Repository

github.com/caddyserver/zerossl

Links

README

ZeroSSL API clientGo Reference

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

View Source
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"`}

func (APIError)Error

func (aeAPIError) Error()string

typeCNAMEValidationError

type CNAMEValidationError struct {CNAMEFoundint    `json:"cname_found"`RecordCorrectint    `json:"record_correct"`TargetHoststring `json:"target_host"`TargetRecordstring `json:"target_record"`ActualRecordstring `json:"actual_record"`}

typeCertificateBundle

type CertificateBundle struct {CertificateCrtstring `json:"certificate.crt"`CABundleCrtstring `json:"ca_bundle.crt"`}

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

func (cClient) CancelCertificate(ctxcontext.Context, certificateIDstring)error

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 (cClient) DownloadCertificate(ctxcontext.Context, certificateIDstring, includeCrossSignedbool) (CertificateBundle,error)

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 (cClient) GenerateEABCredentials(ctxcontext.Context) (keyID, hmacKeystring, errerror)

func (Client)GetCertificate

func (cClient) GetCertificate(ctxcontext.Context, certificateIDstring) (CertificateObject,error)

func (Client)ListCertificates

func (Client)ResendVerificationEmail

func (cClient) ResendVerificationEmail(ctxcontext.Context, certificateIDstring)error

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

func (cClient) ValidateCSR(ctxcontext.Context, csrASN1DER []byte)error

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 (cClient) VerificationStatus(ctxcontext.Context, certificateIDstring) (ValidationStatus,error)

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.

typeHTTPValidationError

type HTTPValidationError struct {FileFoundint    `json:"file_found"`Errorbool   `json:"error"`ErrorSlugstring `json:"error_slug"`ErrorInfostring `json:"error_info"`}

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)

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"`}

typeValidationStatus

type ValidationStatus struct {ValidationCompletedint `json:"validation_completed"`Details             map[string]struct {Methodstring `json:"method"`Statusstring `json:"status"`} `json:"details"`}

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.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp