provider

package
v0.0.0-...-87faeab Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenAPIKey

func GenAPIKey(uid uuid.UUID, s store.Store) (string, error)

GenAPIKey generates an api key for third party applications.

Types

type Claims

type Claims struct {
	jwt.StandardClaims
	UserID string `json:"_uid"`
}

Claims is our custom metadata, which will be hashed and sent as the second segment in our JWT.

type Email

type Email struct {
	Name    string
	Address string
}

Email holds the recipients email address and name

func NewEmail

func NewEmail(name, address string) Email

NewEmail returns an email address

type JWTService

type JWTService interface {
	Encode(uid string) (token string, err error)
	Decode(token string) (userID string, issuedAt time.Time, err error)
}

JWTService defines an implementation of our JWT authentication service.

func NewJWTService

func NewJWTService(cfg *config.Config) (JWTService, error)

NewJWTService configures and returns a JWT authentication instance.

type Mailer

type Mailer struct {
	// contains filtered or unexported fields
}

func NewMailerWithSMTP

func NewMailerWithSMTP(cfg *config.Config, tplDir string) (*Mailer, error)

NewEmailWithSMTP is a constructor function that initializes and returns a ready to use mailer object, an error interface otherwise.

func (Mailer) SendVerifyNotification

func (m Mailer) SendVerifyNotification(address string, content VerifyEmailContent) error

SendVerifyNotification sends the verify email notification to the user's email address.

func (Mailer) SendWelcomeNotification

func (m Mailer) SendWelcomeNotification(address string, content WelcomeEmailContent) error

type VerifyEmailContent

type VerifyEmailContent struct {
	// Email              string
	SiteURL            string
	SiteName           string
	VerificationExpiry time.Time
	VerificationURL    string
}

VerifyEmailContent provides the values to be displayed in the verify email template.

type WelcomeEmailContent

type WelcomeEmailContent struct {
	SiteURL  string
	SiteName string
	LoginURL string
}

WelcomeEmailContent provides the values to be displayed in the welcome email template.

Jump to

Keyboard shortcuts

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