crypto

package
v0.0.0-...-d0d4adc Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const VERIFICATION_TOKEN_TYPE = "verification"

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(passwordHash []byte, password []byte, iterations int) bool

func GenSalt

func GenSalt(size int) []byte

func HashPassword

func HashPassword(salt []byte, iterations int, password []byte) []byte

func TimePassed

func TimePassed(t time.Time, period time.Duration) bool

Types

type TokenBody

type TokenBody struct {
	Type          string `json:"type"`
	Id            uint64 `json:"id"`
	User_id       uint64 `json:"user_id"`
	Creation_date int64  `json:"creation_date"`
}

func (TokenBody) Check

func (body TokenBody) Check(token_str string, salt []byte) (bool, error)

func (*TokenBody) Gen

func (body *TokenBody) Gen(salt []byte) (string, error)

return token in string format

func (*TokenBody) Parse

func (body *TokenBody) Parse(token_str string) error

type VerificationTokenBody

type VerificationTokenBody struct {
	Type          string `json:"type"`
	Id            uint64 `json:"id"`
	Login         string `json:"login"`
	Creation_date int64  `json:"creation_date"`
	Resended      uint16 `json:"resended"`
}

token for verification password

func (VerificationTokenBody) Check

func (body VerificationTokenBody) Check(token_str string, salt []byte) (bool, error)

func (*VerificationTokenBody) Gen

func (body *VerificationTokenBody) Gen(salt []byte) (string, error)

func (*VerificationTokenBody) Parse

func (body *VerificationTokenBody) Parse(token string) error

Jump to

Keyboard shortcuts

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