authentication

package
v0.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPasswordConfig = ArgonConfig{
	Time:    argonTime,
	Memory:  argonMemory,
	Threads: argonThreads,
	KeyLen:  argonKeyLen,
}
View Source
var (
	ErrMismatchedHashAndPassword = errors.New("ponc/authentication: hashedPassword is not the hash of the given password")
)
View Source
var OTPOpts = totp.ValidateOpts{
	Period:    otpPeriod,
	Skew:      otpSkew,
	Digits:    otpDigits,
	Algorithm: otp.AlgorithmSHA256,
}

Functions

func CompareHashAndPassword

func CompareHashAndPassword(hashData string, password []byte) error

CompareHashAndPassword is used to compare a user-inputted password to a hash to see if the password matches.

func GenerateHash

func GenerateHash(c ArgonConfig, password []byte, randSrc io.Reader) (string, error)

GenerateHash is used to generate a new password hash for storing and comparing at a later date. randSrc should be nil for normal use and set to a math/rand.Reader for testing.

func GenerateOTPPassword

func GenerateOTPPassword(secret string) (string, error)

func NewOTP

func NewOTP() (string, string)

func ValidateOTP

func ValidateOTP(logger *zap.Logger, secret string, pass string) bool

Types

type ArgonConfig

type ArgonConfig struct {
	Time    uint32
	Memory  uint32
	Threads uint8
	KeyLen  uint32
}

Jump to

Keyboard shortcuts

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