security

package
v0.0.0-...-8717a1f Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TFATokenScope     = "tfa"
	UserTokenScope    = "user"
	RefreshTokenScope = "refresh"
)
View Source
var (
	RefreshAccessTokenExpiration = time.Second * 60 * 60 * 24 // one day
	UserAccessTokenExpiration    = time.Second * 60 * 10      // 10 minutes
	TFATokenExpiration           = time.Second * 60 * 2       // 2 minutes
	ForgotPassExpiration         = time.Second * 60 * 5       // 5 minutes
	EmailVerificationExpiration  = time.Second * 60 * 2       // 2 minutes
)

Functions

func ComparePassword

func ComparePassword(hashedPassword string, plainPassword string) error

func GenerateOTP

func GenerateOTP(length int) (string, error)

func GenerateUUID

func GenerateUUID() string

func HashPassword

func HashPassword(password string) string

Types

type AccessToken

type AccessToken struct {
	Key       string
	Value     string
	Type      string
	ExpiredAt time.Time
}

func CreateAccessToken

func CreateAccessToken(user userland.User, jwtSecret string, options AccessTokenOptions) (AccessToken, error)

type AccessTokenOptions

type AccessTokenOptions struct {
	Expiration  time.Duration
	Scope       string
	CustomClaim map[string]interface{}
}

Jump to

Keyboard shortcuts

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