tokens

package
v0.0.0-...-9fb3cb1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2015 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	HashSize = 32
)

Variables

View Source
var (
	CSRFKey = []byte("0655A28CAAEB0448132026D863771C5D")

	ErrGeneratedBadToken = errors.New("Generated a token with an invalid length.")
)

Functions

func NewAuthToken

func NewAuthToken() []byte

NewAuthToken returns a hex-encoded byte slice with a length of 64. The token is generated by reading from the OS' PRNG source, usually /dev/urandom on Unix-like systems and the CryptGenRandom API on Windows.

func NewCSRFToken

func NewCSRFToken(id string) []byte

NewCSRFToken returns a byte slice with a new base-64 encoded CSRF token, only valid for a user's session.

func NewJobID

func NewJobID() string

Create fast random strings for job IDs. Made up to 29 million unique strings before I quit testing.

func NewSessionID

func NewSessionID() string

Types

This section is empty.

Jump to

Keyboard shortcuts

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