certificate

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2017 License: BSD-3-Clause Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCertificateNotFound   = errors.New("certificate not found")
	ErrCertificateInvalid    = errors.New("certificate invalid")
	ErrFQDNMissing           = errors.New("fqdn missing")
	ErrFQDNInvalid           = errors.New("fqdn invalid")
	ErrFQDNExists            = errors.New("fqdn exists")
	ErrACMEUserNotFound      = errors.New("acme user not found")
	ErrACMEUserEmailInvalid  = errors.New("acme user email invalid")
	ErrACMEChallengeNotFound = errors.New("acme challenge not found")
)

Errors that are related to the Certificate Service.

Functions

This section is empty.

Types

type ACMEChallenge

type ACMEChallenge struct {
	FQDN    string `json:"fqdn"`
	Token   string `json:"token,omitempty"`
	KeyAuth string `json:"key-auth,omitempty"`
}

ACMEChallenge provides data about ACME challenge for new certificate issue.

type ACMEChallengeOptions

type ACMEChallengeOptions struct {
	Token   *string `json:"token,omitempty"`
	KeyAuth *string `json:"key-auth,omitempty"`
}

ACMEChallengeOptions is a structure with parameters as pointers to set ACME challenge data. If a parameter is nil, the corresponding ACMEChallenge parameter will not be changed.

type ACMEChallenges

type ACMEChallenges []ACMEChallenge

ACMEChallenges is a list of ACMEChallenge instances.

type ACMEChallengesPage

type ACMEChallengesPage struct {
	ACMEChallenges ACMEChallenges `json:"acme-challenges"`
	Previous       string         `json:"previous,omitempty"`
	Next           string         `json:"next,omitempty"`
	Count          int            `json:"count,omitempty"`
}

ACMEChallengesPage is a paginated list of ACMEChallenge instances.

type ACMEService

type ACMEService interface {
	// ObtainCertificate requests a new SSL/TLS certificate from
	// ACME provider and returns an instance of Certificate.
	ObtainCertificate(fqdn string) (c *Certificate, err error)
	// IsCertificateBeingObtained tests if certificate is being obtained currently.
	// It can be used as a locking mechanism.
	IsCertificateBeingObtained(fqdn string) (yes bool, err error)
	// ACMEChallenge returns an instance of ACMEChallenge for a FQDN.
	ACMEChallenge(fqdn string) (c *ACMEChallenge, err error)
	// UpdateACMEChallenge alters the fields of existing ACMEChallenge.
	UpdateACMEChallenge(fqdn string, o *ACMEChallengeOptions) (c *ACMEChallenge, err error)
	// DeleteACMEChallenge deletes an existing ACMEChallenge for a
	// provided FQDN and returns it.
	DeleteACMEChallenge(fqdn string) (c *ACMEChallenge, err error)
	// ACMEChallenges retrieves a paginated list of ACMEChallenge instances.
	ACMEChallenges(start string, limit int) (page *ACMEChallengesPage, err error)
}

ACMEService defines functionality required to obtain SSL/TLS certificate from ACME provider.

type ACMEUser

type ACMEUser struct {
	ID           int    `json:"id"`
	Email        string `json:"email"`
	PrivateKey   []byte `json:"private-key"`
	URL          string `json:"url"`
	NewAuthzURL  string `json:"new-authz-url"`
	DirectoryURL string `json:"directory-url"`
}

ACMEUser is hods data about authentication to ACME provider.

type ACMEUserService

type ACMEUserService interface {
	// ACMEUser returns ACME user with ACME authentication details.
	ACMEUser() (u *ACMEUser, err error)
	// RegisterACMEUser registers and saves ACME user authentication data.
	RegisterACMEUser(directoryURL, email string) (u *ACMEUser, err error)
}

ACMEUserService handlers ACME user.

type Certificate

type Certificate struct {
	FQDN           string     `json:"fqdn"`
	ExpirationTime *time.Time `json:"expiration-time,omitempty"`
	Cert           string     `json:"cert,omitempty"`
	Key            string     `json:"key,omitempty"`
	ACMEURL        string     `json:"acme-url,omitempty"`
	ACMEURLStable  string     `json:"acme-url-stable,omitempty"`
	ACMEAccount    string     `json:"acme-account,omitempty"`
}

Certificate holds data related to SSL/TLS certificate.

type Certificates

type Certificates []Certificate

Certificates is a list of Certificate instances.

type CertificatesPage

type CertificatesPage struct {
	Certificates Certificates `json:"certificates"`
	Previous     string       `json:"previous,omitempty"`
	Next         string       `json:"next,omitempty"`
	Count        int          `json:"count,omitempty"`
}

CertificatesPage is a paginated list of Certificate instances.

type Getter added in v0.2.1

type Getter interface {
	// Certificate returns a Certificate for provided FQDN.
	Certificate(fqdn string) (c *Certificate, err error)
}

Getter provides interface to get single certificate. It is most useful for services that are only consumers of certificates.

type Info

type Info struct {
	FQDN           string     `json:"fqdn"`
	ExpirationTime *time.Time `json:"expiration-time,omitempty"`
	ACMEURL        string     `json:"acme-url,omitempty"`
	ACMEURLStable  string     `json:"acme-url-stable,omitempty"`
	ACMEAccount    string     `json:"acme-account,omitempty"`
}

Info is a subset of Certificate structure fields to provide information about expiration time and ACME issuer.

type Infos

type Infos []Info

Infos is a list of Info instances.

type InfosPage

type InfosPage struct {
	Infos    Infos  `json:"infos"`
	Previous string `json:"previous,omitempty"`
	Next     string `json:"next,omitempty"`
	Count    int    `json:"count,omitempty"`
}

InfosPage is a paginated list of Info instances.

type ManagementService

type ManagementService interface {
	Getter
	// UpdateCertificate alters the fields of existing Certificate.
	UpdateCertificate(fqdn string, o *Options) (c *Certificate, err error)
	// DeleteCertificate deletes an existing Certificate for a
	// provided FQDN and returns it.
	DeleteCertificate(fqdn string) (c *Certificate, err error)
	// Certificates retrieves a paginated list of Certificate instances
	// ordered by FQDN.
	Certificates(start string, limit int) (page *CertificatesPage, err error)
	// CertificatesInfoByExpiry retrieves a paginated list of Info instances
	// ordered by expiration time.
	CertificatesInfoByExpiry(since time.Time, start string, limit int) (page *InfosPage, err error)
}

ManagementService defines most basic functionality for certificate management.

type Options

type Options struct {
	Cert          *string `json:"cert,omitempty"`
	Key           *string `json:"key,omitempty"`
	ACMEURL       *string `json:"acme-url,omitempty"`
	ACMEURLStable *string `json:"acme-url-stable,omitempty"`
	ACMEAccount   *string `json:"acme-account,omitempty"`
}

Options is a structure with parameters as pointers to set certificate data. If a parameter is nil, the corresponding Certificate parameter will not be changed.

type Service

type Service interface {
	ManagementService
	ACMEService
	ACMEUserService
}

Service defines functions that Certificate provider must have.

Directories

Path Synopsis
Package httpCertificate provides a HTTP client to an external certificate service that can respond to HTTP requests defined here.
Package httpCertificate provides a HTTP client to an external certificate service that can respond to HTTP requests defined here.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL