keyshare

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound = errors.New("could not find specified user")
	ErrDB           = errors.New("database error")

	ErrInvalidEmail       = errors.New("invalid email address")
	ErrInvalidEmailDomain = errors.New("invalid email domain")

	ErrNoNetwork = errors.New("no network connection")
)

Functions

func ParseEmailAddress added in v0.13.0

func ParseEmailAddress(email string) (*mail.Address, error)

ParseEmailAddress parses a single RFC 5322 address, e.g. "Barry Gibbs <bg@example.com>"

func ParseEmailTemplates

func ParseEmailTemplates(files, subjects map[string]string, defaultLanguage string) (map[string]*template.Template, error)

func VerifyMXRecord added in v0.13.0

func VerifyMXRecord(email string) error

VerifyMXRecord checks if the given email address has a valid MX record. If none is found, it alternatively looks for a valid A or AAAA record as this is used as fallback by mailservers

func WriteError added in v0.12.3

func WriteError(w http.ResponseWriter, err error)

Types

type DB

type DB struct {
	*sql.DB
}

func (*DB) EmailRevalidation added in v0.13.0

func (db *DB) EmailRevalidation(ctx context.Context) bool

EmailRevalidation returns whether email address revalidation is enabled.

func (*DB) ExecCountContext added in v0.12.3

func (db *DB) ExecCountContext(ctx context.Context, query string, args ...interface{}) (int64, error)

func (*DB) ExecUserContext added in v0.12.3

func (db *DB) ExecUserContext(ctx context.Context, query string, args ...interface{}) error

func (*DB) QueryIterateContext added in v0.12.3

func (db *DB) QueryIterateContext(ctx context.Context, query string, f func(rows *sql.Rows) error, args ...interface{}) error

func (*DB) QueryScanContext added in v0.12.3

func (db *DB) QueryScanContext(ctx context.Context, query string, results []interface{}, args ...interface{}) error

func (*DB) QueryUserContext added in v0.12.3

func (db *DB) QueryUserContext(ctx context.Context, query string, results []interface{}, args ...interface{}) error

type EmailConfiguration

type EmailConfiguration struct {
	EmailServer     string `json:"email_server" mapstructure:"email_server"`
	EmailHostname   string `json:"email_hostname" mapstructure:"email_hostname"`
	EmailFrom       string `json:"email_from" mapstructure:"email_from"`
	DefaultLanguage string `json:"default_language" mapstructure:"default_language"`
	EmailAuth       smtp.Auth
}

func (EmailConfiguration) SendEmail

func (conf EmailConfiguration) SendEmail(
	templates map[string]*template.Template,
	subjects map[string]string,
	templateData map[string]string,
	to []string,
	lang string,
) error

SendEmail sends a templated email to the supplied email address(es). When multiple recipients are specified, the email is sent as a BCC email.

func (EmailConfiguration) TranslateString

func (conf EmailConfiguration) TranslateString(strings map[string]string, lang string) string

func (EmailConfiguration) VerifyEmailServer

func (conf EmailConfiguration) VerifyEmailServer() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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