auth

package
v0.0.0-...-7fb72bf Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserAlreadyExists = errors.New("user already exists")

Functions

This section is empty.

Types

type Auth

type Auth interface {
	// Register creates a UserRegistered event and waits for the user to be added.
	// Returns the generated user ID for the user on success.
	Register(ctx context.Context, email string, password string) (string, error)

	// Validate checks if the id and password are correct.
	//
	// Returns true if they match
	// Returns false if they do not match, but the check itself was made
	// Returns an error if the check could not be made
	ValidateByID(ctx context.Context, id string, password string) (bool, error)

	// GetIDFromEmail gets the canonical user ID from the given email, if it exists
	//
	// Returns the ID on match
	// Returns an empty string if not found
	// Returns an error if something unexpected occurred
	GetIDFromEmail(ctx context.Context, email string) (string, error)
}

Auth performs auth operations and updates an underlying data store and event stream

func New

func New(db authdb.Db, eventWriter events.Writer) Auth

Jump to

Keyboard shortcuts

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