common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidHash error
	ErrInvalidHash = errors.New("the encoded hash is not in the correct format")
	// ErrIncompatibleVersion error
	ErrIncompatibleVersion = errors.New("incompatible version of argon2")
)
View Source
var Validator = validator.New()

Validator instance

Functions

func Hash

func Hash(password string) (encodedHash string, err error)

Hash using argon 2

func SignToken

func SignToken(claims jwt.StandardClaims) (token string, err error)

SignToken sign jwt token using JWT_SECRET

func Validate

func Validate(s interface{}) error

Validate struct

func Verify

func Verify(password, encodedHash string) (match bool, err error)

Verify argon 2

func VerifyToken

func VerifyToken(token string, issuer string) (claims *jwt.StandardClaims, err error)

VerifyToken verify token

Types

type ValidationErrorJSON

type ValidationErrorJSON struct {
	Key     string `json:"key"`
	Message string `json:"message"`
	// contains filtered or unexported fields
}

ValidationErrorJSON struct

Jump to

Keyboard shortcuts

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