token

package
v1.8.69 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCreateFailure is returned wrapped from generate when a token fails
	// to create
	ErrCreateFailure = errors.New("an error occurred while creating a token")

	// ErrInvalidToken is returned if a provided security token is not legit
	ErrInvalidToken = errors.New("the provided token is not valid")

	// ErrTokenExpired is returned when a token is not longer available for use
	ErrTokenExpired = errors.New("the provided token has expired")

	// ErrTokenNotFound when the token is not found
	ErrTokenNotFound = errors.New("the provided token does not exist")
)

Functions

func ExtractTokenPartsFromToken

func ExtractTokenPartsFromToken(token string) (selector, verifier string, err error)

func GenerateToken

func GenerateToken() (selector, verifier, token string, err error)

GenerateToken generates pieces needed for user confirm selector: hash of the first half of a 64 byte value (to be stored in the database and used in SELECT query) verifier: hash of the second half of a 64 byte value (to be stored in database but never used in SELECT query) token: the user-facing base64 encoded selector+verifier

Types

This section is empty.

Jump to

Keyboard shortcuts

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