email

package
v0.0.0-...-9d56a58 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogSender

type LogSender struct {
	Sender
}

LogSender implements Sender interface which logs the email, token and challenge to stderr and forwards to the wrapped Sender.

func (LogSender) SendChallenge

func (s LogSender) SendChallenge(email, challenge string) error

func (LogSender) SendToken

func (s LogSender) SendToken(email, token string) error

type MemSender

type MemSender struct {
	Email, Token, Challenge string
}

MemEmail implements Sender interface to be used for testing.

func (*MemSender) SendChallenge

func (s *MemSender) SendChallenge(email, challenge string) error

func (*MemSender) SendToken

func (s *MemSender) SendToken(email, token string) error

type NullSender

type NullSender struct{}

func (NullSender) SendChallenge

func (s NullSender) SendChallenge(email, challenge string) error

func (NullSender) SendToken

func (s NullSender) SendToken(email, token string) error

type SESConfig

type SESConfig struct {
	// The email address that is sending the email. This email address must be either
	// individually verified with Amazon SES, or from a domain that has been verified
	// with Amazon SES. For information about verifying identities, see the Amazon
	// SES Developer Guide (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-addresses-and-domains.html).
	Source string `yaml:"source"`
	// This parameter is used only for sending authorization. It is the ARN of the
	// identity that is associated with the sending authorization policy that permits
	// you to send for the email address specified in the Source parameter.
	SourceArn string `yaml:"sourceArn"`
	// The name of the configuration set to use when you send an email using SendTemplatedEmail.
	// If you do not want to use a configuration set, set to empty string.
	ConfigurationSetName string `yaml:"configurationSetName"`
	// The reply-to email address(es) for the message. If the recipient replies
	// to the message, each reply-to address will receive the reply.
	ReplyToAddresses []string `yaml:"replyToAddresses"`
	// The email address that bounces and complaints will be forwarded to when feedback
	// forwarding is enabled. If the message cannot be delivered to the recipient,
	// then an error message will be returned from the recipient's ISP; this message
	// will then be forwarded to the email address specified by the ReturnPath parameter.
	// The ReturnPath parameter is never overwritten. This email address must be
	// either individually verified with Amazon SES, or from a domain that has been
	// verified with Amazon SES.
	ReturnPath string `yaml:"returnPath"`
	// This parameter is used only for sending authorization. It is the ARN of the
	// identity that is associated with the sending authorization policy that permits
	// you to use the email address specified in the ReturnPath parameter.
	ReturnPathArn string `yaml:"returnPathArn"`
	// AWS SES email template to use when sending the delete confirmation email.
	// The {{email}}, {{token}} and {{tokenEscaped}} variables in the template are replaced with values set by Vey.
	DeleteTemplate string `yaml:"deleteTemplate"`
	// AWS SES email template to use when sending the put confirmation email.
	// The {{email}}, {{challenge}} and {{challengeEscaped}} variables in the template are replaced with values set by Vey.
	PutTemplate string `yaml:"putTemplate"`
}

See https://pkg.go.dev/github.com/aws/aws-sdk-go/service/ses#SendTemplatedEmailInput for details.

type SESSender

type SESSender struct {
	Config SESConfig
	SES    *ses.SES
}

SESSender implements Sender interface using AWS SES.

func (SESSender) SendChallenge

func (s SESSender) SendChallenge(dst, challenge string) error

SendChallenge sends the challenge to the dst email address.

func (SESSender) SendToken

func (s SESSender) SendToken(dst, token string) error

SendToken sends the token to the dst email address.

type Sender

type Sender interface {
	// SendToken sends a token to the email address.
	// token is the base64 encoded form of Vey's BeginDelete func return value.
	// The email recipient should call Vey server's CommitDelete API with the token.
	SendToken(email, token string) error
	// SendChallenge sends a challenge to the email address.
	// challenge is the base64 encoded form of Vey's BeginPut func return value.
	// The email recipient should sign the challenge with it's private key, and call Vey server's CommitPut API with the challenge and signature.
	SendChallenge(email, challenge string) error
}

func NewLogSender

func NewLogSender(s Sender) Sender

func NewMemSender

func NewMemSender() Sender

func NewSESSender

func NewSESSender(c SESConfig, ses *ses.SES) Sender

NewSESSender returns a SESSender which sends email via Amazon SES. If the templates have an error, NewSESSender may panic.

Jump to

Keyboard shortcuts

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