crypto

package
v0.0.0-...-6151759 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2017 License: GPL-2.0, GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTToken

type JWTToken struct {
	// contains filtered or unexported fields
}

JWTToken is authentication token provider/validator using JWT

func NewJWTToken

func NewJWTToken(privateKeyPath, pubKeyPath, issuer string) (*JWTToken, error)

NewJWTToken creates new JWTToken instance initialized from keys on disk

func (*JWTToken) Create

func (a *JWTToken) Create(u *lara.User) (string, error)

Create creates authentication token for given user

func (*JWTToken) Parse

func (a *JWTToken) Parse(tokenString string) (*lara.User, error)

Parse validates and parses given authentication token. If valid, lara.User object encoded in token is returned

type Password

type Password struct {
	// SaltBytes is salt length in bytes
	SaltBytes int
	// HashBytes is password hash length in bytes
	HashBytes int
	// contains filtered or unexported fields
}

Password contains methods for manipulating with passwords.

func NewPassword

func NewPassword() *Password

NewPassword returns new Password struct with default values.

func (*Password) Check

func (p *Password) Check(pass string, salt, hash []byte) error

Check verifies whether supplied password and salt can be encrypted to supplied hash. If not, error is returned.

func (*Password) Create

func (p *Password) Create(pass string) ([]byte, []byte, error)

Create returns password's hash and salt generated from supplied password.

Jump to

Keyboard shortcuts

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