Documentation
¶
Index ¶
- Variables
- type CertificatePathResponse
- type Client
- func (c *Client) Do(req *http.Request, result interface{}) error
- func (c *Client) DoNewRequest(method, path string, result interface{}, params interface{}) error
- func (c *Client) NewRequest(method string, path string, params interface{}) (*http.Request, error)
- func (c *Client) SetAuthToken(at string)
- func (c *Client) SetUserAgent(ua string)
- type ClientOptions
- type DSSIdentity
- type DSSService
- type ExpiredIdentityFunc
- type IdentityRequest
- type IdentityResponse
- type IdentityVault
- type LoginRequest
- type LoginResponse
- type OrganizationUnit
- type PresenceFormat
- type QuotasResponse
- type Response
- type SigningRequest
- type SigningResponse
- type SubjectDn
- type SubjectDnExtraAttribute
- type TimestampRequest
- type TimestampResponse
- type TrustChainResponse
- type ValidationPolicyResponse
- type ValidationPolicySubjectDn
- type VaultItem
Constants ¶
This section is empty.
Variables ¶
var (
ErrDigestRequired = errors.New("File digest required")
)
Errors definition.
Functions ¶
This section is empty.
Types ¶
type CertificatePathResponse ¶
type CertificatePathResponse struct {
CA string `json:"path"`
}
CertificatePathResponse GlobalSign API response of `/certificate_path` endpoint.
type Client ¶
type Client struct { sync.RWMutex // BaseURL base URL of API. BaseURL *url.URL // DSSService Digital Signing Service (DSS). DSSService DSSService // contains filtered or unexported fields }
Client implements a client for Globalsign Atlas DSS API service.
func NewClient ¶
NewClient initiates client with API Key, API Secret, Certificate file path, Private Key file path and returns the globalsign client.
func NewClientWithOpts ¶
func NewClientWithOpts(opts *ClientOptions) (*Client, error)
NewClientWithOpts initiates client with `ClientOptions` and returns the globasign client.
func (*Client) DoNewRequest ¶
DoNewRequest create new http client request and process the request.
func (*Client) NewRequest ¶
NewRequest create new http client request.
func (*Client) SetAuthToken ¶
SetAuthToken sets authentication token of the client.
func (*Client) SetUserAgent ¶
SetUserAgent sets user agent of the client.
type ClientOptions ¶
type ClientOptions struct { // BaseURL base url of API. BaseURL *url.URL // APIKey API key credentials. APIKey string // APISecret API secret credentials. APISecret string // CertFilePath path file to mTLS cert file. CertFilePath string // KeyFilePath path file to mTLS cert private key. KeyFilePath string }
ClientOptions options for the globalsign client.
type DSSIdentity ¶
DSSIdentity represent acquired credential from login and identity request.
type DSSService ¶
type DSSService interface { Login(*LoginRequest) (*LoginResponse, error) Identity(*IdentityRequest) (*IdentityResponse, error) Timestamp(*TimestampRequest) (*TimestampResponse, error) Sign(*SigningRequest) (*SigningResponse, error) CertificatePath() (*CertificatePathResponse, error) TrustChain() (*TrustChainResponse, error) ValidationPolicy() (*ValidationPolicyResponse, error) QuotasSignatures() (*QuotasResponse, error) QuotasTimestamps() (*QuotasResponse, error) // DSS Identity and sign process services. DSSGetIdentity(context.Context, string, *IdentityRequest) (*DSSIdentity, error) DSSIdentitySign(context.Context, string, *IdentityRequest, []byte) ([]byte, error) DSSIdentityTimestamp(context.Context, string, *IdentityRequest, []byte) ([]byte, error) }
DSSService implements GlobalSign Digital Signing Service.
type ExpiredIdentityFunc ¶
type ExpiredIdentityFunc func(key string, identity *DSSIdentity)
ExpiredIdentityFunc is a callback which will be called once identity expired.
type IdentityRequest ¶
type IdentityRequest struct {
SubjectDn SubjectDn `json:"subject_dn"`
}
IdentityRequest GlobalSign API request parameters of `/identity` endpoint.
type IdentityResponse ¶
type IdentityResponse struct { ID string `json:"id"` SigningCert string `json:"signing_cert"` OCSPResponse string `json:"ocsp_response"` }
IdentityResponse GlobalSign API response of `/identity` endpoint.
type IdentityVault ¶
type IdentityVault struct {
// contains filtered or unexported fields
}
IdentityVault store DSS identity until its expired.
func NewIdentityVault ¶
func NewIdentityVault(duration time.Duration) *IdentityVault
NewIdentityVault is a helper to create instance of the identities vault struct.
func (*IdentityVault) Count ¶
func (cache *IdentityVault) Count() int
Count returns the number of items in the cache (helpful for tracking memory leaks).
func (*IdentityVault) Del ¶
func (cache *IdentityVault) Del(key string)
Del remove item without trigger callback.
func (*IdentityVault) Get ¶
func (cache *IdentityVault) Get(key string) (data *DSSIdentity, found bool)
Get is a thread-safe way to lookup items.
func (*IdentityVault) Set ¶
func (cache *IdentityVault) Set(key string, identity *DSSIdentity)
Set is a thread-safe way to add identity to cache.
type LoginRequest ¶
LoginRequest GlobalSign API request parameters of `/login` endpoint.
type LoginResponse ¶
type LoginResponse struct {
AccessToken string `json:"access_token"`
}
LoginResponse GlobalSign API response of `/login` endpoint.
type OrganizationUnit ¶
type OrganizationUnit struct { Static bool `json:"static"` List []string `json:"list"` MinCount int `json:"min_count"` MaxCount int `json:"max_count"` }
OrganizationUnit `organizational_unit` GlobalSign API response of `/validationpolicy` endpoint.
type PresenceFormat ¶
PresenceFormat `presence` and `format` GlobalSign API response of `/validationpolicy` endpoint.
type QuotasResponse ¶
type QuotasResponse struct {
Value int `json:"value"`
}
QuotasResponse GlobalSign API response of `/quotas/signatures` and `/quotas/timestamps` endpoint.
type Response ¶
Response wraps standard http Response with default response fields which returned from api.
type SigningRequest ¶
type SigningRequest struct { ID string `json:"id"` // Digest is the hex encoded SHA256 checksum of a source file. Digest string `json:"digest"` }
SigningRequest GlobalSign API request parameters of `/identity/{id}/sign/{digest}` endpoint.
type SigningResponse ¶
type SigningResponse struct {
Signature string `json:"signature"`
}
SigningResponse GlobalSign API response of `/identity/{id}/sign/{digest}` endpoint.
type SubjectDn ¶
type SubjectDn struct { Country string `json:"country,omitempty"` State string `json:"state,omitempty"` Locality string `json:"locality,omitempty"` StreetAddress string `json:"street_address,omitempty"` Organization string `json:"organization,omitempty"` OrganizationUnit []string `json:"organization_unit,omitempty"` CommonName string `json:"common_name,omitempty"` Email string `json:"email,omitempty"` JurisdictionOfIncorporationLocalityName string `json:"jurisdiction_of_incorporation_locality_name,omitempty"` JurisdictionOfIncorporationStateOrProvinceName string `json:"jurisdiction_of_incorporation_state_or_province_name,omitempty"` JurisdictionOfIncorporationCountryName string `json:"jurisdiction_of_incorporation_country_name,omitempty"` BusinessCategory string `json:"business_category,omitempty"` ExtraAttributes []SubjectDnExtraAttribute `json:"extra_attributes,omitempty"` }
SubjectDn parameter of `subject_dn`.
type SubjectDnExtraAttribute ¶
SubjectDnExtraAttribute extra attributes for parameter `extra_attributes`.
type TimestampRequest ¶
type TimestampRequest struct {
Digest string `json:"digest"`
}
TimestampRequest GlobalSign API request parameters of `/timestamp/{digest}` endpoint.
type TimestampResponse ¶
type TimestampResponse struct {
Token string `json:"token"`
}
TimestampResponse GlobalSign API response of `/timestamp/{digest}` endpoint.
type TrustChainResponse ¶
type TrustChainResponse struct { Trustchain []string `json:"trustchain"` OcspRevocationInfo []string `json:"ocsp_revocation_info"` }
TrustChainResponse GlobalSign API response of `/trustchain` endpoint.
type ValidationPolicyResponse ¶
type ValidationPolicyResponse struct {
SubjectDn ValidationPolicySubjectDn `json:"subject_dn"`
}
ValidationPolicyResponse GlobalSign API response of `/validationpolicy` endpoint.
type ValidationPolicySubjectDn ¶
type ValidationPolicySubjectDn struct { CommonName PresenceFormat `json:"common_name"` Organization PresenceFormat `json:"organization"` OrganizationUnit OrganizationUnit `json:"organization_unit"` Country PresenceFormat `json:"country"` State PresenceFormat `json:"state"` Locality PresenceFormat `json:"locality"` StreetAddress PresenceFormat `json:"street_address"` Email PresenceFormat `json:"email"` JurisdictionOfIncorporationLocalityName PresenceFormat `json:"jurisdiction_of_incorporation_locality_name"` JurisdictionOfIncorporationStateOrProvinceName PresenceFormat `json:"jurisdiction_of_incorporation_state_or_province_name"` JurisdictionOfIncorporationCountryName PresenceFormat `json:"jurisdiction_of_incorporation_country_name"` ExtraAttributes map[string]interface{} `json:"extra_attributes"` }
ValidationPolicySubjectDn GlobalSign API response of `/validationpolicy` endpoint `subject_dn`.