Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrConfig = errors.New("cert issuer: invalid config") ErrInvalidArgs = errors.New("cert issuer: invalid args") )
View Source
var ( ErrExternalAccountBindingRequired = errors.New("server requires External Account Binding") ErrUnsupportedDNSProvider = errors.New("unsupported DNS provider") )
View Source
var ( ErrStorageUnknownPrivateKeyType = errors.New("cert storage: invalid private key type") ErrStorageParse = errors.New("cert storage: parse") ErrStorageParsePrivateKey = errors.New("cert storage: unable to parse private key") ErrStorageParseCertificate = errors.New("cert storage: unable to parse certificate") ErrStorageUnsupportedKeyType = errors.New("cert storage: unsupported private key type") ErrStorageMissingPrivateKey = errors.New("cert storage: missing private key") ErrStorageInvalidPFXFormat = errors.New("cert storage: invalid PFX format") )
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
Email string `json:"email"`
Registration *registration.Resource `json:"registration"`
// contains filtered or unexported fields
}
The Account represents a users' local saved credential.
func (*Account) GetPrivateKey ¶
func (a *Account) GetPrivateKey() crypto.PrivateKey
GetPrivateKey returns the private RSA account key.
func (*Account) GetRegistration ¶
func (a *Account) GetRegistration() *registration.Resource
GetRegistration returns the server registration.
type CertIssuer ¶
type CertIssuer interface {
Close() error
}
func NewLego ¶
NewLego initializes and returns a certificate issuer based on the ACME protocol using the Lego library. It manages certificate operations through DNS validation challenges.
Parameters:
- ctx: Parent context for lifecycle management
- log: Logger for operation and error reporting
- cfg: Configuration containing ACME server, account details, and DNS providers
The function performs several key operations:
- Sets up local storage for account persistence
- Configures and creates a Lego client with retry capability
- Handles ACME account registration (with External Account Binding if required)
- Initializes configured DNS providers (supports gcloud and Cloudflare)
- Starts a background process for certificate management
Returns a CertIssuer interface and any error encountered during setup.
type Config ¶
type Config struct {
Bus tpubsub.Publisher
Email string
Owner sdk.Address
KID string
HMAC string
StorageDir string
CADirURL string
Domains []string
HTTPChallengePort int
TLSChallengePort int
DNSProviders []string
DNSResolvers []string
DNSTimeout time.Duration
DNSPropagationWait time.Duration
DNSPropagationRNS bool
DNSDisableCP bool
DNSPropagationDisableANS bool
}
type Reader ¶
type Reader interface {
ReadResource(domain string) (*certificate.Resource, ResourcesInfo, error)
}
type ResourcesInfo ¶
type Storage ¶
type Storage interface {
AccountSetup() (*Account, certcrypto.KeyType, error)
AccountSave(*Account) error
AccountLoad(crypto.PrivateKey) (*Account, error)
GetPrivateKey(certcrypto.KeyType) (crypto.PrivateKey, error)
ArchiveDomain(string) error
SaveResource(resource *certificate.Resource) (ResourcesInfo, error)
Reader
}
func NewStorage ¶
func NewStorage(log log.Logger, cfg StorageConfig) (Storage, error)
NewStorage Creates a new AccountsStorage.
type StorageConfig ¶
type WriteOption ¶
type WriteOption func(*writeOptions) error
Click to show internal directories.
Click to hide internal directories.