entrust

package module
v0.0.0-...-872cd36 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 11 Imported by: 0

README

Golang client for the Entrust Certificate Services Enterprise API

This is a simple and (currently) only partial implementation of the API.

This project is made available by Entrust Corporation under the MIT license. As such the client is provided to you AS IS and without warranty, as further detailed in the MIT license.

Config

Environment variable Value
ENTRUST_API_CERTIFICATE PEM encoded client certificate
ENTRUST_API_CERTIFICATE_PATH Client certificate path
ENTRUST_API_PRIVATE_KEY PEM encoded private key
ENTRUST_API_PRIVATE_KEY_PATH Private key path
ENTRUST_API_USERNAME API Username
ENTRUST_API_PASSWORD API Password (API Key)

The environment variables ENTRUST_API_CERTIFICATE and ENTRUST_API_PRIVATE_KEY take presedence over ENTRUST_API_CERTIFICATE_PATH and ENTRUST_API_PRIVATE_KEY_PATH.

Obtaining credentials

These credentials can be obtained via the Entrust Certificate Services Enterprise Portal (Enterprise Portal, Administration > Advanced Settings > API). In order to obtain an account and related credentials, you must have an active subscription or other entitlement from Entrust for Entrust Certificate Services (ECS).

Security

The Entrust credentials provide strong entitlements and can have a devastating impact to your organisation or service when not secured properly. It’s your sole responsibility to store these credentials securely and restrict API credentials to the resources and capabilities as required.

Do not put any credential directly in your configuration file!

Documentation

Index

Constants

View Source
const (
	APIServer = "https://api.entrust.net/enterprise/v2"
)

Default client configurations

Variables

This section is empty.

Functions

This section is empty.

Types

type AddDomainRequest

type AddDomainRequest struct {
	DomainName         string `json:"domainName"`
	VerificationMethod string `json:"verificationMethod"` // enum (DNS, EMAIL, MANUAL, WEB_SERVER)
}

AddDomainRequest contains the paramters to create a new domain

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for the Entrust API

func New

func New() (*Client, error)

New Entrust API client

func (*Client) GetDomain

func (c *Client) GetDomain(clientID int, domain string) (*Domain, error)

GetDomain requests information about a domain in the account GET /clients/{clientId}/domains/{domain}

func (*Client) GetDomains

func (c *Client) GetDomains(offset, limit int, expiry *time.Time) (*GetDomainsResponse, error)

GetDomains lists domains based on a filter

func (*Client) ReverifyDomain

func (c *Client) ReverifyDomain(clientID int, domain string) error

ReverifyDomain sends a domain for reverification. PUT /clients/{clientId}/domains/{domain}

type DNSMethod

type DNSMethod struct {
	RecordDomain string `json:"recordDomain"`
	RecvordType  string `json:"recvordType"`
	RecordValue  string `json:"recordValue"`
}

DNSMethod information

type Domain

type Domain struct {
	ClientID           int        `json:"clientId,omitempty"`           // Client id of the client to which the domain belongs to
	DomainName         string     `json:"domainName,omitempty"`         // Domain name
	EVEligible         bool       `json:"evEligible,omitempty"`         // Whether this domain can be used for EV certificates
	EVExpiry           time.Time  `json:"evExpiry,omitempty"`           // Expiry time of verified EV information
	OVEligible         bool       `json:"ovEligible,omitempty"`         // Whether this domain can be used for OV certificates
	OVExpiry           time.Time  `json:"ovExpiry,omitempty"`           // Expiry time of verified OV information
	VerificationMethod string     `json:"verificationMethod,omitempty"` // (DNS, EMAIL, MANUAL, WEB_SERVER)
	VerificationStatus string     `json:"verificationStatus,omitempty"`
	DNSMethod          *DNSMethod `json:"dnsMethod"`
}

Domain model

type GetDomainsResponse

type GetDomainsResponse struct {
	Response
	Summary *Summary `json:"summary"`
	Domains []Domain `json:"domains"`
}

GetDomainsResponse holds a list of domains

type Response

type Response struct {
	Status int
	Errors []struct {
		Message string
	}
}

Response holds the default API response

type ReverifyDomainRequest

type ReverifyDomainRequest struct {
	VerificationMethod string `json:"verificationMethod"` // enum (DNS, EMAIL, MANUAL, WEB_SERVER)
}

ReverifyDomainRequest schedule domain for revalidation

type Summary

type Summary struct {
	Timestamp time.Time `json:"timestamp"`
	Elapsed   int       `json:"elapsed"`
	Offset    int       `json:"offset"`
	Limit     int       `json:"limit"`
	Total     int       `json:"total"`
	Sort      string    `json:"sort"`
}

Summary of the response

Jump to

Keyboard shortcuts

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