Documentation
¶
Overview ¶
Package sns parses and verifies AWS SNS HTTP(S) deliveries: message envelope validation, signing certificate retrieval, RSA signature verification, and subscription URL validation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateSubscribeURL ¶
ValidateSubscribeURL rejects a SubscribeURL unless it is a trusted SNS endpoint whose ConfirmSubscription query matches the signed message.
Types ¶
type Decoder ¶
type Decoder struct{}
Decoder decodes an SNS Notification into a normalized event. Confirmations yield a nil event: they are valid requests with nothing to persist.
type Message ¶
type Message struct {
Type string `json:"Type"`
MessageID string `json:"MessageId"`
TopicARN string `json:"TopicArn"`
Subject string `json:"Subject,omitempty"`
Message string `json:"Message"`
Timestamp string `json:"Timestamp"`
SignatureVersion string `json:"SignatureVersion"`
Signature string `json:"Signature"`
SigningCertURL string `json:"SigningCertURL"`
Token string `json:"Token,omitempty"`
SubscribeURL string `json:"SubscribeURL,omitempty"`
}
Message is an SNS delivery: a Notification, SubscriptionConfirmation, or UnsubscribeConfirmation.
func ParseMessage ¶
ParseMessage decodes and validates an SNS message body, including its SigningCertURL and, for confirmations, its SubscribeURL.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier verifies SNS message signatures, fetching and caching the AWS signing certificates.
func NewVerifier ¶
NewVerifier returns a Verifier that fetches signing certificates with client, or http.DefaultClient when client is nil.