magic

package
v0.2.92 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Key        flow.Key = "magic"
	GCInterval          = time.Minute
	Expiry              = time.Minute * 5
)

Variables

View Source
var (
	ErrInvalidSecret = errors.New("invalid secret")
)

Functions

This section is empty.

Types

type Magic

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

func New

func New(storage storage.Magic, options *Options, logger *zerolog.Logger) *Magic

func (*Magic) CompleteFlow

func (g *Magic) CompleteFlow(ctx context.Context, email string, secret []byte) (string, string, string, error)

func (*Magic) Key

func (g *Magic) Key() flow.Key

func (*Magic) SendMagic

func (g *Magic) SendMagic(ctx context.Context, url string, email string, ip string, token string) (err error)

func (*Magic) Start

func (g *Magic) Start() error

func (*Magic) StartFlow

func (g *Magic) StartFlow(ctx context.Context, email string, ip string, nextURL string, organization string, deviceIdentifier string) ([]byte, error)

func (*Magic) Stop

func (g *Magic) Stop() error

type Options

type Options struct {
	APIToken   string
	From       string
	Project    string
	ProjectURL string
	TemplateID int
	Tag        string
}

Jump to

Keyboard shortcuts

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