Documentation
¶
Index ¶
Constants ¶
const ( CSRStatusPending CSRStatus = "pending" CSRStatusApproved CSRStatus = "approved" CSRStatusDenied CSRStatus = "denied" CSRStatusDescriptionPending string = "CSR submitted successfully. Await processing." CSRStatusDescriptionApproved string = "CSR approved. The certificate is ready for download." CSRStatusDescriptionDenied string = "CSR denied. Please contact the administrator." CSRTypeWebhook CSRType = "webhook" CSRTypePrivateServer CSRType = "private_server" )
const BASE_URL = "https://ca.sms-gate.app/api/v1"
Variables ¶
This section is empty.
Functions ¶
func IsValidCSRType ¶ added in v1.5.5
IsValidCSRType checks if the given CSR type is valid.
Types ¶
type CSRStatus ¶
type CSRStatus string
func (CSRStatus) Description ¶
Description returns a human-readable description for the given CSR status.
type Client ¶
func (*Client) GetCSRStatus ¶
GetCSRStatus retrieves the status of a Certificate Signing Request (CSR) from the Certificate Authority (CA) service.
func (*Client) PostCSR ¶
func (c *Client) PostCSR(ctx context.Context, request PostCSRRequest) (PostCSRResponse, error)
PostCSR posts a Certificate Signing Request (CSR) to the Certificate Authority (CA) service.
The service will validate the CSR and respond with a request ID.
The request ID can be used to get the status of the request using the GetCSRStatus method.
type GetCSRStatusResponse ¶
type GetCSRStatusResponse = PostCSRResponse
type PostCSRRequest ¶
type PostCSRRequest struct { // Type is the type of the CSR. By default, it is set to "webhook". Type CSRType `json:"type,omitempty" default:"webhook"` // Content contains the CSR content and is required. Content string `json:"content" validate:"required,max=16384,startswith=-----BEGIN CERTIFICATE REQUEST-----"` // Metadata includes additional metadata related to the CSR. Metadata map[string]string `json:"metadata,omitempty" validate:"dive,keys,max=64,endkeys,max=256"` }
PostCSRRequest represents a request to post a Certificate Signing Request (CSR).
func (PostCSRRequest) Validate ¶ added in v1.5.5
func (c PostCSRRequest) Validate() error
Validate checks if the request is valid.
type PostCSRResponse ¶
type PostCSRResponse struct { // RequestID is the ID of the request. Can be used to request status. RequestID string `json:"request_id"` // Type is the type of the requested certificate. Type CSRType `json:"type"` // Status is the status of the requested certificate. Status CSRStatus `json:"status"` // Message is a human-readable description of the status. Message string `json:"message"` // Certificate is the certificate issued by the CA. This field is only present // if the status is `approved`. Certificate string `json:"certificate,omitempty"` }
PostCSRResponse is a response to a request to post a Certificate Signing Request (CSR).