auth

package
v0.0.0-...-1ad4281 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAuthKey  = errors.New("error user/auth/auth: Invalid Auth Key")
	ErrInvalidUsername = errors.New("error user/auth/login: Invalid Username")
	ErrUnverifiedEmail = errors.New("error user/auth/login: Unverified Email")
)

Functions

func AuthKeyLogin

func AuthKeyLogin(c *fiber.Ctx, userID int64, authKey string) (privateArmored pgp.PrivateKey, err error)

func CanLogin

func CanLogin(username string) (userID int64, err error)

CanLogin can user (username) login

func HashKey

func HashKey(key string) (keyHash []byte, err error)

func HashKeyB64

func HashKeyB64(key string) (keyHash string, err error)

func Logout

func Logout(c *fiber.Ctx)

Logout user logs own errors

Types

type LoginDifficulty

type LoginDifficulty int8

LoginDifficulty int8

const (
	// None user has 0-2 login attempts
	None LoginDifficulty = iota
	// Easy user has 3-4 login attempts
	Easy
	// Medium user has 5-6 login attempts
	Medium
	// Hard user has 7-8 login attempts
	Hard
	// ExtraHard user has 9+ login attempts
	ExtraHard
)

func LoginDiff

func LoginDiff(userID int64) (LoginDifficulty, error)

LoginDiff user's login difficulty based on login attempts

Jump to

Keyboard shortcuts

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