encoding

package
v0.0.0-...-49c5947 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrZapFileDomainMismatched is returned when given domain does not match data in file.
	ErrZapFileDomainMismatched = errors.New("ZapFile domain-account.Domain does not match expected")

	// ErrZapFileHasNoAcctData is returned when a zapfile contains no acct data for a domain.
	ErrZapFileHasNoAcctData = WithZapCorrupted(errors.New("ZapFile contains no domain-account data"))

	// ErrZapFileHasNoPKeyData is returned when a zapfile contains no private key data for a domain.
	ErrZapFileHasNoPKeyData = WithZapCorrupted(errors.New("ZapFile contains no domain-private-key data"))

	// ErrZapFileHasNoUserRegistrationData is returned when a zapfile contains no user registration data for a domain.
	ErrZapFileHasNoUserRegistrationData = WithZapCorrupted(errors.New("ZapFile contains no domain-user-registration-data data"))

	// ErrZapFileHasNoCertificate is returned when a zapfile contains no domain certificate for a domain.
	ErrZapFileHasNoCertificate = WithZapCorrupted(errors.New("ZapFile contains no domain-certificate data"))

	// ErrZapFileHasNoIssuerCertificate is returned when a zapfile contains no domain issuer certificate
	// from the CA for a domain.
	ErrZapFileHasNoIssuerCertificate = WithZapCorrupted(errors.New("ZapFile contains no domain-issuer-certificate data"))

	// ErrZapFileHasNoCertificateRequest is returned when a zapfile contains no domain certificate
	// request or CRS, that was used to generate the domain certificate for a domain.
	ErrZapFileHasNoCertificateRequest = WithZapCorrupted(errors.New("ZapFile contains no domain-certificate-request data"))
)

Functions

func GetDomainSignature

func GetDomainSignature(email, domain string) string

GetDomainSignature returns a signature suited for giving email address and domain name.

func GetUserSignature

func GetUserSignature(email string) string

GetUserSignature returns a signature suited for giving email address.

Types

type AccountZapDecoder

type AccountZapDecoder struct{}

AccountZapDecoder implements a decoder which transforms a provided zap file track content into a tlsfs.Account.

func (AccountZapDecoder) Decode

func (enc AccountZapDecoder) Decode(zapFile tlsfs.ZapFile) (*UserAcct, error)

Decode attempts to decode the contents of the zap file as a tlsfs.Account, returning an error if the it failed.

type AccountZapEncoder

type AccountZapEncoder struct{}

AccountZapEncoder implements a tls.ZapFile encoder which transforms a giving tls.TLSDomainCertificate into a ZapFile.

func (AccountZapEncoder) Encode

func (enc AccountZapEncoder) Encode(acct tlsfs.Account) (tlsfs.ZapFile, error)

Encode implements the procedure to transform a tlsfs.TLSDomainCertificate to transform a tlsfs.TLSDomainCertificate into a tlsfs.ZapFile.

type Registration

type Registration interface {
	GetRegistration() *acme.RegistrationResource
}

Registration defines an interface that exposes method to retrieve an associated acme.RegistrationResource.

type TLSDomainZapDecoder

type TLSDomainZapDecoder struct{}

TLSDomainZapDecoder implements a decoder which transforms a provided zap file track content into a tlsfs.TLSDomainCertificate.

func (TLSDomainZapDecoder) Decode

Decode attempts to decode the contents of the zap file as a tlsfs.Account, returning an error if the it failed.

type TLSDomainZapEncoder

type TLSDomainZapEncoder struct{}

TLSDomainZapEncoder implements a tls.ZapFile encoder which transforms a giving tls.TLSDomainCertificate into a ZapFile.

func (TLSDomainZapEncoder) Encode

Encode implements the procedure to transform a tlsfs.TLSDomainCertificate to transform a tlsfs.TLSDomainCertificate into a tlsfs.ZapFile.

type UserAcct

type UserAcct struct {
	Email      string
	PrivateKey crypto.PrivateKey
	Resource   *acme.RegistrationResource
}

UserAcct implements the tlsfs.Account acct for registering users for a desired domain.

func NewUserAcct

func NewUserAcct(email string, key crypto.PrivateKey, reg *acme.RegistrationResource) *UserAcct

NewUserAcct returns a new UserAcct type which implements both the tlsfs.Account and Registration interface.

func (UserAcct) GetEmail

func (u UserAcct) GetEmail() string

GetEmail returns the email for the user.

func (UserAcct) GetPrivateKey

func (u UserAcct) GetPrivateKey() crypto.PrivateKey

GetPrivateKey returns the private key associated with user.

func (UserAcct) GetRegistration

func (u UserAcct) GetRegistration() *acme.RegistrationResource

GetRegistration returns the acme.RegistrationResource associated with the user account.

type ZapCorruptedError

type ZapCorruptedError struct {
	Reason error
	File   string
}

ZapCorruptedError defines an zap error which contain a given reason for the case of a corrupted zap file.

func WithZapCorrupted

func WithZapCorrupted(err error) *ZapCorruptedError

WithZapCorrupted error returns a new instance of ZapCorruptedError.

func (ZapCorruptedError) Error

func (zc ZapCorruptedError) Error() string

Error implements the error interface.

Jump to

Keyboard shortcuts

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