Documentation
¶
Overview ¶
Package mailcheckr provides a server-side client for the MailCheckr API.
Index ¶
Constants ¶
const DefaultBaseURL = "https://mailcheckr.app/api/v1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
APIError is a non-2xx response. Response holds the decoded JSON error body when available.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls the MailCheckr verification API.
type Option ¶
Option configures a Client.
func WithBaseURL ¶
WithBaseURL sets the API base URL, primarily for private installations or tests.
func WithHTTPClient ¶
WithHTTPClient supplies an HTTP client. Its timeout and transport are respected.
type Verification ¶
type Verification struct {
ID string `json:"id"`
Email string `json:"email"`
State string `json:"state"`
Status *string `json:"status"`
Reason *string `json:"reason"`
Checks json.RawMessage `json:"checks"`
Attempts int `json:"attempts"`
CreatedAt *time.Time `json:"created_at"`
CompletedAt *time.Time `json:"completed_at"`
Raw json.RawMessage `json:"-"`
}
Verification is a verification result. Raw contains the full API data object.
func (Verification) IsCompleted ¶
func (v Verification) IsCompleted() bool
func (Verification) IsDeliverable ¶
func (v Verification) IsDeliverable() bool
func (Verification) IsFailed ¶
func (v Verification) IsFailed() bool
func (Verification) IsPending ¶
func (v Verification) IsPending() bool
func (Verification) IsRisky ¶
func (v Verification) IsRisky() bool
func (Verification) IsUndeliverable ¶
func (v Verification) IsUndeliverable() bool
func (Verification) IsUnknown ¶
func (v Verification) IsUnknown() bool
type WebhookVerifier ¶
type WebhookVerifier struct {
// contains filtered or unexported fields
}
WebhookVerifier validates a signature against the exact raw request body.
func NewWebhookVerifier ¶
func NewWebhookVerifier(secret string, tolerance ...time.Duration) *WebhookVerifier
NewWebhookVerifier uses a five-minute timestamp tolerance by default. A supplied tolerance must be positive.
func (*WebhookVerifier) Verify ¶
func (w *WebhookVerifier) Verify(body []byte, headers http.Header) bool
Verify checks the MailCheckr headers and exact raw body bytes.
func (*WebhookVerifier) VerifyPayload ¶
func (w *WebhookVerifier) VerifyPayload(body []byte, timestamp, signature string) bool
VerifyPayload checks a timestamped v1 HMAC-SHA256 signature.